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

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

From: Cathy Fitzpatrick <cathy_at_cathyjf.com>
Date: Wed, 20 Nov 2013 18:07:25 -0700

Hello,

Currently the `svn patch` command changes the permissions on any file
it patches to 600. This occurs because it creates a file under the
system temporary directory for applying the patch, and then copies
this file to the final destination. `apr_file_mktemp` sensibly assigns
mode 600 to files created under the system temporary directory to
avoid them being exposed to the entire system. So the result is that
any file that `svn patch` patches ends up with 600 permissions rather
than whatever it had before.

Here is an example of the current behaviour (before my patch):

[Cathy_at_localhost subversion]$ ls -la INSTALL
-rw-rw-r--. 1 Cathy Cathy 63057 Nov 20 17:34 INSTALL
[Cathy_at_localhost subversion]$ ./svn patch patch.diff
U INSTALL
[Cathy_at_localhost subversion]$ ls -la INSTALL
-rw-------. 1 Cathy Cathy 63070 Nov 20 17:58 INSTALL

Notice that applying the patch has changed the permissions of INSTALL.

After my patch, we instead get the following:

[Cathy_at_localhost subversion]$ ls -la INSTALL
-rw-rw-r--. 1 Cathy Cathy 63057 Nov 20 17:59 INSTALL
[Cathy_at_localhost subversion]$ ./svn patch patch.diff
U INSTALL
[Cathy_at_localhost subversion]$ ls -la INSTALL
-rw-rw-r--. 1 Cathy Cathy 63070 Nov 20 17:59 INSTALL

As expected, patching the file no longer alters its permissions.

I have attached my patch to this email and it includes a log message.

Regards,

Cathy

Received on 2013-11-21 06:58:40 CET

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