Being really pedantic, the files have different "permissions". I'm
sure that's what Mazak meant.

"Umask" is what is applied to the default permissions, to set the
actual permissions when a new file is created. It only relates to the
creation, not any subsequent states.

Not replicating the original file permissions on a copy would be a
huge security hole. Anybody could copy a root-read-only file, examine
the contents, modify them, and, if they had write access to the
directory, replace it with the updated one.

I'm sure I'm teaching the choir "Our Father, &c." with this, but just
in case it's not obvious..



On 2/11/15, Carl Mäsak <[email protected]> wrote:
> # New Ticket Created by  "Carl Mäsak"
> # Please include the string:  [perl #123800]
> # in the subject line of all future correspondence about this issue.
> # <URL: https://rt.perl.org/Ticket/Display.html?id=123800 >
>
>
> <lizmat> $ ls -ls big*
> <lizmat> 11724800 -rw-------  1 liz  macports  6003097600 Feb 11 19:08 big
> <lizmat> 11724800 -rw-r--r--  1 liz  macports  6003097600 Feb 11 19:11 big2
> <masak> by the way, is it intentional (or by spec) that those two
> files have different umasks?
> <lizmat> I guess the copy used a different umask
> <lizmat> $ umask
> <lizmat> 0022
> <lizmat> hmmm...
> <Juerd> imho copy should force the permissions to be the same,
> regardless of the umask
> <Juerd> (When chmod is permitted at all)
> <moritz> is that what GNU cp does?
> <Juerd> moritz: Yes:
> <Juerd> open("a", O_RDONLY)                     = 3
> <Juerd> fstat(3, {st_mode=S_IFREG|0400, st_size=0, ...}) = 0
> <Juerd> open("b", O_WRONLY|O_CREAT|O_EXCL, 0400) = 4
> <Juerd> 0400 is the mode
> <Juerd> And that changes if I delete b and chmod a and then do another
> "strace cp a b"
> <masak> ok, now I feel like submitting a rakudobug about &copy not
> setting the umask to the same, like GNU cp does.
> <lizmat> masak: please do, so it won't fall though the cracks
> * masak does
> <lizmat> I'm not sure at which level this should be fixed, though
> <lizmat> feels to me, MoarVM should be doing the right thing on open
>

Reply via email to