Your message dated Thu, 13 Apr 2006 16:40:06 +0300
with message-id <[EMAIL PROTECTED]>
and subject line Bug#140668: perl: [5.6.1] Documentation for sysopen flags 
needs clarification
has caused the attached Bug report to be marked as done.

This means that you claim that the problem has been dealt with.
If this is not the case it is now your responsibility to reopen the
Bug report if necessary, and/or fix the problem forthwith.

(NB: If you are a system administrator and have no idea what I am
talking about this indicates a serious mail system misconfiguration
somewhere.  Please contact me immediately.)

Debian bug tracking system administrator
(administrator, Debian Bugs database)

--- Begin Message ---
Package: perl-doc
Version: 5.6.1-7
Severity: normal
File: /usr/share/man/man1/perlfunc.1.gz

Hi,

 first of all, yes, I know about POSIX::open.

 According perldoc -f sysopen:

               The possible values and flag bits of the MODE
               parameter are system-dependent; they are available
               via the standard module "Fcntl". [...]

               In many systems the "O_EXCL" flag is available for
               opening files in exclusive mode.  This is not
               locking: exclusiveness means here that if the file
               already exists, sysopen() fails.  The "O_EXCL"
               wins "O_TRUNC".

 Then:

 $ touch foo
 $ perl -MFcntl -e 'sysopen(FOO, "foo", O_TRUNC|O_EXCL|O_WRONLY) or die'

 should die, right?  It doesn't.  On the other hand:

 $ rm foo
 $ perl -MFcntl -e 'sysopen(FOO, "foo", O_TRUNC|O_EXCL|O_WRONLY) or die'
 Died at -e line 1.

 Ok, what's going on here:

 $ rm foo ; touch foo
 $ strace -e open perl -MFcntl -e 'sysopen(FOO, "foo", O_TRUNC|O_EXCL|O_WRONLY) 
or die'
 [...]
 open("foo", O_WRONLY|O_TRUNC|O_EXCL|O_LARGEFILE) = 3

 $ rm foo
 $ strace -e open perl -MFcntl -e 'sysopen(FOO, "foo", O_TRUNC|O_EXCL|O_WRONLY) 
or die'
 [...]
 open("foo", O_WRONLY|O_TRUNC|O_EXCL|O_LARGEFILE) = -1 ENOENT (No such file or 
directory)

 *blink*

 For reference:

 $ rm foo ; perl -MPOSIX -e '$fd = POSIX::open("foo", O_CREAT|O_EXCL|O_WRONLY, 
0644) or die'
 $ rm foo ; touch foo ; perl -MPOSIX -e '$fd = POSIX::open("foo", 
O_CREAT|O_EXCL|O_WRONLY, 0644) or die'
 Died at -e line 1.

 Which look like:
 
 open("foo", O_WRONLY|O_CREAT|O_EXCL|O_LARGEFILE, 0644) = 3

 and:

 open("foo", O_WRONLY|O_CREAT|O_EXCL|O_LARGEFILE, 0644) = -1 EEXIST (File 
exists)

 respectively.

-- System Information
Debian Release: 3.0
Architecture: i386
Kernel: Linux ysabell 2.4.18-xfs #1 Thu Mar 14 08:21:26 CET 2002 i686
Locale: LANG=C, LC_CTYPE=en_US

Versions of packages perl-doc depends on:
ii  perl                          5.6.1-7    Larry Wall's Practical Extraction 

-- 
Marcelo             | He'd never realized that, deep down inside, what he
[EMAIL PROTECTED] | really wanted to do was make things go splat.
                    |         -- (Terry Pratchett, Reaper Man)


--- End Message ---
--- Begin Message ---
Package: perl
Version: 5.8.7-2

On Mon, Apr 01, 2002 at 09:36:04AM +1000, Brendan O'Dea wrote:

> On Sun, Mar 31, 2002 at 03:56:56PM +0200, Marcelo E. Magallon wrote:
> >              already exists, sysopen() fails.  The "O_EXCL"
> >              wins "O_TRUNC".
> 
> This certainly is odd wording.  "wins" should perhaps be "overrides" or
> "takes precedence over".
> 
> > $ touch foo
> > $ perl -MFcntl -e 'sysopen(FOO, "foo", O_TRUNC|O_EXCL|O_WRONLY) or die'
> >
> > should die, right?  It doesn't.  On the other hand:
> >
> > $ rm foo
> > $ perl -MFcntl -e 'sysopen(FOO, "foo", O_TRUNC|O_EXCL|O_WRONLY) or die'
> > Died at -e line 1.
> 
> O_EXCL is meaningless without O_CREAT, see open(2).  The documentation
> could perhaps be clearer on this.  Try:

Hi,

these concerns were fixed in perl 5.8.5. I'm closing the bug accordingly
with permission from Brendan.

Cheers,
-- 
Niko Tyni       [EMAIL PROTECTED]

--- End Message ---

Reply via email to