Skip Menu |

This queue is for tickets about the IO-LockedFile CPAN distribution.

Report information
The Basics
Id: 2313
Status: open
Priority: 0/
Queue: IO-LockedFile

People
Owner: Nobody in particular
Requestors: djberge [...] qwest.com
Cc:
AdminCc:

Bug Information
Severity: Normal
Broken in: (no value)
Fixed in: (no value)



Subject: make test failure on solaris 9
Solaris 9 Perl 5.8 IO::LockedFile .23 It appears that there are problems beginning at test 6: Show quoted text
>make test
PERL_DL_NONLAZY=1 /usr/local/bin/perl "-Iblib/lib" "-Iblib/arch" test.pl 1..13 ok 1 ok 2 the file is locked exclussivly, so we could not open it to write ok 3 the file is locked exclussivly, so we could not open it to read ok 4 the file has a shared lock, so we could not open it to write ok 5 the file has a shared lock, so we could open it to read Uncaught exception from user code: Cannot lock: Bad file number at test.pl line 67 IO::LockedFile::Flock::lock('IO::LockedFile::Flock=GLOB(0x12277c)') called at blib/lib/IO/LockedFile.pm line 95 IO::LockedFile::open('IO::LockedFile::Flock=GLOB(0x12277c)','/home/djberge/local/modules/perl/IO-LockedFile-0.23/locked1.txt',768) called at blib/lib/IO/LockedFile.pm line 52 IO::LockedFile::new('IO::LockedFile','/home/djberge/local/modules/perl/IO-LockedFile-0.23/locked1.txt',768) called at test.pl line 67 make: *** [test_dynamic] Error 255
From: todd.e.rinaldo [...] jpmorgan.com
We're getting the same error on solaris 2.8. Considering this is a part of the core Catalyst, It'd be nice to get it working. Any ideas?
Subject: Re: [rt.cpan.org #2313] make test failure on solaris 9
Date: Sat, 13 Oct 2007 15:57:37 +0200
To: bug-IO-LockedFile [...] rt.cpan.org
From: Rani Pinchuk <rani [...] cpan.org>
I heard about problems with IO::LockedFile and Solaris in the past, and I thought those problems must be related to the way the lock works (or doesn't work) on this OS. I will be happy to try to debug this, but I have no solaris to debug it on. Do you know of any Solaris I could get SSH account for debugging this? Rani Todd E. Rinaldo via RT wrote: Show quoted text
> Queue: IO-LockedFile > Ticket <URL: http://rt.cpan.org/Ticket/Display.html?id=2313 > > > We're getting the same error on solaris 2.8. Considering this is a part > of the core Catalyst, It'd be nice to get it working. Any ideas? > >
On Sat Oct 13 09:58:15 2007, RANI wrote: Show quoted text
> I heard about problems with IO::LockedFile and Solaris in the past, and > I thought those problems must be related to the way the lock works (or > doesn't work) on this OS.
Solaris will only let you take a shared lock if you have the file open for reading, and only let you take an exclusive lock if you have it open for writing. Otherwise you get EBADF. Linux will happily let you do either. This should be a problem because IO::LockedFile::Flock::lock tries to obtain the right kind of lock for the file mode. The problem is actually further up, when file writability is determined. IO::LockedFile::open looks at the open flags and decides the file is writable if any of O_APPEND, O_CREATE or O_TRUNC are present. The problem is that these flags control file _creation_, but say nothing about writability. It should instead be looking for O_WRONLY or O_RDWR and setting writability based on that. The following patch fixes this problem and makes the tests run on Solaris. diff --git a/LockedFile.pm b/LockedFile.pm index 5d7f727..d547708 100644 --- a/LockedFile.pm +++ b/LockedFile.pm @@ -78,9 +78,8 @@ sub open { elsif ( $_[1] =~ /^\d+$/ ) { # Numeric mode require Fcntl; - $writable = ( ( $_[1] & O_APPEND ) || - ( $_[1] & O_CREAT ) || - ( $_[1] & O_TRUNC ) ); + $writable = ( ( $_[1] & O_WRONLY ) || + ( $_[1] & O_RDWR ) ); } else { # POSIX mode (we know there were enough parameters since our
Subject: flocktest
Download flocktest
application/octet-stream 268b

Message body not shown because it is not plain text.

Ignore the attachment. I figured out what was going on and started writing my comment again, but forgot that I'd already attached something :)