[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-22 20:08:08 CEST

Hyrum K. Wright wrote:
> 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.

Issue 2798.

> 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($_);
>> }
>

Received on Fri Jun 22 20:08:00 2007

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