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

Re: Fwd: [PATCH] Fix for `svn patch` changing permissions of patched files

From: Cathy Fitzpatrick <cathy_at_cathyjf.com>
Date: Fri, 22 Nov 2013 04:35:38 -0700

Hi again:

A close look at `svn_subst_copy_and_translate4` confirms that my guess
was correct. If the file does not have an EOL property, then
`svn_subst_copy_and_translate4` behaves as you say. If, however, it
does have an EOL property, then the last thing that
`svn_subst_copy_and_translate4` does is copy the file permissions from
the file under /tmp to the final destination file (line 1818 of
libsvn_subr/subst.c in r1544295). You are correct that it is the file
with the correct permissions that is copied to the final destination,
but then `svn_subst_copy_and_translate4` overwrites those permissions
(if and only if the file has an EOL property). So that's why we were
seeing different things.

See also my example set of commands in one of my other emails.

Thanks,

Cathy

On Fri, Nov 22, 2013 at 4:27 AM, Philip Martin
<philip.martin_at_wandisco.com> wrote:
> Cathy Fitzpatrick <cathy_at_cathyjf.com> writes:
>
>> As for why it's different on different machines -- it probably depends
>> on some details in APR. As I mentioned several times, the way the `svn
>> patch` code works is that it creates a file under /tmp and then copies
>> it to the final destination. The reason that gives 600 permissions on
>> the machines I've tried is that `apr_file_mktemp` creates files under
>> /tmp with 600 permissions.
>
> A new file is initially created in the system temp dir with permissions
> 600. However libsvn_client/patch.c:install_patched_target calls
> svn_subst_copy_and_translate4 and that creates a second temporary file
> in the working copy with permissions that respect umask. The content of
> the 600 file is copied into the umask file and it is the umask file that
> gets renamed to the working file. Why are you seeing something
> different?
>
> --
> Philip Martin | Subversion Committer
> WANdisco // *Non-Stop Data*
Received on 2013-11-22 12:36:11 CET

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