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

miniperl PP glob/Perl_start_glob() wipes all of %ENV and perlglob.exe proc can't start on VC 2005/WinXP #14901

Closed
p5pRT opened this issue Sep 11, 2015 · 17 comments

Comments

@p5pRT
Copy link

p5pRT commented Sep 11, 2015

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

Searchable as RT126041$

@p5pRT
Copy link
Author

p5pRT commented Sep 11, 2015

From @bulk88

Created by @bulk88

Pics attached.

With WinXP SP3 and VC 2005, miniperl's PP glob() can't launch the
perlglob.exe process. The process can't be started due to error code
0xc0150004 which is STATUS_SXS_ASSEMBLY_NOT_FOUND, MS's message for the
error is "The referenced assembly is not installed on the system.".
Using procmon I see that the OS code is loading a very wrong path,
"C​:\perl521\src\cpan\CPAN\%SystemRoot%\WinSxS\x86_Microsoft.VC80.CRT_1fc8b3b9a1e18e3b_8.0.50727.6195_x-ww_44262b86"
instead of
"C​:\WINDOWS\WinSxS\x86_Microsoft.VC80.CRT_1fc8b3b9a1e18e3b_8.0.50727.6195_x-ww_44262b86".
In VC 2005 and 2008 (but not any older or new VC version), the MS CRT
(libc) DLL is SXS tracked. SXS is MS's version of DLL versioning. A
central OS DB of known DLL versions and their checksums/crypto security
which has grandiose visions of being a package manager, with centralized
forwarding (upgrading) in any graph layout a micromanager loves. It
changed the term "DLL hell" to "Manifest hell". A manifest is an plain
text XML file inside the DLL/EXE that specifies which SXS
version/checksums of a DLL's filename a DLL wants to be bound against.

The reason that filepath is messed up is Perl_start_glob is almost
wiping all of %ENV which was done in commit
http​://perl5.git.perl.org/perl.git/commitdiff/a3342be368647e67883bc6ba3bea07bb06880b80
as a fix for https://rt-archive.perl.org/perl5/Ticket/Display.html?id=93638 . Father C
1 month later caught a bug
https://rt-archive.perl.org/perl5/Ticket/Display.html?id=93638#txn-995018 in his own
code and fixed it in
http​://perl5.git.perl.org/perl.git/commitdiff/93b2dae14541cd2bc39e2d4b1bb5f0cc2c0ef0c7
. 8 months later ticket
https://rt-archive.perl.org/perl5/Ticket/Display.html?id=113798 was filed which said a
Mingw GCC built perlglob.exe can't be executed since it relies on a GCC
DLL that is in PATH but not in C​:/Windows (the Windows system DLLs are
special cased ("KnownDLLs" key in registry)). That 2nd ticket got a fix
in
http​://perl5.git.perl.org/perl.git/commitdiff/25018358f5fe1e7a2595f788f4ad0296fece4086
by FC.

This code that wipes %ENV has been subject to being revised twice in
history for causing breakage. This bug ticket is now going to be the
THIRD revision of this code. Perhaps the original fix, instead of
localizing and wiping all of %ENV, should have just localized the
"LS_COLORS" env var alone in the %ENV hash. If you dont know why you are
deleting $ENV{"ONLY_A_MAGIC_8_BALL_KNOWS_THIS_ENV_VARS_NAME"} maybe you
shouldn't be deleting the env var. I can think of a scenario where some
C instrumented profiler requires a certain ENV var for the instrumented
binary to be loadable into a process. If perlglob.exe was instrumented,
it wouldn't start due to the missing env var since all of them
unconditionally were wiped.

There are 2.25 ways to fix this, add SYSTEMROOT to the list of PATH and
HOME being passed through, or stop localizing and wiping all of %ENV and
just localize LS_COLORS, or, I dont like this fix "#ifndef
WIN32\n/*localize/wipe %ENV */\n#endif" since that would fix it for me,
but doesn't fix the greater design problem of deleting env vars that you
dont know why you are deleting them. So which way will this be fixed?

Greping the code shows some other possibly questionable ENV var
manipulations which can be causing similar problems to this where it
wipes critical env vars or all of %ENV.

