[Unison-hackers] [unison-svn] r313 - in trunk/src: . ubase

Benjamin C. Pierce bcpierce at seas.upenn.edu
Sun Nov 30 22:57:58 EST 2008


Author: bcpierce
Date: 2008-11-30 22:57:57 -0500 (Sun, 30 Nov 2008)
New Revision: 313

Modified:
   trunk/src/RECENTNEWS
   trunk/src/TODO.txt
   trunk/src/fileinfo.ml
   trunk/src/mkProjectInfo.ml
   trunk/src/props.ml
   trunk/src/ubase/prefs.ml
Log:
* Fixed a bug that was causing new files to be created with
  permissions 0x600 instead of using a reasonable default (like
  0x644), if the 'perms' flag was set to 0.  (Bug reported by Ben
  Crowell.)

* Added a new preference, 'dontchmod'.  By default, Unison uses the
  'chmod' system call to set the permission bits of files after it has
  copied them.  But in some circumstances (and under some operating
  systems), the chmod call always fails.  Setting this preference
  completely prevents Unison from ever calling chmod.

* Add some suggestions to TODO file







Modified: trunk/src/RECENTNEWS
===================================================================
--- trunk/src/RECENTNEWS	2008-11-11 13:13:29 UTC (rev 312)
+++ trunk/src/RECENTNEWS	2008-12-01 03:57:57 UTC (rev 313)
@@ -1,3 +1,24 @@
+CHANGES FROM VERSION 2.31.11
+
+* Fixed a bug that was causing new files to be created with
+  permissions 0x600 instead of using a reasonable default (like
+  0x644), if the 'perms' flag was set to 0.  (Bug reported by Ben
+  Crowell.)
+
+* Added a new preference, 'dontchmod'.  By default, Unison uses the
+  'chmod' system call to set the permission bits of files after it has
+  copied them.  But in some circumstances (and under some operating
+  systems), the chmod call always fails.  Setting this preference
+  completely prevents Unison from ever calling chmod.
+
+* Add some suggestions to TODO file
+
+
+
+
+
+
+-------------------------------
 CHANGES FROM VERSION 2.31.10
 
 * Another slight tweak.

Modified: trunk/src/TODO.txt
===================================================================
--- trunk/src/TODO.txt	2008-11-11 13:13:29 UTC (rev 312)
+++ trunk/src/TODO.txt	2008-12-01 03:57:57 UTC (rev 313)
@@ -8,8 +8,8 @@
 
 ###########################################################################
         
-CURRENT
-=======
+* CURRENT
+* =======
 
 * Merge issues:
      - It would be better to ignore the exit status of the external merge
@@ -62,8 +62,8 @@
 
 ###########################################################################
 
-SOON
-====
+* SOON
+* ====
 
 **** Document: root, fspath, path (local/not)
 
@@ -182,8 +182,8 @@
 ** Peter Selinger has built an SHA256 implementation that should be usable
    as a drop-in replacement for MD5, if we ever need to do that
 
-BUILDING AND INSTALLING
-=======================
+* BUILDING AND INSTALLING
+* =======================
 
 ** 'make install' could be improved (and documented)
    1. Typing "make install' after a "make" should simply install the 
@@ -200,8 +200,8 @@
 should strip symbols from binary files in 'make exportnative'
 
 
-DOCUMENTATION
-=============
+* DOCUMENTATION
+* =============
 
 ** Put a little more order on the flags and preferences -- e.g.,
     organize them into "basic preferences", "advanced preferences,"
@@ -237,8 +237,8 @@
    ===> Try it and see.
 
 
-SMALL FUNCTIONALITY IMPROVEMENTS
-================================
+* SMALL FUNCTIONALITY IMPROVEMENTS
+* ================================
 
 **** The archive should indicate whether it is case-dependant or not.
      (This is important for correctness -- if the case-insensitive flag is
@@ -248,6 +248,12 @@
      to avoid problems with huge files
      DONE
 
+*** [Marcus Sundman, 2008] Unison can't propagate changes in read-only
+    folders. The correct way to do it is to temporarily add write
+    permissions for the user to the folder, then do the changes and then
+    reset the permissions. Now unison tries to just do the changes, which
+    fails with a "permission denied" error.
+
 *** [Adrian Stephens, 2007] I would like the scope of rootalias to be
     expanded so that any command that expects a root will perform aliasing
     on the command.  In my application, I need to change the root statement
@@ -693,8 +699,8 @@
   Make sure you pay attention to the compile line as it is important.
 
 
-USER INTERFACE
-==============
+* USER INTERFACE
+* ==============
 
 ** In menu Actions
     - show Diff applies to the current line, while
@@ -958,8 +964,8 @@
   changes.  
 
 
-TIDYING
-=======
+* TIDYING
+* =======
 
 * Go through the sources and make all fatal and transient error messages
   as informative as possible 
@@ -975,8 +981,8 @@
   Unison sources and see if it reveals any problems.
 
 
-LARGER EXTENSIONS
-=================
+* LARGER EXTENSIONS
+* =================
 
 Fast update checking would be cool... Some resources:
    FAM (used in Enlightenment) 
@@ -1034,8 +1040,8 @@
   paranoid.) 
 
 
