Perl / perl5

🐪 The Perl programming language
https://dev.perl.org/perl5/
Other
1.94k stars 554 forks source link

File::Glob fails to set error #9241

Open p5pRT opened 16 years ago

p5pRT commented 16 years ago

Migrated from rt.perl.org#51410 (status was 'stalled')

Searchable as RT51410$

p5pRT commented 16 years ago

From @nwc10

Created by @nwc10

Test 6 of ext/File/Glob/t/basic.t fails sometimes for me. It's a test that creates a directory which is unreadable\, then tries to glob it\, to make sure that the error gets returned.

It basically does this​:

$ ./perl -Ilib -MFile​::Glob=​:glob -wle 'mkdir "Pie"\, 0; my @​a = bsd_glob("Pie/*"\, GLOB_ERR); print GLOB_ERROR\, " >@​a\<"; rmdir "Pie"' 0 >\< $ ./perl -Ilib -MFile​::Glob=​:glob -wle 'mkdir "Pie"\, 0; my @​a = bsd_glob("Pie/*"\, GLOB_ERR); print GLOB_ERROR\, " >@​a\<"; rmdir "Pie"' 0 >\< $ ./perl -Ilib -MFile​::Glob=​:glob -wle 'mkdir "Pie"\, 0; my @​a = bsd_glob("Pie/*"\, GLOB_ERR); print GLOB_ERROR\, " >@​a\<"; rmdir "Pie"' -2 >\< $ ./perl -Ilib -MFile​::Glob=​:glob -wle 'mkdir "Pie"\, 0; my @​a = bsd_glob("Pie/*"\, GLOB_ERR); print GLOB_ERROR\, " >@​a\<"; rmdir "Pie"' -2 >\< $ ./perl -Ilib -MFile​::Glob=​:glob -wle 'mkdir "Pie"\, 0; my @​a = bsd_glob("Pie/*"\, GLOB_ERR); print GLOB_ERROR\, " >@​a\<"; rmdir "Pie"' -2 >\< $ ./perl -Ilib -MFile​::Glob=​:glob -wle 'mkdir "Pie"\, 0; my @​a = bsd_glob("Pie/*"\, GLOB_ERR); print GLOB_ERROR\, " >@​a\<"; rmdir "Pie"' -2 >\< $ ./perl -Ilib -MFile​::Glob=​:glob -wle 'mkdir "Pie"\, 0; my @​a = bsd_glob("Pie/*"\, GLOB_ERR); print GLOB_ERROR\, " >@​a\<"; rmdir "Pie"' -2 >\< $ ./perl -Ilib -MFile​::Glob=​:glob -wle 'mkdir "Pie"\, 0; my @​a = bsd_glob("Pie/*"\, GLOB_ERR); print GLOB_ERROR\, " >@​a\<"; rmdir "Pie"' -2 >\< $ ./perl -Ilib -MFile​::Glob=​:glob -wle 'mkdir "Pie"\, 0; my @​a = bsd_glob("Pie/*"\, GLOB_ERR); print GLOB_ERROR\, " >@​a\<"; rmdir "Pie"' 0 >\<

Um. Yes. Like that. Where -2 is what it expects\, and 0 (no error) is not.

So\, is this perl being buggy\, or a race condition in the filing system?

Surely if I create a directory\, I expect it to exist in the next syscall?