http​://perl5.git.perl.org/perl.git/blob/2efb8b4b644d5f3c28974a8f577081b4142decd2​:/t/loc_tools.pl#l222
http​://perl5.git.perl.org/perl.git/blob/2efb8b4b644d5f3c28974a8f577081b4142decd2​:/t/test.pl#l765
http​://perl5.git.perl.org/perl.git/blob/2efb8b4b644d5f3c28974a8f577081b4142decd2​:/taint.c#l83
http​://perl5.git.perl.org/perl.git/blob/2efb8b4b644d5f3c28974a8f577081b4142decd2​:/cpan/CPAN/lib/CPAN/Distribution.pm#l2165
http​://perl5.git.perl.org/perl.git/blob/2efb8b4b644d5f3c28974a8f577081b4142decd2​:/cpan/ExtUtils-MakeMaker/t/lib/MakeMaker/Test/Utils.pm#l22
http​://perl5.git.perl.org/perl.git/blob/2efb8b4b644d5f3c28974a8f577081b4142decd2​:/dist/PathTools/Cwd.pm#l220
http​://perl5.git.perl.org/perl.git/blob/2efb8b4b644d5f3c28974a8f577081b4142decd2​:/dist/PathTools/t/tmpdir.t#l25
http​://perl5.git.perl.org/perl.git/blob/2efb8b4b644d5f3c28974a8f577081b4142decd2​:/ext/File-Glob/t/basic.t#l40

I never encountered this bug before since I almost never use VC 2005 on
WinXP to build perl. But I often use VC 2008 on Server 2003 R2. Both VC
2005 and VC 2008 uses SXS CRTs, but I think MS revised the SXS (part of
DLL) loader so env var SYSTEMROOT is not used on Server 2003 and up
(maybe its 2003 R2 and up since I have R2), since that would evade the
"central management" and "security" principles of SXS. Server 2003 is
not the Server version of Windows XP, development wise. Windows XP is
5.1. Server 2003 and "Windows XP for 64 bits" are Windows 5.2. 5.2 is a
later development branch of Windows than 5.1. For example, I know in
Windows XP, CreateProcess checks the App Compat DB by memory mapping
C​:\WINDOWS\AppPatch\sysmain.sdb into the perl process. On Server 2003
CreateProcess checks the App Compat DB by doing an inter-process RPC
call to a daemon. Hence Server 2003 is evolutionary ahead of Windows XP.

Not very interesting callstack of broken perlglob.exe process which has
halted to show the fatal error popup, C main() was never reached before
the process fatally errored and halted. The fatal error popup box is not
being drawn by perlglob.exe but by csrss.exe, the "Win32 [emulation]
layer daemon".

  ntdll.dll!_KiFastSystemCallRet@​0()
  ntdll.dll!_ZwRaiseHardError@​24() + 0xc
  ntdll.dll!_LdrpInitializationFailure@​4() + 0x2d
  ntdll.dll!__LdrpInitialize@​12() + 0x25fe0
  ntdll.dll!_KiUserApcDispatcher@​20() + 0x7

Perl Info

Flags:
    category=core
    severity=high

Site configuration information for perl 5.23.2:

Configured by Owner at Wed Jul 22 12:17:22 2015.

Summary of my perl5 (revision 5 version 23 subversion 2) configuration:
  Derived from: f8ccc6c719cd8ef25c59a4a21fe1bab9f6a38c5b
  Ancestor: 30dc90f1923c08aae65b60f713ac12490a716e10
  Platform:
    osname=MSWin32, osvers=5.1, archname=MSWin32-x86-multi-thread
    uname=''
    config_args='undef'
    hint=recommended, useposix=true, d_sigaction=undef
    useithreads=define, usemultiplicity=define
    use64bitint=undef, use64bitall=undef, uselongdouble=undef
    usemymalloc=n, bincompat5005=undef
  Compiler:
    cc='cl', ccflags ='-nologo -GF -W3 -O1 -MD -Zi -DNDEBUG -GL -DWIN32 
-D_CONSOLE -DNO_STRICT  -DPERL_TEXTMODE_SCRIPTS -DPERL_IMPLICIT_CONTEXT 
-DPERL_IMPLICIT_SYS -D_USE_32BIT_TIME_T',
    optimize='-O1 -MD -Zi -DNDEBUG -GL',
    cppflags='-DWIN32'
    ccversion='13.10.6030', gccversion='', gccosandvers=''
    intsize=4, longsize=4, ptrsize=4, doublesize=8, byteorder=1234, 
