On Sat, Jul 07, 2001 at 10:48:14AM -0500, [EMAIL PROTECTED] wrote:
> #!/usr/bin/perl -w
> 
> use strict;
> 
> my $dir = "cody";
> mkdir("$dir",0770);
> 
> 
> i am running this in my home directory on a linux machine, so i have full
> rights. when i run this however, the permissions on the directory are:
> 
> drwxr-x---    2 cmenzes  cmenzes      1024 Jul  7 10:39 cody/
> 
> which translates to 0750. i am thinking that this limit may have to do
> with my shell umask setting which is at 022, but i am not certain why it
> is taking precedence over the perl setting. if i change my second argument
> in my mkdir statement to 0660 or 0444, the proper permissions are set. the
> only pattern that i see is that i *can* explicitly set the permissions in
> a mkdir statement if they are more restrictive than my umask. otherwise
> the perms default to my umask.
> i know i can get past this by following the mkdir statement with a chmod,
> but i just wanted to verify that my logic on this one is correct.

The second parameter to mkdir is just a mask, it's not the permission
settings for the new directory.  See perldoc -f mkdir for more
information.

Walt

Reply via email to