[And if it is OS X that is being buggy\, it's case sensitive journalled hfs. And bloody OS X 10.5 has no decent equivalent of strace/truss/ktrace\, so I can't trivially log the syscalls as non-root\, and then diff the output. That's one thing that 10.4 was better at]

I'm leaning towards bsd_glob.c being buggy (is it up to date?) as I wrote a C program to create\, fail to open and delete a directory\, all in a tight loop\, and it works just perfectly.

Nicholas Clark

Perl Info ``` Flags: category=library severity=low Site configuration information for perl 5.11.0: Configured by nick at Mon Mar 3 12:52:51 GMT 2008. Summary of my perl5 (revision 5 version 11 subversion 0) configuration: Platform: osname=darwin, osvers=9.2.0, archname=darwin-thread-multi-2level uname='darwin mouse-mill.moo 9.2.0 darwin kernel version 9.2.0: tue feb 5 16:13:22 pst 2008; root:xnu-1228.3.13~1release_i386 i386 ' config_args='-Dusedevel=y -Dcc=ccache gcc -Dld=gcc -Ubincompat5005 -Uinstallusrbinperl -Dcf_email=nick@ccl4.org -Dperladmin=nick@ccl4.org -Dinc_version_list= -Dinc_version_list_init=0 -Doptimize=-g -Dusethreads -Duse64bitall -Uusemymalloc -Duseperlio -Dprefix=~/Sandpit/snap5.11.x-33411 -Dinstallman1dir=none -Dinstallman3dir=none -Uuserelocatableinc -Umad -Ud_dosuid -de' hint=recommended, useposix=true, d_sigaction=define useithreads=define, usemultiplicity=define useperlio=define, d_sfio=undef, uselargefiles=define, usesocks=undef use64bitint=define, use64bitall=define, uselongdouble=undef usemymalloc=n, bincompat5005=undef Compiler: cc='ccache gcc', ccflags ='-fno-common -DPERL_DARWIN -no-cpp-precomp -arch x86_64 -DDEBUGGING -pipe -fstack-protector -I/opt/local/include', optimize='-g', cppflags='-no-cpp-precomp -arch x86_64 -fno-common -DPERL_DARWIN -no-cpp-precomp -arch x86_64 -DDEBUGGING -pipe -fstack-protector -I/opt/local/include' ccversion='', gccversion='4.0.1 (Apple Inc. build 5465)', gccosandvers='' intsize=4, longsize=8, ptrsize=8, doublesize=8, byteorder=12345678 d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=16 ivtype='long', ivsize=8, nvtype='double', nvsize=8, Off_t='off_t', lseeksize=8 alignbytes=8, prototype=define Linker and Libraries: ld='env MACOSX_DEPLOYMENT_TARGET=10.3 cc -arch x86_64', ldflags =' -arch x86_64 -fstack-protector -L/opt/local/lib' libpth=/opt/local/lib /usr/lib libs=-ldbm -ldl -lm -lutil -lc perllibs=-ldl -lm -lutil -lc libc=/usr/lib/libc.dylib, so=dylib, useshrplib=false, libperl=libperl.a gnulibc_version='' Dynamic Linking: dlsrc=dl_dlopen.xs, dlext=bundle, d_dlsymun=undef, ccdlflags=' ' cccdlflags=' ', lddlflags=' -bundle -undefined dynamic_lookup -L/opt/local/lib' Locally applied patches: DEVEL @INC for perl 5.11.0: lib /Users/nick/Sandpit/snap5.11.x-33411/lib/perl5/5.11.0/darwin-thread-multi-2level /Users/nick/Sandpit/snap5.11.x-33411/lib/perl5/5.11.0 /Users/nick/Sandpit/snap5.11.x-33411/lib/perl5/site_perl/5.11.0/darwin-thread-multi-2level /Users/nick/Sandpit/snap5.11.x-33411/lib/perl5/site_perl/5.11.0 . Environment for perl 5.11.0: DYLD_LIBRARY_PATH (unset) HOME=/Users/nick LANG=en_GB LANGUAGE (unset) LD_LIBRARY_PATH (unset) LOGDIR (unset) PATH=/opt/local/bin:/opt/local/sbin:/Users/nick/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/X11/bin:/usr/local/sbin:/sbin:/usr/sbin PERL_BADLANG (unset) SHELL=/bin/bash ```
p5pRT commented 16 years ago

From p5p@spam.wizbit.be

On Tue Mar 04 09​:15​:29 2008\, nicholas wrote​:

This is a bug report for perl from nick@​ccl4.org\, generated with the help of perlbug 1.36 running under perl 5.11.0.

----------------------------------------------------------------- [Please enter your report here]

Test 6 of ext/File/Glob/t/basic.t fails sometimes for me. It's a test that creates a directory which is unreadable\, then tries to glob it\, to make sure that the error gets returned.

It basically does this​:

$ ./perl -Ilib -MFile​::Glob=​:glob -wle 'mkdir "Pie"\, 0; my @​a = bsd_glob("Pie/*"\, GLOB_ERR); print GLOB_ERROR\, " >@​a\<"; rmdir "Pie"' 0 >\< $ ./perl -Ilib -MFile​::Glob=​:glob -wle 'mkdir "Pie"\, 0; my @​a = bsd_glob("Pie/*"\, GLOB_ERR); print GLOB_ERROR\, " >@​a\<"; rmdir "Pie"' 0 >\< $ ./perl -Ilib -MFile​::Glob=​:glob -wle 'mkdir "Pie"\, 0; my @​a = bsd_glob("Pie/*"\, GLOB_ERR); print GLOB_ERROR\, " >@​a\<"; rmdir "Pie"' -2 >\<

Would it be a good idea to expand the test to try it a number of times? (so that it can be picked up by the smoke reports if it\, occasionanly\, fails on other platforms)

Kind regards\,

Bram

p5pRT commented 16 years ago

The RT System itself - Status changed from 'new' to 'open'

p5pRT commented 14 years ago

From @cpansprout

On Sun Jun 29 02​:41​:54 2008\, animator wrote​:

On Tue Mar 04 09​:15​:29 2008\, nicholas wrote​:

This is a bug report for perl from nick@​ccl4.org\, generated with the help of perlbug 1.36 running under perl 5.11.0.

----------------------------------------------------------------- [Please enter your report here]

Test 6 of ext/File/Glob/t/basic.t fails sometimes for me. It's a test that creates a directory which is unreadable\, then tries to glob it\, to make sure that the error gets returned.

It basically does this​:

$ ./perl -Ilib -MFile​::Glob=​:glob -wle 'mkdir "Pie"\, 0; my @​a = bsd_glob("Pie/*"\, GLOB_ERR); print GLOB_ERROR\, " >@​a\<"; rmdir "Pie"' 0 >\< $ ./perl -Ilib -MFile​::Glob=​:glob -wle 'mkdir "Pie"\, 0; my @​a = bsd_glob("Pie/*"\, GLOB_ERR); print GLOB_ERROR\, " >@​a\<"; rmdir "Pie"' 0 >\< $ ./perl -Ilib -MFile​::Glob=​:glob -wle 'mkdir "Pie"\, 0; my @​a = bsd_glob("Pie/*"\, GLOB_ERR); print GLOB_ERROR\, " >@​a\<"; rmdir "Pie"' -2 >\<

I cannot reproduce this on Snow Leopard with 5.6.2\, 5.8.1-4\, 5.10.0-1\, 5.12.0 or 5.13.5.

Would it be a good idea to expand the test to try it a number of times? (so that it can be picked up by the smoke reports if it\, occasionanly\, fails on other platforms)

Has a test been added?

p5pRT commented 8 years ago

From @dcollinsn

It looks like no one but Nick has ever been able to reproduce this. Are you still seeing this on recent perls on Mac?

-- Respectfully\, Dan Collins

p5pRT commented 8 years ago

@dcollinsn - Status changed from 'open' to 'stalled'

jkeenan commented 4 years ago

From @nwc10

Created by @nwc10

Test 6 of ext/File/Glob/t/basic.t fails sometimes for me. It's a test that creates a directory which is unreadable, then tries to glob it, to make sure that the error gets returned.

It basically does this​:

$ ./perl -Ilib -MFile​::Glob=​:glob -wle 'mkdir "Pie", 0; my @​a = bsd_glob("Pie/*", GLOB_ERR); print GLOB_ERROR, " >@​a<"; rmdir "Pie"' 0 ><

[snip]

@nwc10 Nick, have you been able to reproduce this error since your original report?

Which test in the current ext/File-Glob/t/basic.t corresponds to the one that was failing for you twelve years ago?

Is the problem now moot since File::Glob::glob has been yanked as of 5.30?

$ ./perl -Ilib -MFile​::Glob=​:glob -wle 'mkdir "Pie", 0; my @​a = bsd_glob("Pie/", GLOB_ERR); print GLOB_ERROR, " >@​a<"; rmdir "Pie"' 0 >< $ ./perl -Ilib -MFile​::Glob=​:glob -wle 'mkdir "Pie", 0; my @​a = bsd_glob("Pie/", GLOB_ERR); print GLOB_ERROR, " >@​a<"; rmdir "Pie"' -2 >< $ ./perl -Ilib -MFile​::Glob=​:glob -wle 'mkdir "Pie", 0; my @​a = bsd_glob("Pie/", GLOB_ERR); print GLOB_ERROR, " >@​a<"; rmdir "Pie"' -2 >< $ ./perl -Ilib -MFile​::Glob=​:glob -wle 'mkdir "Pie", 0; my @​a = bsd_glob("Pie/", GLOB_ERR); print GLOB_ERROR, " >@​a<"; rmdir "Pie"' -2 >< $ ./perl -Ilib -MFile​::Glob=​:glob -wle 'mkdir "Pie", 0; my @​a = bsd_glob("Pie/", GLOB_ERR); print GLOB_ERROR, " >@​a<"; rmdir "Pie"' -2 >< $ ./perl -Ilib -MFile​::Glob=​:glob -wle 'mkdir "Pie", 0; my @​a = bsd_glob("Pie/", GLOB_ERR); print GLOB_ERROR, " >@​a<"; rmdir "Pie"' -2 >< $ ./perl -Ilib -MFile​::Glob=​:glob -wle 'mkdir "Pie", 0; my @​a = bsd_glob("Pie/", GLOB_ERR); print GLOB_ERROR, " >@​a<"; rmdir "Pie"' -2 >< $ ./perl -Ilib -MFile​::Glob=​:glob -wle 'mkdir "Pie", 0; my @​a = bsd_glob("Pie/", GLOB_ERR); print GLOB_ERROR, " >@​a<"; rmdir "Pie"' 0 ><

Um. Yes. Like that. Where -2 is what it expects, and 0 (no error) is not.

So, is this perl being buggy, or a race condition in the filing system?

Surely if I create a directory, I expect it to exist in the next syscall?

[And if it is OS X that is being buggy, it's case sensitive journalled hfs. And bloody OS X 10.5 has no decent equivalent of strace/truss/ktrace, so I can't trivially log the syscalls as non-root, and then diff the output. That's one thing that 10.4 was better at]

I'm leaning towards bsd_glob.c being buggy (is it up to date?) as I wrote a C program to create, fail to open and delete a directory, all in a tight loop, and it works just perfectly.

Thank you very much. Jim Keenan

kevinxie4c commented 3 years ago

I can reproduce this on CentOS Linux release 7.8.2003 (Core). I got some failed tests when I tried to build Perl5-32.1. When I run

./perl -Ilib -MFile::Glob=:glob -wle 'mkdir "pie", 0; my @a = bsd_glob("pie/*", GLOB_ERR); print GLOB_ERROR,"\n"; rmdir "pie"'

I got "0" all the time when the test expects a non-zero.

Best regards, Kevin