Re: File protection on create

[email protected] ("Craig A. Berry") Fri, 16 Jul 2010 18:43:20 -0500
Newsgroups perl.vmsperl
Message-ID <[email protected]>
On Jul 10, 2010, at 2:05 PM, Mark Berryman wrote:

> Is the following expected behavior?
>
> With normal default protections set:
>
> $ say := write sys$output
> $ say f$env("protection")
> SYSTEM=RWED, OWNER=RWED, GROUP=RE, WORLD
> $ perl -e "open(F,'>1.1'); print F 1; close F;"
> $ dir/sec 1.1
>
> Directory USERS:[BERRYMAN]
>
> 1.1;1                [BERRYMAN]                       (RWD,RWD,R,)
>
> However, change the owner default to read-only and:
>
> $ set prot=ow:re/def
> $ say f$env("protection")
> SYSTEM=RWED, OWNER=RE, GROUP=RE, WORLD
> $ perl -e "open(F,'>1.1'); print F 1; close F;"
> $ dir/sec 1.1
>
> Directory USERS:[BERRYMAN]
>
> 1.1;1                [BERRYMAN]                       (R,R,R,)
>
> Why is the file being created with system only having Read access  
> when the owner default is set to read?
>

Good question.  And the other weird thing is it gives you only read  
protection when you asked for execute as well.  I have a feeling that  
it's line 2601 of perlio.c, but I need to read up and remind myself  
how Unix protection masks interact with VMS default protections.  The  
current perlio.c is at:

<http://perl5.git.perl.org/perl.git/blob/HEAD:/perlio.c>

and the lines I'm suspecting look like:

2600             imode = PerlIOUnix_oflags(mode);
2601             perm = 0666;

Should that be 0777 or something in order to assume VMS defaults?

________________________________________
Craig A. Berry
mailto:[email protected]

"... getting out of a sonnet is much more
  difficult than getting in."
                  Brad Leithauser