Perl / perl5

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

Win32 startup error #127

Closed p5pRT closed 20 years ago

p5pRT commented 24 years ago

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

Searchable as RT931$

p5pRT commented 24 years ago

From miker3@ix.netcom.com

If perl.exe and perl.dll are run from the directory c​:\bin\, an access violation occurs when it is run. It appears that the drive is immaterial and there may be other directories that cause problems.

The problem is caused by the code​:

  ptr = strrchr(mod_name\, '\\');   if (!ptr || stricmp(ptr+1\, strip) != 0) {   if(!(*strip == '5' && *(ptr+1) == '5' && strncmp(strip\, base\, 5) == 0   && strncmp(ptr+1\, base\, 5) == 0)) {   ...

in get_emd_part() in win32.c (code reformated for email).

If strrchr() returns a null pointer\, !ptr is true and the controlled block is executed. In the second if\, *(ptr+1) then causes an access violation.

I've not yet completely analyzed this code or tested the fix\, but changing the first if to

  if (ptr && stricmp(ptr+1\, strip) != 0)

appears to fix the problem.

This was compiled from the standard distribution with Microsoft Visual C++ 6.0.

Perl Info ``` Site configuration information for perl 5.00503: Summary of my perl5 (5.0 patchlevel 5 subversion 03) configuration: Platform: osname=MSWin32, osvers=4.0, archname=MSWin32-x86 uname='' hint=recommended, useposix=true, d_sigaction=undef usethreads=undef useperlio=undef d_sfio=undef Compiler: cc='cl.exe', optimize='-Od -MD -DNDEBUG', gccversion= cppflags='-DWIN32' ccflags ='-Od -MD -DNDEBUG -DWIN32 -D_CONSOLE -DNO_STRICT ' stdchar='char', d_stdstdio=define, usevfork=false intsize=4, longsize=4, ptrsize=4, doublesize=8 d_longlong=undef, longlongsize=8, d_longdbl=define, longdblsize=10 alignbytes=8, usemymalloc=n, prototype=define Linker and Libraries: ld='link', ldflags ='-nologo -nodefaultlib -release -machine:x86' libpth=f:\progra~1\micros~2\vc98\lib c:\custom\vc98\lib libs= oldnames.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib netapi32.lib uuid.lib wsock32.lib mpr.lib winmm.lib version.lib odbc32.lib odbccp32.lib PerlCRT.lib libc=PerlCRT.lib, so=dll, useshrplib=yes, libperl=perl.lib Dynamic Linking: dlsrc=dl_win32.xs, dlext=dll, d_dlsymun=undef, ccdlflags=' ' cccdlflags=' ', lddlflags='-dll -nologo -nodefaultlib -release -machine:x86' Locally applied patches: @INC for perl 5.00503: c:\perl\5.00503\lib/MSWin32-x86 c:\perl\5.00503\lib c:\perl\site\5.00503\lib/MSWin32-x86 c:\perl\site\5.00503\lib . Environment for perl 5.00503: HOME=c:\etc LANG (unset) LANGUAGE=MSC LD_LIBRARY_PATH (unset) LOGDIR (unset) PATH=C:\B;F:\PROGRAM FILES\MICROSOFT VISUAL STUDIO\VC98\BIN;F:\PROGRAM FILES\MICROSOFT VISUAL STUDIO\COMMON\MSDEV98\BIN;C:\BIN;E:\NTRESKIT;D:\CYGNUS\CYGWIN-B20\H-I5 86-CYGWIN32\BIN;C:\WINNTS\SYSTEM32;C:\WINNTS PERL_BADLANG (unset) SHELL (unset) ```