Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

File::Find fails due to chdir() limit on win32 #10504

Open
p5pRT opened this issue Jul 22, 2010 · 4 comments
Open

File::Find fails due to chdir() limit on win32 #10504

p5pRT opened this issue Jul 22, 2010 · 4 comments

Comments

@p5pRT
Copy link

p5pRT commented Jul 22, 2010

Migrated from rt.perl.org#76652 (status was 'open')

Searchable as RT76652$

@p5pRT
Copy link
Author

p5pRT commented Jul 22, 2010

From Ben.Golding@synopsys.com

Created by bgolding@synopsys.com

Errors like the following

Can't cd to C​:\Overnight/Slimer/_OLD/Fri_10_Mar_2006_3.17.03/MyInstallations/Platforms/VPTAVOR/Libraries/ZYLONITE_BASEBOARD/1.0/PROCESSOR_CARD/1.0/TAVOR_P_SOC/1.0/XScale_SS/1.0/Peripherals/PWR_CLK_Decode/1.0/Source/codebase/Release../../../../../../../../../../../../../../.. at C​:/Perl/lib/File/Find.pm line 929.

can occur when using File​::Find on Windows, if scanning a deep tree of subdirectories.

ActiveState isolated the core problem​:
http​://bugs.activestate.com/show_bug.cgi?id=45416

The problem is with the chdir() implementation on Windows. The function fails
if the total name length is more than 260 characters (the Windows MAX_PATH
length). However, it doesn't normalize the argument first. Here is a shorter
sample that reproduces the core problem​:

#!perl
use Cwd;
$|=1;
chdir $ENV{SYSTEMROOT};
print cwd, "\n";
$dir = "system32/../" x 21;
print length($dir), "\n";
chdir($dir) or die;
print cwd, "\n";
__END__

It's not clear to me whether chdir() on Windows should be fixed, File​::Find should be modified to work around, or both.

This bug is killing File​::Find for me in some real-world use cases.

Perl Info

Flags:
    category=library
    severity=high
    module=File::Find

This perlbug was built using Perl 5.12.0 - Sun Apr 11 11:18:23 2010
It is being executed now by  Perl 5.12.1 - Sun Apr 11 11:18:23 2010.

Site configuration information for perl 5.12.1:

Configured by SYSTEM at Sun Apr 11 11:18:23 2010.

Summary of my perl5 (revision 5 version 12 subversion 0) configuration:
   
  Platform:
    osname=MSWin32, osvers=5.00, archname=MSWin32-x86-multi-thread
    uname=''
    config_args='undef'
    hint=recommended, useposix=true, d_sigaction=undef
    useithreads=define, usemultiplicity=define
    useperlio=define, d_sfio=undef, uselargefiles=define, usesocks=undef
    use64bitint=undef, use64bitall=undef, uselongdouble=undef
    usemymalloc=n, bincompat5005=undef
  Compiler:
    cc='C:/Cygwin/bin/gcc.exe', ccflags ='-DNDEBUG -DWIN32 -D_CONSOLE -DNO_STRICT -DHAVE_DES_FCRYPT -DUSE_SITECUSTOMIZE -DPERL_IMPLICIT_CONTEXT -DPERL_IMPLICIT_SYS -DUSE_PERLIO -DPERL_MSVCRT_READFIX -DHASATTRIBUTE -fno-strict-aliasing -mms-bitfields',
    optimize='-O2',
    cppflags='-DWIN32'
    ccversion='', gccversion='3.4.4 (cygming special) (gdc 0.12, using dmd 0.125)', gccosandvers=''
    intsize=4, longsize=4, ptrsize=4, doublesize=8, byteorder=1234
    d_longlong=undef, longlongsize=8, d_longdbl=define, longdblsize=8
    ivtype='long', ivsize=4, nvtype='double', nvsize=8, Off_t='__int64', lseeksize=8
    alignbytes=8, prototype=define
  Linker and Libraries:
    ld='C:\Cygwin\bin\g++.exe', ldflags ='-L"C:\Perl\lib\CORE"'
    libpth=\lib
    libs=-lkernel32 -luser32 -lgdi32 -lwinspool -lcomdlg32 -ladvapi32 -lshell32 -lole32 -loleaut32 -lnetapi32 -luuid -lws2_32 -lmpr -lwinmm -lversion -lodbc32 -lodbccp32 -lcomctl32 -lmsvcrt
    perllibs=-lkernel32 -luser32 -lgdi32 -lwinspool -lcomdlg32 -ladvapi32 -lshell32 -lole32 -loleaut32 -lnetapi32 -luuid -lws2_32 -lmpr -lwinmm -lversion -lodbc32 -lodbccp32 -lcomctl32 -lmsvcrt
    libc=msvcrt.lib, so=dll, useshrplib=true, libperl=perl512.lib
    gnulibc_version=''
  Dynamic Linking:
    dlsrc=dl_win32.xs, dlext=dll, d_dlsymun=undef, ccdlflags=' '
    cccdlflags=' ', lddlflags='-mdll -L"C:\Perl\lib\CORE"'

Locally applied patches:
    ACTIVEPERL_LOCAL_PATCHES_ENTRY


@INC for perl 5.12.1:
    C:/Perl/site/lib
    C:/Perl/lib
    .


Environment for perl 5.12.1:
    CYGWIN_ROOT=C:\Cygwin
    HOME (unset)
    LANG=en_US.ASCII
    LANGUAGE (unset)
    LD_LIBRARY_PATH (unset)
    LOGDIR (unset)
    PATH=C:\Program Files\Common Files\Microsoft Shared\Windows Live;C:\Program Files\ActiveState Komodo IDE 5\;C:\Program Files\PC Connectivity Solution\;C:\Perl\site\bin;C:\Perl\bin;C:\Perl\bin;C:\Perl\bin;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\Qt\3.3.2\bin;C:\Program Files\CodeBlocks;C:\Program Files\jEdit;C:\Cygwin\usr\gnuarm\bin;C:\Cygwin\bin;C:\Cygwin\usr\mips-lite\bin;C:\Program Files\Java\jdk1.6.0_14\bin;C:\Program Files\Perforce;C:\Program Files\Novell\SecureLogin;C:\Program Files\Rational\common;C:\Program Files\Intel\WiFi\bin\;C:\Program Files\Common Files\DivX Shared\;C:\Program Files\QuickTime\QTSystem\;C:\Program Files\Common Files\Microsoft Shared\Windows Live
    PERL_BADLANG (unset)
    PERL_HOME=C:\Perl\bin
    SHELL (unset)

@p5pRT
Copy link
Author

p5pRT commented Jul 22, 2010

From @avar

Does no_chdir => 1 work as a workaround?

@p5pRT
Copy link
Author

p5pRT commented Jul 22, 2010

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

@p5pRT
Copy link
Author

p5pRT commented Nov 21, 2011

From justincase@yopmail.com

On Thu Jul 22 05​:32​:01 2010, avarab@​gmail.com wrote​:

Does no_chdir => 1 work as a workaround?

Using no_chdir => 1 worked for me when I encountered this problem today
in Perl 5.8.8, but I only needed to build a list of files.

Looks like ActiveState identified this problem in 2006.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants