On Mon, Jun 09, 2008 at 03:34:23PM +0200, Aristotle Pagaltzis wrote: > * Craig A. Berry <craig.a.berry@gmail.com> [2008-06-09 15:05]: > > Before Abigail's patch, the Unix copy() did roughly what the > > VMS and Win32 syscopy() implementations do: it followed "new > > file" semantics and created the target file with permissions > > inherited from the target environment. > > Except, there is no such thing as permissions inherited from the > target environment on Unix. Maybe you could consider the exec > bits on the directories that are part of a file’s path some kind > of permission inheritance, but even that is a bit of a stretch. Well, one could argue that the umask is "permissions inherited from the target environment". And that is what still happens after my patch as well. The difference is that before my patch, the permissions of the new file *only* depend on umask, it's 0666 & ~umask. After my patch, it uses the permissions bits of the source file itstead of 0666, but still masks them with ~umask. My hope was that there were no effects at all for environments that don't have permissions bits, but I've no non-Unix environment to test that, nor any significant experience on non-Unix platforms to make any predictions, nor was perlport of any help of predicting the behaviour on non-Unix systems. (My thought was, if the platform doesn't have permissions, it doesn't really matter what the third argument of sysopen is). > > I don't like the fact that copying from a handle now gives > > different behavior permissions-wise than copying from a > > filename, but that inconsistency could be ironed out pretty > > easily. I am surprised about this. My patch takes the permissions bit from the file handle (either the one passed to copy, or the one after opening the source file), and there are tests that check whether the permission bits are set correctly when copying from a file handle. > I always argued that the code to preserve permissions should go > into `syscopy` on Unix, not `copy`. > > If, as Charles seems to have been suggesting, `cp` was aliased > depending on platform to *either* `copy` *or* `syscopy` such that > it emulated the platform copy program, that would be ideal. > > Then people could explicitly ask for either behaviour when they > mean it, or could use the DWIM alias (which is also shortest to > type) when upgrading scripts from sh/CMD.EXE/DCL/whatever. AbigailThread Previous | Thread Next