doublekind=3
    d_longlong=undef, longlongsize=8, d_longdbl=define, longdblsize=8, 
longdblkind=0
    ivtype='long', ivsize=4, nvtype='double', nvsize=8, Off_t='__int64', 
lseeksize=8
    alignbytes=8, prototype=define
  Linker and Libraries:
    ld='link', ldflags ='-nologo -nodefaultlib -debug -opt:ref,icf -ltcg 
        -libpath:"c:\perl521\lib\CORE"         -machine:x86'
    libpth=\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 ws2_32.lib mpr.lib winmm.lib version.lib 
odbc32.lib odbccp32.lib comctl32.lib msvcrt.lib
    perllibs=oldnames.lib kernel32.lib user32.lib gdi32.lib winspool.lib 
comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib 
netapi32.lib uuid.lib ws2_32.lib mpr.lib winmm.lib version.lib 
odbc32.lib odbccp32.lib comctl32.lib msvcrt.lib
    libc=msvcrt.lib, so=dll, useshrplib=true, libperl=perl523.lib
    gnulibc_version=''
  Dynamic Linking:
    dlsrc=dl_win32.xs, dlext=dll, d_dlsymun=undef, ccdlflags=' '
    cccdlflags=' ', lddlflags='-dll -nologo -nodefaultlib -debug 
-opt:ref,icf -ltcg         -libpath:"c:\perl521\lib\CORE"         
-machine:x86'

Locally applied patches:
    uncommitted-changes
    a3b5f9fb00dafcb11d1766baaec76abc90f9fd06
    f8ccc6c719cd8ef25c59a4a21fe1bab9f6a38c5b


@INC for perl 5.23.2:
    C:/perl521/site/lib
    C:/perl521/lib
    .


Environment for perl 5.23.2:
    HOME (unset)
    LANG (unset)
    LANGUAGE (unset)
    LD_LIBRARY_PATH (unset)
    LOGDIR (unset)
    PATH=C:\perl521\bin;C:\Program Files\Microsoft Visual Studio .NET 
2003\Common7\IDE;C:\Program Files\Microsoft Visual Studio .NET 
2003\VC7\BIN;C:\Program Files\Microsoft Visual Studio .NET 
2003\Common7\Tools;C:\Program Files\Microsoft Visual Studio .NET 
2003\Common7\Tools\bin\prerelease;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\system32\wbem;
    PERL_BADLANG (unset)
    SHELL (unset)


@p5pRT
Copy link
Author

p5pRT commented Sep 11, 2015

From @bulk88

syscall_log.PNG

@p5pRT
Copy link
Author

p5pRT commented Sep 11, 2015

@p5pRT
Copy link
Author

p5pRT commented Sep 11, 2015

@p5pRT
Copy link
Author

p5pRT commented Sep 11, 2015

@p5pRT
Copy link
Author

p5pRT commented Sep 12, 2015

From @bulk88

On Fri Sep 11 01​:13​:01 2015, bulk88 wrote​:

This is a bug report for perl from bulk88@​hotmail.com,
generated with the help of perlbug 1.40 running under perl 5.23.2.

-----------------------------------------------------------------
[Please describe your issue here]

Pics attached.

With WinXP SP3 and VC 2005, miniperl's PP glob() can't launch the
perlglob.exe process. The process can't be started due to error code
0xc0150004 which is STATUS_SXS_ASSEMBLY_NOT_FOUND.

When I comment out the %ENV localize code in doio.c, and smoke that perl build, I get a test failure because it tried to open a path "C​:\perl521\src\t\%SystemRoot%\WinSxS\x86_Microsoft.VC80.CRT_1fc8b3b9a1e18e3b_8.0.50727.6195_x-ww_44262b86" when loading Win32​:: and its XS DLL.


