[Unison-hackers] Need fix for chmod problem

Dale R. Worley dworley at pingtel.com
Wed Oct 5 09:50:42 EDT 2005


On Wed, 2005-10-05 at 14:43 +0200, Jerome Vouillon wrote:
> This is a tricky issue.

Oh, yes.

> First, when Unison propagates a file content modification, one
> probably want to preserve as much as possible the permissions of the
> previous version of the file (which is being overwritten by Unison),
> even when not all permission bits are synchronized.  [Etc.]

There are other cases as well, including the one I am stuck with.
Namely, where the "permissions" as seen by the Posix interface are
partly or largely fabricated, and chomd() is partly or largely
ineffective, or as in my case, entirely forbidden.

IMHO, I think there should be a setting that would fill Unison with
despair, er, tell it to ignore permissions issues entirely, and leave
them to the underlying implementation to fake, on the grounds that the
implementation (which understands them) will do a better job of it than
Unison (which doesn't understand them).

(Note that "times = false" has this sort of effect on modification
times.)

It seems to me that "perms = 0" is the obvious candidate for this
workaround, although your argument suggests that the case "real Posix
with perms = 0" is not quite the same thing as "don't fiddle with
permissions issues".

> Thus, I think the right fix is to change, in file fileinfo.ml, in
> function set, the following piece of code:
> 
>       `Set defDesc ->
>         (* Set the permissions and maybe the other properties                *)
>         `Set, Props.override defDesc newDesc
> 
> into:
> 
>       `Set defDesc ->
>         (* Set the permissions and maybe the other properties                *)
>         `Set, Props.override (get false fspath path).desc newDesc

This may well be good, but given the comment on defDesc, I can assure
you that it will cause an error 100% of the time it is called.

> Dale, could you try this change?  Thanks a lot for your mail.  This
> was a good opportunity for me to think about this issue.

Well, I wouldn't even know how to start building it.  But there's no
reason to test it -- if you can assure me that "perms = 0" will prevent
chmod from ever being called (on a target file/directory), then it will
work, and otherwise it will fail.

Dale




More information about the Unison-hackers mailing list