Front page | perl.perl5.porters |
Postings from February 2003
[perl #21031] $File::Find::name ne $_ w/no_chdir
Thread Next
From:
Anders Johnson
Date:
February 17, 2003 05:14
Subject:
[perl #21031] $File::Find::name ne $_ w/no_chdir
Message ID:
rt-21031-51306.12.8541374577158@bugs6.perl.org
# New Ticket Created by "Anders Johnson"
# Please include the string: [perl #21031]
# in the subject line of all future correspondence about this issue.
# <URL: http://rt.perl.org/rt2/Ticket/Display.html?id=21031 >
There is a case in which $File::Find::name ne $_ inside $wanted_callback
with $no_chdir in effect. This contradicts the documentation.
Here is the patch:
diff -Naur perl-5.8.0/lib/File/Find.pm perl-5.8.0-find1/lib/File/Find.pm
--- perl-5.8.0/lib/File/Find.pm Sat Jun 1 10:03:17 2002
+++ perl-5.8.0-find1/lib/File/Find.pm Fri Feb 14 15:37:54 2003
@@ -700,6 +700,7 @@
}
$name = $abs_dir . $_; # $File::Find::name
+ $_ = $name if $no_chdir;
{ $wanted_callback->() }; # protect against wild "next"
Here is the test case:
use File::Find;
use File::Spec;
mkdir('d');
my $f=File::Spec->catpath("", 'd', 'f');
open(OUT, '>', $f);
close(OUT);
find({
wanted=>sub { die unless $_ eq $File::Find::name },
no_chdir=>1
},
$f
);
Here is the output of "perlbug -d":
---
Flags:
category=
severity=
---
Site configuration information for perl v5.8.0:
Configured by anders at Fri Nov 15 12:33:55 PST 2002.
Summary of my perl5 (revision 5.0 version 8 subversion 0) configuration:
Platform:
osname=linux, osvers=2.4.18, archname=i686-linux
uname='linux wolf12 2.4.18 #1 mon jul 8 14:56:03 pdt 2002 i686
unknown '
config_args='-de'
hint=recommended, useposix=true, d_sigaction=define
usethreads=undef use5005threads=undef useithreads=undef
usemultiplicity=undef
useperlio=define d_sfio=undef uselargefiles=define usesocks=undef
use64bitint=undef use64bitall=undef uselongdouble=undef
usemymalloc=n, bincompat5005=undef
Compiler:
cc='cc', ccflags ='-fno-strict-aliasing -I/usr/local/include
-D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -I/usr/include/gdbm',
optimize='-O2',
cppflags='-fno-strict-aliasing -I/usr/local/include
-I/usr/include/gdbm'
ccversion='', gccversion='2.96 20000731 (Red Hat Linux 7.1
2.96-98)', gccosandvers=''
intsize=4, longsize=4, ptrsize=4, doublesize=8, byteorder=1234
d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=12
ivtype='long', ivsize=4, nvtype='double', nvsize=8, Off_t='off_t',
lseeksize=8
alignbytes=4, prototype=define
Linker and Libraries:
ld='cc', ldflags =' -L/usr/local/lib'
libpth=/usr/local/lib /lib /usr/lib
libs=-lnsl -lndbm -lgdbm -ldl -lm -lc -lcrypt -lutil
perllibs=-lnsl -ldl -lm -lc -lcrypt -lutil
libc=/lib/libc-2.2.4.so, so=so, useshrplib=false, libperl=libperl.a
gnulibc_version='2.2.4'
Dynamic Linking:
dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags='-rdynamic'
cccdlflags='-fpic', lddlflags='-shared -L/usr/local/lib'
Locally applied patches:
---
@INC for perl v5.8.0:
/tools/By-Install/perl/5.8.0/i686-linux2.4/1/lib/5.8.0/i686-linux
/tools/By-Install/perl/5.8.0/i686-linux2.4/1/lib/5.8.0
/tools/By-Install/cpan/living/i686-linux2.4/1/lib/cpan/i686-linux
/tools/By-Install/cpan/living/i686-linux2.4/1/lib/cpan
/tools/By-Install/cpan/living/i686-linux2.4/1/lib/cpan
.
---
Environment for perl v5.8.0:
HOME=/home1/anders
LANG=en_US
LANGUAGE (unset)
LD_LIBRARY_PATH=/opt/cadence/linux/ldv-3.4/tools/lib:/opt/cadence/linux/
ldv-3.4/tools/inca/lib:/usr/local/lib
LOGDIR (unset)
PATH=/home1/anders/bin:/tools/bin:/opt/cadence/linux/ldv-3.4/tools/bin:/
opt/cadence/linux/ldv-3.4/tools/inca/bin:/opt/synopsys/linux/vcs/bin:/op
t/synopsys/linux/vcs/virsimdir/bin:/usr/local/vnc:/opt/synopsys/linux/sc
l/linux/bin:/usr/local/bin:/bin:/usr/bin:/usr/X11R6/bin:.
PERLDOC_PAGER=less -Cr
PERL_BADLANG (unset)
SHELL=/bin/csh
Thread Next
-
[perl #21031] $File::Find::name ne $_ w/no_chdir
by Anders Johnson