Well, it seems File::Path::make_path uses plain mkdir calls under the hood, which don't honor special bits.1 I.e., the following wouldn't work either
$ perl -e 'mkdir "foo", 02750' $ ls -ld foo drwxr-x--- 2 eliya eliya 4096 Apr 27 11:40 foo/
while chmod does
$ perl -e 'mkdir "foo", 0750; chmod 02750, "foo"' $ ls -ld foo drwxr-s--- 2 eliya eliya 4096 Apr 27 11:41 foo/
___
1 This is OS specific; it has nothing to do with Perl. Perl just passes through the mode value to the mkdir system call (see man 2 mkdir).
The command mkdir -pm2750 foo also has to apply a chmod after having used mkdir:
$ strace mkdir -pm2750 foo ... mkdir("foo", 02750) = 0 open("foo", O_RDONLY|O_NOCTTY|O_NONBLOCK|O_DIRECTORY|O_NOFOLLOW) = 3 fstat(3, {st_mode=S_IFDIR|0750, st_size=4096, ...}) = 0 fchmod(3, 02750) = 0 <--- ...
In reply to Re^3: File::Path and mode with sgid
by Eliya
in thread File::Path and mode with sgid
by Hena
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |