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

Re: [PATCH] svn_load_dirs.pl: importing new version of non-writable file fails

From: Hyrum K. Wright <hyrum_wright_at_mail.utexas.edu>
Date: 2007-06-03 04:07:34 CEST

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Ping...
This patch has been out there for a while, but hasn't had any comments.
 If there are none in the next few days, I'll open an issue.

- -Hyrum

Mark Reibert wrote:
> Hello,
>
> svn_load_dirs.pl does not handle non-writable files in the staging
> working copy when it copies files from the import directory. This
> situation naturally occurs if the "svn:needs-lock" property is set on a
> file. The attached patch addresses this by calling "svn lock" if the
> target is non-writable. This is done for objects that have a MD5
> computed, which brings us to ...
>
> The script is computing MD5s for plain files *and* links, provided the
> target of the link is a plain file. This does not seem correct since,
> for example, what if the link pointed to a file outside the tree under
> revision control? After all, if the link target is inside the tree the
> script will find it as well as the link. The attached patch deals with
> this issue by computing a MD5 only for plain files (and is a
> pre-condition for the "svn lock" change).
>
> Existing locks are not stolen. Should they be?
>
> [[[
> * contrib/client-side/svn_load_dirs/svn_load_dirs.pl.in
> Attempt to get a lock for updates to read-only files.
> Compute MD5 only for plain file objects.
> ]]]
>
>
>
> ------------------------------------------------------------------------
>
> Index: contrib/client-side/svn_load_dirs/svn_load_dirs.pl.in
> ===================================================================
> --- contrib/client-side/svn_load_dirs/svn_load_dirs.pl.in (revision 24000)
> +++ contrib/client-side/svn_load_dirs/svn_load_dirs.pl.in (working copy)
> @@ -925,6 +925,21 @@
> {
> print "U $source_path\n";
> $upd_files{$source_path} = $del_info;
> +
> + # It is possible for the destination file to be
> + # read-only if it has the svn:needs-lock property set.
> + # In this case we get a lock (which is safe even if
> + # svn:needs-lock is not set). Note this only applies to
> + # plain files, but that is implied here since digests
> + # are computed only for plain files. Note also there is
> + # a corner case in which the lock request will fail if
> + # the file is locked by someone else.
> + unless (-w $dest_path)
> + {
> + read_from_process($svn, 'lock',
> + @svn_use_repos_cmd_opts,
> + $dest_path);
> + }
> }
> }
> }
> @@ -1593,7 +1608,7 @@
> return if $_ eq '.';
> my ($file_type) = &file_info($_);
> my $file_digest;
> - if ($file_type eq 'f' or ($file_type eq 'l' and stat($_) and -f _))
> + if ($file_type eq 'f')
> {
> $file_digest = &digest_hash_file($_);
> }
>
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFGYiJmCwOubk4kUXwRArpnAKDj1LSkkuj+OD4jViRemQPm7JS2wQCgsugw
O2DS/BmNQt8Kxb73RE6qjW8=
=tbMe
-----END PGP SIGNATURE-----

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Sun Jun 3 04:04:53 2007

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.