Re: File protection on create
[email protected] ("Craig A. Berry") Sat, 28 Aug 2010 16:14:44 -0500
| Newsgroups | perl.vmsperl |
|---|---|
| Message-ID | <[email protected]> |
On Aug 7, 2010, at 4:39 PM, Craig A. Berry wrote:
> On Jul 16, 2010, at 6:43 PM, Craig A. Berry wrote:
>
>>
>> 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?
>
>
> I did a bit more digging, and yes, I think the 0666 permissions on
> the open() call are where things go wrong.
> Luckily, I think the fix will be easy
There were no objections (or confirmations either, for that matter),
so the fix is now committed at:
<http://perl5.git.perl.org/perl.git/commitdiff/5e2ce0f3dcb618e7ce72180948b6c29c8b949a53
>
This will likely first appear in 5.14.0, which will likely come out in
Q2 of 2011.
________________________________________
Craig A. Berry
mailto:[email protected]
"... getting out of a sonnet is much more
difficult than getting in."
Brad Leithauser