You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by st...@apache.org on 2013/10/30 10:33:55 UTC

svn commit: r1537018 - /subversion/trunk/subversion/libsvn_subr/io.c

Author: stsp
Date: Wed Oct 30 09:33:55 2013
New Revision: 1537018

URL: http://svn.apache.org/r1537018
Log:
Fix issue #4440, "Subversion sets permissions on files, when it shouldn't"

* subversion/libsvn_subr/io.c
  (io_set_file_perms): Set the user read/write bits to make a file read/write,
   instead of merging in the default bits from the current umask.
   Merging bits from the current umask is a bad idea if the file's
   permissions are more restrictive than the umask implies.

Reported by: Attila Nagy

Modified:
    subversion/trunk/subversion/libsvn_subr/io.c

Modified: subversion/trunk/subversion/libsvn_subr/io.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_subr/io.c?rev=1537018&r1=1537017&r2=1537018&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_subr/io.c (original)
+++ subversion/trunk/subversion/libsvn_subr/io.c Wed Oct 30 09:33:55 2013
@@ -1591,14 +1591,9 @@ io_set_file_perms(const char *path,
     {
       if (enable_write) /* Make read-write. */
         {
-          apr_file_t *fd;
-
-          /* Get the perms for the original file so we'll have any other bits
-           * that were already set (like the execute bits, for example). */
-          SVN_ERR(svn_io_file_open(&fd, path, APR_READ,
-                                   APR_OS_DEFAULT, pool));
-          SVN_ERR(merge_default_file_perms(fd, &perms_to_set, pool));
-          SVN_ERR(svn_io_file_close(fd, pool));
+          /* Tweak the owner bits only. The group/other bits aren't safe to
+           * touch because we may end up setting them in undesired ways. */
+          perms_to_set |= (APR_UREAD|APR_UWRITE);
         }
       else
         {