
steve.siano at yahoo
May 8, 2012, 11:12 AM
Views: 156
Permalink
|
|
Re: [perl #112760] mkdir in Perl 5.8.8 Fails to Set the Sticky Bit on FreeBSD 7.1
[In reply to]
|
|
Thanks Tony for tracking down the root cause and thanks Chris for confirming it. Since it is a BSD bug and not a Perl bug, I've updated my code accordingly: if (mkdir($dir, $mode)) { chomp(my $OS = `uname`); if ($OS eq 'FreeBSD' && $mode & 01000) { if (chmod($mode, $dir)) { Sincerely, Steve ----- Original Message ----- From: Kidney Bingos via RT <perlbug-followup [at] perl> To: steve.siano [at] yahoo Cc: Sent: Tuesday, May 8, 2012 2:34 AM Subject: Re: [perl #112760] mkdir in Perl 5.8.8 Fails to Set the Sticky Bit on FreeBSD 7.1 On Tue, May 08, 2012 at 09:37:50AM +1000, Tony Cook wrote: > On Fri, May 04, 2012 at 04:54:07PM -0700, steve.siano [at] yahoo (via RT) wrote: > > # New Ticket Created by steve.siano [at] yahoo > > # Please include the string: [perl #112760] > > # in the subject line of all future correspondence about this issue. > > # <URL: https://rt.perl.org:443/rt3/Ticket/Display.html?id=112760 > > > > > > > > > This is a bug report for perl from steve.siano [at] yahoo, > > generated with the help of perlbug 1.35 running under perl v5.8.8. > > > > The following does not set the sticky bit on FreeBSD, but it works on Linux: > > > > perl -e "umask 0000; mkdir('foo', 01777);" > > > > This behavior was observed on local disk and over NFS. > > > > However, chmod does set the sticky bit on FreeBSD and Linux: > > > > perl -e "umask 0000; chmod(01777, 'foo');" > > perl 5.8.8 is no longer supported. > > >From man 8 sticky on FreeBSD 8.2: > > BUGS > Neither open(2) nor mkdir(2) will create a file with the sticky bit set. > > This isn't a perl bug, I'm not sure it's worthwhile working around > this limitation on BSDs. > > mkdir -m 01775 foo > > on FreeBSD does set the sticky bit, but it also ignores umask. > I confirmed this on FreeBSD 7.4 with v5.8.9 and v5.14.0 Also behaves the same with v5.14.2 on FreeBSD 8.3 and 9.0 It also does on NetBSD 3.1 and 5.1.2 where man sticky says the same as on FreeBSD And the same on OpenBSD 5.1 which again says the same bug in man sticky. I haven't checked DragonflyBSD nor MirBSD, but the docs for DragonflyBSD suggest it is the same: http://leaf.dragonflybsd.org/cgi/web-man?command=sticky§ion=ANY Cheers, -- Chris Williams aka BinGOs PGP ID 0x4658671F http://www.gumbynet.org.uk ==========================
|