-WINDOWS ISSUES
-==============
+* WINDOWS ISSUES
+* ==============
 
 Suggestion from Arnaud:
   I have been using XP for a while and despite all the problems I have, there
@@ -1077,3 +1083,7 @@
     provided on FAT file systems) and the new way is the more Unix like way
     (added for NTFS file systems). The new way has rwxdpo bits for each
     group (and there can be several groups).
+
+Local Variables: 
+mode: outline
+End: 

Modified: trunk/src/fileinfo.ml
===================================================================
--- trunk/src/fileinfo.ml	2008-11-11 13:13:29 UTC (rev 312)
+++ trunk/src/fileinfo.ml	2008-12-01 03:57:57 UTC (rev 313)
@@ -74,6 +74,12 @@
     match action with
       `Set defDesc ->
         (* Set the permissions and maybe the other properties                *)
+        (* BCP [Nov 2008]: Jerome, in a message to unison-hackers on
+           Oct 5, 2005, suggested that this would be better as
+              `Set, Props.override (get false fspath path).desc newDesc
+           but this does not seem right to me (bcp): if the file was just
+           created, then its permissions are something like 0x600, whereas
+           the default permissions will set the world read bit, etc. *)
         `Set, Props.override defDesc newDesc
     | `Copy oldPath ->
         (* Set the permissions (using the permissions of the file at         *)

Modified: trunk/src/mkProjectInfo.ml
===================================================================
--- trunk/src/mkProjectInfo.ml	2008-11-11 13:13:29 UTC (rev 312)
+++ trunk/src/mkProjectInfo.ml	2008-12-01 03:57:57 UTC (rev 313)
@@ -97,3 +97,4 @@
 
 
 
+

Modified: trunk/src/props.ml
===================================================================
--- trunk/src/props.ml	2008-11-11 13:13:29 UTC (rev 312)
+++ trunk/src/props.ml	2008-12-01 03:57:57 UTC (rev 313)
@@ -73,6 +73,9 @@
 let (fileDefault, dirDefault, fileSafe, dirSafe) =
   match Util.osType with
     `Win32 ->
+      debug
+        (fun() ->
+           Util.msg "Using windows defaults for file permissions");
       ((0o600, -1), (* rw------- *)
        (0o700, -1), (* rwx------ *)
        (0o600, -1), (* rw------- *)
@@ -162,8 +165,22 @@
      bit 0o0002 "?" "-" "w" ^
      bit 0o0001 "?" "-" "x"
 
+let dontChmod =
+  Prefs.createBool "dontchmod" 
+  false
+  "!When set, never use the chmod system call"
+  ("By default, Unison uses the 'chmod' system call to set the permission bits"
+  ^ " of files after it has copied them.  But in some circumstances (and under "
+  ^ " some operating systems), the chmod call always fails.  Setting this "
+  ^ " preference completely prevents Unison from ever calling chmod.")
+
 let set fspath path kind (fp, mask) =
-  if mask <> 0 then  (* BCP: removed "|| kind <> `Update"  10/2005 *)
+  (* BCP: removed "|| kind <> `Update" on 10/2005, but reinserted it on 11/2008.
+     I'd removed it to make Dale Worley happy -- he wanted a way to make sure that
+     Unison would never call chmod, and setting prefs to 0 seemed like a reasonable
+     way to do this.  But in fact it caused new files to be created with wrong prefs.
+   *)
+  if (mask <> 0 || kind = `Set) && (not (Prefs.read dontChmod)) then
     Util.convertUnixErrorsToTransient
     "setting permissions"
       (fun () ->

Modified: trunk/src/ubase/prefs.ml
===================================================================
--- trunk/src/ubase/prefs.ml	2008-11-11 13:13:29 UTC (rev 312)
+++ trunk/src/ubase/prefs.ml	2008-12-01 03:57:57 UTC (rev 313)
@@ -391,4 +391,3 @@
 let add name value = addLine (name ^ " = " ^ value)
 
 let addComment c = ignore (addLine ("# " ^ c))
-



More information about the Unison-hackers mailing list