Perl / perl5

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

another bug in File::Find::find #1384

Closed p5pRT closed 20 years ago

p5pRT commented 24 years ago

Migrated from rt.perl.org#2464 (status was 'resolved')

Searchable as RT2464$

p5pRT commented 24 years ago

From dcd@tc.fluke.com

Created by dcd@tc.fluke.com

mkdir /tmp/f2p cd /tmp/f2p touch a b find a b -print

# prints a b # as expected

find2perl a b -print > f2p.out perl f2p.out

prints ./ ./ # not expected!

# same thing happens with File​::Find perl -MFile​::Find -wle 'find sub { print $File​::Find​::name }\, qw(a b)' ./ ./

perl 5.004_03 didn't have this problem

Perl Info ``` Site configuration information for perl v5.6.0: Configured by dcd at Tue Mar 14 23:18:10 PST 2000. Summary of my perl5 (revision 5.0 version 6 subversion 0) configuration: Platform: osname=linux, osvers=2.3.99-pre1, archname=i686-linux uname='linux dd 2.3.99-pre1 #1 tue mar 14 22:12:45 pst 2000 i686 ' config_args='-Doptimize=-O3 -g -de -Dcf_email=dcd@tc.fluke.com' 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='-O3 -g', gccversion=2.7.2.3 cppflags='-DDEBUGGING -I/usr/local/include' ccflags ='-DDEBUGGING -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64' stdchar='char', d_stdstdio=define, usevfork=false intsize=4, longsize=4, ptrsize=4, doublesize=8 d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=12 ivtype='long', ivsize=4, nvtype='double', nvsize=8, Off_t='off_t', lseeksize=4 alignbytes=4, usemymalloc=n, prototype=define Linker and Libraries: ld='cc', ldflags =' -L/usr/local/lib' libpth=/usr/local/lib /lib /usr/lib libs=-lgdbm -ldbm -ldb -ldl -lm -lc libc=/lib/libc.so.5.4.44, so=so, useshrplib=false, libperl=libperl.a Dynamic Linking: dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags='-rdynamic' cccdlflags='-fpic', lddlflags='-shared -L/usr/local/lib' Locally applied patches: v5.6.0-RC2 @INC for perl v5.6.0: /usr/local/lib/perl5/5.6.0/i686-linux /usr/local/lib/perl5/5.6.0 /usr/local/lib/perl5/site_perl/5.6.0/i686-linux /usr/local/lib/perl5/site_perl/5.6.0 /usr/local/lib/perl5/site_perl . Environment for perl v5.6.0: HOME=/home/dcd LANG (unset) LANGUAGE (unset) LD_LIBRARY_PATH (unset) LOGDIR (unset) PATH=/home/dcd/bin:/sbin:/usr/local/bin:/bin:/usr/bin:/usr/X11/bin:/usr/games:/usr/local/samba:/home/hobbes/tools/scripts:/home/hobbes/tools/linux:/usr0/hobbes/tools/scripts:/usr0/dcd/bin:/apps/general/bin:/usr/public PERL_BADLANG (unset) SHELL=/bin/bash ```
p5pRT commented 24 years ago

From [Unknown Contact. See original ticket]

David Dyck (lists.p5p)​:

find2perl a b -print > f2p.out perl f2p.out

prints ./ ./ # not expected!

perl -MFile​::Find -wle 'find sub { print $File​::Find​::name }\, qw(a b)' ./ ./

I'd expect the second one;   C\<$File​::Find​::name> contains the complete pathname to the file.

However\, since it breaks find2perl\, I'd imagine that this isn't what's desired. The following patch satisfies your expectations\, although I'm not sure it's what was originally envisaged.

Inline Patch ```diff --- lib/File/Find.pm~ Sun Mar 19 17:29:50 2000 +++ lib/File/Find.pm Sun Mar 19 17:30:19 2000 @@ -371,7 +371,7 @@ next Proc_Top_Item; } - $name = $abs_dir; + $name = $abs_dir.$_; &$wanted_callback; -- ```

"If I ever get around to writing that language depompisifier\, it will change almost all occurences of the word "paradigm" into "example" or "model." -- Herbie Blashtfalt