Hi Alceu, please reply to all recipients. See: http://shlom.in/reply .
On Wed, 16 Sep 2015 02:14:27 -0300 Alceu Rodrigues de Freitas Junior <glasswal...@yahoo.com.br> wrote: > Hello there, > > My distribution Siebel::Srvrmgr tests are always failing with Solaris OS > due error of "Bad file number" when trying to use flock() to get a lock > on a file under a temporary directory created with Test::TempDir::Tiny. > Here is an example: > > http://www.cpantesters.org/cpan/report/b6494902-43a3-11e5-a85a-e28fcaadd3a7 > This link is currently down. > Doing some research about the issue, I found this post on Perlmonks: > > http://www.perlmonks.org/bare/?node_id=289198 > > It seems I need to open the file for writing (that I need just to read) > to be able to get a exclusive lock. That's the current piece of code > that should take care of it: > > if ( -e $lock_file ) { > > open( my $in, '<', $lock_file ) > or $logger->logdie("Cannot read $lock_file: $!"); > flock( $in, LOCK_EX | LOCK_NB ) > or $logger->logdie("Could not get exclusive lock on > $lock_file: $!"); > local $/ = undef; > my $pid = <$in>; > close($in); > > $logger->logdie( > "Previous executing is still running (PID $pid), cannot > execute") > if ( $pid != $$ ); > > } > > Can someone please confirm this behaviour? Unfortunately I don't have a > Solaris OS hanging around for me to test it. :-) > I suppose I can try setting up a Solaris x86 (or OpenSolaris or whatever) VBox VM and testing it there. But I need some help from you: What are we supposed to do with this code? It's not self-contained. Can you provide a self-contained, reproducing, example, on a branch of a public version control system (which I hope you are using for everybody's sake, else see http://perl-begin.org/tutorials/bad-elements/ ), with instructions on what exactly should we run? Otherwise, your instructions will remain unclear. Regards, Shlomi Fish > Thank you, > > Alceu -- ----------------------------------------------------------------- Shlomi Fish http://www.shlomifish.org/ Selina Mandrake - The Slayer (Buffy parody) - http://shlom.in/selina Oh! I wish you could see the look on his face! Actually, I would have also liked to see the look on his face, but just then I woke up from the dream. — http://www.shlomifish.org/humour/TheEnemy/ Please reply to list if it's a mailing list post - http://shlom.in/reply .