[Israel.pm] File permissions and File::Copy

Offer Kaye oferk at oren.co.il
Mon May 31 23:30:44 PDT 2004

> A feature of course... in Unix/Linux every process has a umask field
> that is inherited by its child processes. Whenever a file is created by
> a process, its initial permission is calculated by *binary substraction*
> of the umask value from the permissions asked by the application.
[... snip ...]
> Your latest code fragment is equivalent... good. It was nice
> if File::Copy had an *option* to this effect.

Ah, I see now. Still, at least the shell's "cp" subtracts the umask from the
source file's permissions. File::Copy, on the other hand, subtrackts the
umask from 0666 (since that is the way open works, as you pointed out).
Since this behaviour is different from "cp"'s behaviour, I would call this a
bug... at the very least, this behaviour should be documented, IMHO.

Offer Kaye

More information about the Perl mailing list