[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Re: svn commit: r38077 - in trunk/subversion: libsvn_client tests/cmdline

From: Philip Martin <philip_at_codematters.co.uk>
Date: Thu, 18 Jun 2009 19:27:35 +0100

"Hyrum K. Wright" <hyrum_at_hyrumwright.org> writes:

> Author: hwright
> Date: Thu Jun 18 09:00:36 2009
> New Revision: 38077

> svn_wc_adm_access_t *adm_access;
> struct validator_baton_t vb;
> + svn_node_kind_t kind;
> +
> + /* We can't relocate an individual file, so don't even try. */
> + SVN_ERR(svn_io_check_path(path, &kind, pool));
> + if (kind != svn_node_dir)
> + return svn_error_create
> + (SVN_ERR_CLIENT_INVALID_RELOCATION, NULL,
> + _("Cannot relocate a single file"));
>
> /* Get an access baton for PATH. */
> SVN_ERR(svn_wc_adm_probe_open3(&adm_access, NULL, path,

That's an anti-pattern: it's usually wrong for the WC code to (try to)
validate an operation before attempting it. One reason it's wrong is
that it leaves a race between the filesystem stat and the adm open.
Another reason is that when the path is valid there is an unnecessary
stat call. It would be better to determine whether path is valid by
interrogating the access baton and calling stat if necessary in the
error path.

------------------------------------------------------
http://subversion.tigris.org/ds/viewMessage.do?dsForumId=462&dsMessageId=2363285
Received on 2009-06-18 20:27:54 CEST

This is an archived mail posted to the Subversion Dev mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.