Skip Menu |
Report information
Id: 4806
Status: resolved
Priority: 0/
Queue: perl5

Owner: Nobody
Requestors: marek.rouchal [at] hl.siemens.de
Cc:
AdminCc:

Operating System: Solaris
PatchStatus: (no value)
Severity: medium
Type:
Perl Version: 5.6.0
Fixed In: (no value)



From: Marek Rouchal <marek.rouchal [...] hl.siemens.de>
Date: Thu, 30 Nov 2000 14:39:24 +0100 (MET)
To: perlbug [...] perl.com
Cc: perl [...] hl.siemens.de
Subject: File::Glob in 5.6.0
This is a bug report for perl from marek@hl.siemens.de, generated with the help of perlbug 1.28 running under perl v5.6.0. ----------------------------------------------------------------- I noticed that when the normal core glob() hits directories that are protected by Solaris ACLs it does not descend into those if the UNIX permission seem to forbid access and an ACL allows it. I tried to use File::Glob, but I encountered numerous problems: 1. This seems to work in a standalone script: (i.e., it shows all instances of the file foo.c, even if some of the */* directories are only executable with ACLs. use File::Glob; foreach(glob("/some/root/*/*/foo.c")) { ... } while the alternatives below access the old core glob, although the documentation of File::Glob tells a different story. use File::Glob qw(glob); use File::Glob qw(:glob); 2. Under unclear circumstances I get segmentation faults and "bad realloc ignored" messages from the doglob call in File::Glob. I believe they result from modifying $_ within the above foreach loop. Bug or my own fault? 3. When the "use File::Glob;" is in some Perl Module and not the main script, I couldn't get it to work properly. Hope this helps to track down the bug(s). I'll happily supply further details if needed. ----------------------------------------------------------------- --- Flags: category=core severity=medium --- This perlbug was built using Perl v5.6.0 - Fri Oct 27 14:02:10 MET DST 2000 It is being executed now by Perl v5.6.0 - Fri Oct 27 12:11:02 MET DST 2000. Site configuration information for perl v5.6.0: Configured by hwadm at Fri Oct 27 12:11:02 MET DST 2000. Summary of my perl5 (revision 5.0 version 6 subversion 0) configuration: Platform: osname=solaris, osvers=2.5.1, archname=sun4-solaris uname='sunos tamarix 5.5.1 generic_103640-34 sun4u sparc sunw,ultra-60 ' config_args='-Dprefix=/opt/perl_5.6.0a -Darchlib=/opt/perl_5.6.0a/lib -Dcf_email=perl@hl.siemens.de -Dinstallusrbinperl=undef -Dman1dir=/opt/perl_5.6.0a/share/man/man1 -Dman3dir=/opt/perl_5.6.0a/share/man/man3 -Dperladmin=perl@hl.siemens.de -Dprivlib=/opt/perl_5.6.0a/share/lib -Dscriptdir=/opt/perl_5.6.0a/share/bin -Dsitebin=/opt/perl_5.6.0a/bin -Dsitearch=/opt/perl_5.6.0a/lib/site_perl -Dsitelib=/opt/perl_5.6.0a/share/lib/site_perl -Dcc=cc -Doptimize=-xO5 -Dlocincpth=/home/hwadm/Perl/TWW/include -Dloclibpth=/home/hwadm/Perl/TWW/lib -Dusemymalloc=y -Uusethreads -Uusemultiplicity -Duseshrplib -des' hint=recommended, useposix=true, d_sigaction=define usethreads=undef use5005threads=undef useithreads=undef usemultiplicity=undef useperlio=undef d_sfio=undef uselargefiles=define use64bitint=undef use64bitall=undef uselongdouble=undef usesocks=undef Compiler: cc='cc', optimize='-xO5', gccversion= cppflags='-I/home/hwadm/Perl/TWW/include' ccflags ='-I/home/hwadm/Perl/TWW/include ' stdchar='unsigned char', d_stdstdio=define, usevfork=false intsize=4, longsize=4, ptrsize=4, doublesize=8 d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=16 ivtype='long', ivsize=4, nvtype='double', nvsize=8, Off_t='off_t', lseeksize=4 alignbytes=8, usemymalloc=y, prototype=define Linker and Libraries: ld='cc', ldflags =' -L/home/hwadm/Perl/TWW/lib ' libpth=/home/hwadm/Perl/TWW/lib /lib /usr/lib /usr/ccs/lib /usr/local/lib libs=-lsocket -lnsl -lgdbm -ldb -ldl -lm -lc -lcrypt -lsec libc=/lib/libc.so, so=so, useshrplib=true, libperl=libperl.so Dynamic Linking: dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags=' -R /opt/perl_5.6.0a/lib/CORE' cccdlflags='-KPIC', lddlflags='-G -L/home/hwadm/Perl/TWW/lib' Locally applied patches: --- @INC for perl v5.6.0: /view/marek.relman.development/home/relman/highway/vob/lib/perl /view/marek.relman.development/var/vob/relman/inway/vob/lib/perl /opt/perl_5.6.0a/lib /opt/perl_5.6.0a/share/lib /opt/perl_5.6.0a/lib/site_perl /opt/perl_5.6.0a/share/lib/site_perl /opt/perl_5.6.0a/share/lib/site_perl . --- Environment for perl v5.6.0: HOME=/home/marek LANG=C LANGUAGE (unset) LD_LIBRARY_PATH=/opt/cve2_3.60/lib:/home/relman/highway/vob/sparcOS5/lib:/view/marek.relman.development/home/relman/highway/vob/sparcOS5/lib:/view/marek.relman.development/var/vob/relman/inway/vob/sparcOS5/lib:/usr/openwin/lib:/usr/dt/lib:/usr/lib:/usr/local/lib LOGDIR (unset) PATH=/opt/cve2_3.60/bin:/opt/sniffp_3.2.1/bin:/opt/perl_5.6.0a/bin:/opt/frame_5.5.6/bin:/home/relman/highway/vob/bin:/home/relman/highway/vob/sparcOS5/bin:/view/marek.relman.development/home/relman/highway/vob/bin:/view/marek.relman.development/home/relman/highway/vob/sparcOS5/bin:/view/marek.relman.development/var/vob/relman/inway/vob/bin:/view/marek.relman.development/var/vob/relman/inway/vob/sparcOS5/bin:/usr/openwin/demo:/usr/atria/bin:/opt/tel_2.0/bin:/usr/dt/bin:/usr/openwin/bin:/bin:/usr/bin:/usr/contrib/bin:/home/marek/bin:/home/hwadm/bin:.:/opt/TWWfsw/bin:/usr/local/bin:/usr/ucb PERL5LIB=/view/marek.relman.development/home/relman/highway/vob/lib/perl:/view/marek.relman.development/var/vob/relman/inway/vob/lib/perl PERL_BADLANG (unset) SHELL=/bin/tcsh
Date: Tue, 9 Jan 2001 09:49:41 +0100 (MET)
From: Marek Rouchal DAT CAD HW Tel 25849 <marek.rouchal [...] hl.siemens.de>
To: perlbug [...] perl.org, gsar [...] activestate.com
Cc: Perl 5 Porters List <perl5-porters [...] perl.org>
Subject: followup to [ID 20001130.005] File::Glob in 5.6.0
Download (untitled) / with headers
text/plain 2.2k
Dear all, I was able to boil down the problem into a single script. I have the impression that if the (internal) Perl compiler sees an instance of the "glob" command *before* it encounters "use File::Glob;", then *subsequent* instances of the "glob" command use the internal implementation of glob instead of the one provided by File::Glob. Even worse, if I say "use File::Glob qw(:glob)" or the like, I get "Bad realloc ignored" or even segfaults. I feel this is an error, but maybe I'm wrong. By the way, the difference between the two glob()s I see is on Solaris when directories are protected by ACLs and seem unreadable from what stat() returns. The File::Glob implementation does the right thing here. I had the first reference to glob in an entirely different file and package baefore, which was "use"d before the "use File::Glob", with the same effects. It took quite a while to find the single glob "needle" in a multi-thousand-line-haystack of modules ;-) I saw this on perl-5.6.0 and 5.6.1-TRIAL1, compiled with Sun Workshop Pro 5.0 on Solaris 2.7 and 2.5.1 (Sparc). Hope this helps, Marek Here is the script: #!/opt/perl_5.6.1/bin/perl -w # This test script outputs a list of files that match the given path. # Problem: The list is incomplete, because the internal glob() is used # instead of the one provided by File::Glob, despite the "use File::Glob" # Background: The File::Glob implementation finds directories that are # read/execute-enabled by ACLs and seem unreadable from what # stat() returns. use strict; BEGIN { sub lala { # an early reference to glob, could be in an entirely different # package which is "use"d # comment it out and it works... glob('*'); } } # ...or put this in front of the BEGIN block use File::Glob; # the "use" below instead of the above gives a # Bad realloc() ignored at /opt/perl_5.6.1/lib/File/Glob.pm line 119. # #use File::Glob qw(:glob); # some of the directories matched by the *'s are protected by ACLs. # Although readable, the internal glob fails because it seems to look only # at what stat() returns, not whether the directory can be opendir'ed. The # File::Glob implementation does the right thing. my @list = glob("/opt/libq/*/*/init/flow.def"); foreach(@list) { print "+$_+\n"; }
Date: Tue, 9 Jan 2001 09:49:41 +0100 (MET)
From: Marek Rouchal DAT CAD HW Tel 25849 <marek.rouchal [...] hl.siemens.de>
To: perlbug [...] perl.org, gsar [...] activestate.com
Cc: Perl 5 Porters List <perl5-porters [...] perl.org>
Subject: followup to [ID 20001130.005] File::Glob in 5.6.0
Download (untitled) / with headers
text/plain 2.2k
Dear all, I was able to boil down the problem into a single script. I have the impression that if the (internal) Perl compiler sees an instance of the "glob" command *before* it encounters "use File::Glob;", then *subsequent* instances of the "glob" command use the internal implementation of glob instead of the one provided by File::Glob. Even worse, if I say "use File::Glob qw(:glob)" or the like, I get "Bad realloc ignored" or even segfaults. I feel this is an error, but maybe I'm wrong. By the way, the difference between the two glob()s I see is on Solaris when directories are protected by ACLs and seem unreadable from what stat() returns. The File::Glob implementation does the right thing here. I had the first reference to glob in an entirely different file and package baefore, which was "use"d before the "use File::Glob", with the same effects. It took quite a while to find the single glob "needle" in a multi-thousand-line-haystack of modules ;-) I saw this on perl-5.6.0 and 5.6.1-TRIAL1, compiled with Sun Workshop Pro 5.0 on Solaris 2.7 and 2.5.1 (Sparc). Hope this helps, Marek Here is the script: #!/opt/perl_5.6.1/bin/perl -w # This test script outputs a list of files that match the given path. # Problem: The list is incomplete, because the internal glob() is used # instead of the one provided by File::Glob, despite the "use File::Glob" # Background: The File::Glob implementation finds directories that are # read/execute-enabled by ACLs and seem unreadable from what # stat() returns. use strict; BEGIN { sub lala { # an early reference to glob, could be in an entirely different # package which is "use"d # comment it out and it works... glob('*'); } } # ...or put this in front of the BEGIN block use File::Glob; # the "use" below instead of the above gives a # Bad realloc() ignored at /opt/perl_5.6.1/lib/File/Glob.pm line 119. # #use File::Glob qw(:glob); # some of the directories matched by the *'s are protected by ACLs. # Although readable, the internal glob fails because it seems to look only # at what stat() returns, not whether the directory can be opendir'ed. The # File::Glob implementation does the right thing. my @list = glob("/opt/libq/*/*/init/flow.def"); foreach(@list) { print "+$_+\n"; }
Download (untitled) / with headers
text/plain 2.7k
On Mon Jan 08 16:49:57 2001, RT_System wrote: Show quoted text
> Dear all, > > I was able to boil down the problem into a single script. I have the > impression that if the (internal) Perl compiler sees an instance of the > "glob" command *before* it encounters "use File::Glob;", then *subsequent* > instances of the "glob" command use the internal implementation of glob > instead of the one provided by File::Glob. Even worse, if I say "use > File::Glob qw(:glob)" or the like, I get "Bad realloc ignored" or even > segfaults. I feel this is an error, but maybe I'm wrong. > > By the way, the difference between the two glob()s I see is on Solaris > when directories are protected by ACLs and seem unreadable from what > stat() returns. The File::Glob implementation does the right thing here. > > I had the first reference to glob in an entirely different file and > package baefore, which was "use"d before the "use File::Glob", with the > same effects. It took quite a while to find the single glob "needle" in a > multi-thousand-line-haystack of modules ;-) > > I saw this on perl-5.6.0 and 5.6.1-TRIAL1, compiled with Sun Workshop Pro > 5.0 on Solaris 2.7 and 2.5.1 (Sparc). > > Hope this helps, > > Marek > > Here is the script: > > #!/opt/perl_5.6.1/bin/perl -w > > # This test script outputs a list of files that match the given path. > # Problem: The list is incomplete, because the internal glob() is used > # instead of the one provided by File::Glob, despite the "use File::Glob" > # Background: The File::Glob implementation finds directories that are > # read/execute-enabled by ACLs and seem unreadable from what > # stat() returns. > > use strict; > > BEGIN { > sub lala > { > # an early reference to glob, could be in an entirely different > # package which is "use"d > # comment it out and it works... > glob('*'); > } > } > > # ...or put this in front of the BEGIN block > use File::Glob; > > # the "use" below instead of the above gives a > # Bad realloc() ignored at /opt/perl_5.6.1/lib/File/Glob.pm line 119. > # > #use File::Glob qw(:glob); > > # some of the directories matched by the *'s are protected by ACLs. > # Although readable, the internal glob fails because it seems to look only > # at what stat() returns, not whether the directory can be opendir'ed. The > # File::Glob implementation does the right thing. > my @list = glob("/opt/libq/*/*/init/flow.def"); > > foreach(@list) { > print "+$_+\n"; > }
The hooks for loading File::Glob when glob() is encountered were extremely fragile. A completely new mechanism is now in place for perl 5.15.5-to-be, which is much more fail-safe. As for the "Bad realloc ignored" error, I have no idea how to reproduce that. Much of the code has been practically rewritten, so I’m going to assume it’s fixed. -- Father Chrysostomos


This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

For issues related to this RT instance (aka "perlbug"), please contact perlbug-admin at perl.org