C​:\perl521\src\t>perl harness -v op/magic.t
op/magic.t ..
1..190
ok 1 - *SIG appears to be defined at the outset
ok 2 - *^OPEN appears to be defined at the outset
ok 3 - *^TAINT appears to be defined at the outset
ok 4 - *^UNICODE appears to be defined at the outset
ok 5 - *^UTF8LOCALE appears to be defined at the outset
ok 6 - *^WARNING_BITS appears to be defined at the outset
ok 7 - *1 appears to be defined at the outset
ok 8 - *2 appears to be defined at the outset
ok 9 - *3 appears to be defined at the outset
ok 10 - *4 appears to be defined at the outset
ok 11 - *5 appears to be defined at the outset
ok 12 - *6 appears to be defined at the outset
ok 13 - *7 appears to be defined at the outset
ok 14 - *8 appears to be defined at the outset
ok 15 - *9 appears to be defined at the outset
ok 16 - *42 appears to be defined at the outset
ok 17 - *& appears to be defined at the outset
ok 18 - *` appears to be defined at the outset
ok 19 - *' appears to be defined at the outset
ok 20 - *​: appears to be defined at the outset
ok 21 - *? appears to be defined at the outset
ok 22 - *! appears to be defined at the outset
ok 23 - *_ appears to be defined at the outset
ok 24 - *- appears to be defined at the outset
ok 25 - *[ appears to be defined at the outset
ok 26 - *^ appears to be defined at the outset
ok 27 - *~ appears to be defined at the outset
ok 28 - *= appears to be defined at the outset
ok 29 - *% appears to be defined at the outset
ok 30 - *. appears to be defined at the outset
ok 31 - *( appears to be defined at the outset
ok 32 - *) appears to be defined at the outset
ok 33 - *< appears to be defined at the outset
ok 34 - *> appears to be defined at the outset
ok 35 - *\ appears to be defined at the outset
ok 36 - */ appears to be defined at the outset
ok 37 - *$ appears to be defined at the outset
ok 38 - *| appears to be defined at the outset
ok 39 - *+ appears to be defined at the outset
ok 40 - *; appears to be defined at the outset
ok 41 - *] appears to be defined at the outset
ok 42 - *^A appears to be defined at the outset
ok 43 - *^C appears to be defined at the outset
ok 44 - *^D appears to be defined at the outset
ok 45 - *^E appears to be defined at the outset
ok 46 - *^F appears to be defined at the outset
ok 47 - *^H appears to be defined at the outset
ok 48 - *^I appears to be defined at the outset
ok 49 - *^L appears to be defined at the outset
ok 50 - *^N appears to be defined at the outset
ok 51 - *^O appears to be defined at the outset
ok 52 - *^P appears to be defined at the outset
ok 53 - *^S appears to be defined at the outset
ok 54 - *^T appears to be defined at the outset
ok 55 - *^V appears to be defined at the outset
ok 56 - *^W appears to be defined at the outset
ok 57 - *^UTF8CACHE appears to be defined at the outset
ok 58 - *​::12345 appears to be defined at the outset
ok 59 - *main​::98732 appears to be defined at the outset
ok 60 - *^LAST_FH appears to be defined at the outset
ok 61
ok 62 - Unlinked file can't be opened
ok 63 # skip SIGINT not safe on this platform
ok 64 # skip SIGINT not safe on this platform
ok 65 # skip SIGINT not safe on this platform
ok 66 # skip SIGINT not safe on this platform
ok 67 # skip SIGINT not safe on this platform
ok 68
ok 69
ok 70 - deleting $​::{ENV}
ok 71
ok 72
ok 73
ok 74
ok 75 - referencing @​` before $` etc. still saws off ampersands
ok 76 - referencing @​& before $& etc. still saws off ampersands
ok 77 - referencing @​' before $' etc. still saws off ampersands
ok 78
ok 79
ok 80
ok 81
ok 82
ok 83
ok 84
ok 85 - no %@​
ok 86
ok 87 - $$ can be modified
ok 88 # skip no fork
ok 89
ok 90
ok 91
ok 92
ok 93
ok 94
ok 95
ok 96
ok 97
ok 98
ok 99 - Assigning $^I does not clobber $^O
ok 100 - test $^P = 0
ok 101 - test $^P = 1
ok 102 # skip We don't have prctl() here, or we're on Android
ok 103 # skip We don't have prctl() here, or we're on Android
ok 104
ok 105
ok 106
ok 107
ok 108 - defined *{"!"} does not stop %! from working
ok 109 - Referencing %{"powie​::!"} doesn't load Errno
ok 110 - Referencing %{"powie​::!"} after mentioning ${"powie​::!"} doesn't load E
rrno
ok 111 - Referencing %{"powie​::+"} doesn't load Tie​::Hash​::NamedCapture
ok 112 - Referencing %{"powie​::+"} after mentioning ${"powie​::+"} doesn't load T
ie​::Hash​::NamedCapture
ok 113
ok 114
ok 115
ok 116
ok 117
ok 118
ok 119
ok 120
ok 121
ok 122
ok 123 - Push a constant on a magic array
ok 124 - Assign a constant to a magic hash
ok 125 - Assign a shared key to a magic hash
ok 126 - Can assign to __WARN__
ok 127 - Can delete from __WARN__
ok 128 - __WARN__ is now gone
ok 129 - __WARN__ remains gone
ok 130 - Can assign to INT
ok 131 - Can delete from INT
ok 132 - INT is now gone
ok 133 - INT remains gone
ok 134 - Can assign to HUNGRY
ok 135 - Can delete from HUNGRY
ok 136 - HUNGRY is now gone
ok 137 - HUNGRY remains gone
ok 138 - __DIE__ is not present
ok 139 - delete of __DIE__ returns undef
ok 140 - _BOGUS_HOOK is not present
ok 141 - delete of _BOGUS_HOOK returns undef
ok 142 - KILL is not present
ok 143 - delete of KILL returns undef
ok 144 - THIRSTY is not present
ok 145 - delete of THIRSTY returns undef
ok 146 - [perl \#72850] Core dump in bleadperl from perl -e '$! = 9999; $a = $!;
'
ok 147 - defined *{"+"} does not stop %+ from working
ok 148 - defined *{"-"} does not stop %- from working
ok 149 - %- still loads Tie​::Hash​::NamedCapture when stash and UNIVERSAL​::AUTOLO
AD exist
ok 150 - $[ still loads arybase when stash and UNIVERSAL​::AUTOLOAD exist
ok 151 - %! still loads Errno when stash and UNIVERSAL​::AUTOLOAD exist
ok 152 - ${^LAST_FH} after tell
ok 153 - ${^LAST_FH} after another tell
ok 154 - ${^LAST_FH} referencing lexical coercible glob
ok 155 - ${^LAST_FH} is undef when PL_last_in_gv is NULL
ok 156 - [perl \#4760] print $| = ~$|
ok 157 - [perl \#115206] no crash when vivifying $| while *{+select}{IO} is unde
f
ok 158 - $^H modifies ${^OPEN} consistently
ok 159 - deleting $​::{"\cH"}
ok 160 - ${^MPE} starts undefined
ok 161 - ${^MPE} can be incremented
ok 162 - ${^MPEN} starts undefined
ok 163 - ${^MPEN} can be incremented
ok 164 - Setting ${^E_NCODING} croaks
ok 165 - can read ${^E_NCODING} without blowing up
ok 166 - ${^E_NCODING} is undef
ok 167
Can't load '../lib/auto/Win32/Win32.dll' for module Win32​: load_file​:The referen
ced assembly is not installed on your system at ../lib/DynaLoader.pm line 194.
  at ../lib/DynaLoader.pm line 100.
  DynaLoader​::confess("Can't load '../lib/auto/Win32/Win32.dll' for module
Win32​: lo"...) called at ../lib/DynaLoader.pm line 194
  DynaLoader​::bootstrap("Win32") called at ../lib/Win32.pm line 650
  require Win32.pm called at op/magic.t line 72
  main​::env_is("__NoNeSuCh", "foo", "setting \$0 does not break %ENV") cal
led at op/magic.t line 711
Compilation failed in require at op/magic.t line 72.
# Looks like you planned 190 tests but ran 167.
Dubious, test returned 1 (wstat 256, 0x100)
Failed 23/190 subtests
  (less 8 skipped subtests​: 159 okay)

Test Summary Report


op/magic.t (Wstat​: 256 Tests​: 167 Failed​: 0)
  Non-zero exit status​: 1
  Parse errors​: Bad plan. You planned 190 tests but ran 167.
Files=1, Tests=167, 2 wallclock secs ( 0.03 usr + 0.00 sys = 0.03 CPU)
Result​: FAIL


--
bulk88 ~ bulk88 at hotmail.com

@p5pRT
Copy link
Author

p5pRT commented Sep 21, 2015

From @cpansprout

On Fri Sep 11 21​:34​:06 2015, bulk88 wrote​:

When I comment out the %ENV localize code in doio.c, and smoke that
perl build, I get a test failure because it tried to open a path
"C​:\perl521\src\t\%SystemRoot%\WinSxS\x86_Microsoft.VC80.CRT_1fc8b3b9a1e18e3b_8.0.50727.6195_x-
ww_44262b86" when loading Win32​:: and its XS DLL.

What accounts for that?

--

Father Chrysostomos

@p5pRT
Copy link
Author

p5pRT commented Sep 21, 2015

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

@p5pRT
Copy link
Author

p5pRT commented Sep 22, 2015

From @tonycoz

On Fri Sep 11 01​:13​:01 2015, bulk88 wrote​:

There are 2.25 ways to fix this, add SYSTEMROOT to the list of PATH
and
HOME being passed through, or stop localizing and wiping all of %ENV
and
just localize LS_COLORS, or, I dont like this fix "#ifndef
WIN32\n/*localize/wipe %ENV */\n#endif" since that would fix it for
me,
but doesn't fix the greater design problem of deleting env vars that
you
dont know why you are deleting them. So which way will this be fixed?

Another option would be to bring the mechanics of csh_glob from File-Glob into core, similar to what was suggested in

https://rt-archive.perl.org/perl5/Ticket/Display.html?id=93638#txn-951162

To me that seems the safest mechanism, it would eliminate the need for shelling out at all.

Greping the code shows some other possibly questionable ENV var
manipulations which can be causing similar problems to this where it
wipes critical env vars or all of %ENV.

http​://perl5.git.perl.org/perl.git/blob/2efb8b4b644d5f3c28974a8f577081b4142decd2​:/t/loc_tools.pl#l222

This seems safe enough to me. Except for PATH, only "questionable" variables that change the behaviour of the shell are removed, PATH isn't an issue since it seems like no executable is run on Win32.

http​://perl5.git.perl.org/perl.git/blob/2efb8b4b644d5f3c28974a8f577081b4142decd2​:/t/test.pl#l765

Again, only the questionable names are removed, and PATH is modified.

http​://perl5.git.perl.org/perl.git/blob/2efb8b4b644d5f3c28974a8f577081b4142decd2​:/taint.c#l83

The same questionable names, and PERL5SHELL, which is sensitive under taint.

http​://perl5.git.perl.org/perl.git/blob/2efb8b4b644d5f3c28974a8f577081b4142decd2​:/cpan/CPAN/lib/CPAN/Distribution.pm#l2165

This simply ensures none of %ENV's keys are undef.

http​://perl5.git.perl.org/perl.git/blob/2efb8b4b644d5f3c28974a8f577081b4142decd2​:/cpan/ExtUtils-
MakeMaker/t/lib/MakeMaker/Test/Utils.pm#l22

Doesn't modify any system variables.

http​://perl5.git.perl.org/perl.git/blob/2efb8b4b644d5f3c28974a8f577081b4142decd2​:/dist/PathTools/Cwd.pm#l220

This may not be cleaning up the environment enough.

http​://perl5.git.perl.org/perl.git/blob/2efb8b4b644d5f3c28974a8f577081b4142decd2​:/dist/PathTools/t/tmpdir.t#l25

That one might be a bit risky, but File​::Spec​::Win32​::tmpdir doesn't call any external processes, so it should be safe.

http​://perl5.git.perl.org/perl.git/blob/2efb8b4b644d5f3c28974a8f577081b4142decd2​:/ext/File-
Glob/t/basic.t#l40

That seems safe.

Tony

@p5pRT
Copy link
Author

p5pRT commented Jul 6, 2016

From @bulk88

This is still an issue today with VC 2005 on WinXP.

I think the specific reason systemroot env var must be kept to start a VC 2005 compiled binary (automatically means that binary is SXS aware), the (WinXP but not newer) DLL loader when doing SXS passes string "%SystemRoot%\\WinSxS\\" to RtlExpandEnvironmentStrings_U() inside RtlpAssemblyStorageMapResolutionDefaultCallback. SystemRoot has to be defined or else the SXS code can't find the SXS directory where all the SXS tracked DLLs live.

--
bulk88 ~ bulk88 at hotmail.com

@p5pRT
Copy link
Author

p5pRT commented Jul 17, 2016

From @cpansprout

On Mon Sep 21 23​:49​:05 2015, tonyc wrote​:

On Fri Sep 11 01​:13​:01 2015, bulk88 wrote​:

There are 2.25 ways to fix this, add SYSTEMROOT to the list of PATH
and
HOME being passed through, or stop localizing and wiping all of %ENV
and
just localize LS_COLORS,

Does the attached patch work for you?

or, I dont like this fix "#ifndef
WIN32\n/*localize/wipe %ENV */\n#endif" since that would fix it for
me,
but doesn't fix the greater design problem of deleting env vars that
you
dont know why you are deleting them. So which way will this be fixed?

Another option would be to bring the mechanics of csh_glob from File-
Glob into core, similar to what was suggested in

https://rt-archive.perl.org/perl5/Ticket/Display.html?id=93638#txn-951162

To me that seems the safest mechanism, it would eliminate the need for
shelling out at all.

But it would be a lot more work. (And ‘work’ is a four-letter word.)

--

Father Chrysostomos

@p5pRT
Copy link
Author

p5pRT commented Jul 17, 2016

From @cpansprout

Inline Patch
diff --git a/doio.c b/doio.c
index 856b19a..2dc7082 100644
--- a/doio.c
+++ b/doio.c
@@ -2608,14 +2608,11 @@ Perl_vms_start_glob
 #endif /* !CSH */
 #endif /* !DOSISH */
     {
-	GV * const envgv = gv_fetchpvs("ENV", 0, SVt_PVHV);
-	SV ** const home = hv_fetchs(GvHV(envgv), "HOME", 0);
-	SV ** const path = hv_fetchs(GvHV(envgv), "PATH", 0);
-	if (home && *home) SvGETMAGIC(*home);
-	if (path && *path) SvGETMAGIC(*path);
-	save_hash(gv_fetchpvs("ENV", 0, SVt_PVHV));
-	if (home && *home) SvSETMAGIC(*home);
-	if (path && *path) SvSETMAGIC(*path);
+        SV ** const svp = hv_fetchs(GvHVn(PL_envgv), "LS_COLORS", 0);
+        if (svp && *svp)
+            save_helem_flags(GvHV(PL_envgv),
+                             newSVpvs_flags("LS_COLORS", SVs_TEMP), svp,
+                             SAVEf_SETMAGIC);
     }
     (void)do_open6(PL_last_in_gv, SvPVX_const(tmpcmd), SvCUR(tmpcmd),
                    NULL, NULL, 0);

@p5pRT
Copy link
Author

p5pRT commented Aug 4, 2016

From @bulk88

On Sun Jul 17 16​:19​:57 2016, sprout wrote​:

On Mon Sep 21 23​:49​:05 2015, tonyc wrote​:

On Fri Sep 11 01​:13​:01 2015, bulk88 wrote​:

There are 2.25 ways to fix this, add SYSTEMROOT to the list of PATH
and
HOME being passed through, or stop localizing and wiping all of %ENV
and
just localize LS_COLORS,

Does the attached patch work for you?

Yes.

--
bulk88 ~ bulk88 at hotmail.com

@p5pRT
Copy link
Author

p5pRT commented Aug 4, 2016

From @cpansprout

On Wed Aug 03 20​:43​:57 2016, bulk88 wrote​:

On Sun Jul 17 16​:19​:57 2016, sprout wrote​:

On Mon Sep 21 23​:49​:05 2015, tonyc wrote​:

On Fri Sep 11 01​:13​:01 2015, bulk88 wrote​:

There are 2.25 ways to fix this, add SYSTEMROOT to the list of PATH
and
HOME being passed through, or stop localizing and wiping all of %ENV
and
just localize LS_COLORS,

Does the attached patch work for you?

Yes.

Thank you for confirming. I have applied it as acffc8a.

--

Father Chrysostomos

@p5pRT
Copy link
Author

p5pRT commented Aug 4, 2016

@cpansprout - Status changed from 'open' to 'pending release'

@p5pRT
Copy link
Author

p5pRT commented May 30, 2017

From @khwilliamson

Thank you for filing this report. You have helped make Perl better.

With the release today of Perl 5.26.0, this and 210 other issues have been
resolved.

Perl 5.26.0 may be downloaded via​:
https://metacpan.org/release/XSAWYERX/perl-5.26.0

If you find that the problem persists, feel free to reopen this ticket.

@p5pRT
Copy link
Author

p5pRT commented May 30, 2017

@khwilliamson - Status changed from 'pending release' to 'resolved'

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

1 participant