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
Comments
From @bulk88Created by @bulk88Pics attached. With WinXP SP3 and VC 2005, miniperl's PP glob() can't launch the The reason that filepath is messed up is Perl_start_glob is almost This code that wipes %ENV has been subject to being revised twice in There are 2.25 ways to fix this, add SYSTEMROOT to the list of PATH and Greping the code shows some other possibly questionable ENV var http://perl5.git.perl.org/perl.git/blob/2efb8b4b644d5f3c28974a8f577081b4142decd2:/t/loc_tools.pl#l222 I never encountered this bug before since I almost never use VC 2005 on Not very interesting callstack of broken perlglob.exe process which has ntdll.dll!_KiFastSystemCallRet@0() Perl Info
|
From @bulk88 |
From @bulk88On Fri Sep 11 01:13:01 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. C:\perl521\src\t>perl harness -v op/magic.t Test Summary Report op/magic.t (Wstat: 256 Tests: 167 Failed: 0) -- |
From @cpansproutOn Fri Sep 11 21:34:06 2015, bulk88 wrote:
What accounts for that? -- Father Chrysostomos |
The RT System itself - Status changed from 'new' to 'open' |
From @tonycozOn Fri Sep 11 01:13:01 2015, bulk88 wrote:
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.
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.
Again, only the questionable names are removed, and PATH is modified.
The same questionable names, and PERL5SHELL, which is sensitive under taint.
This simply ensures none of %ENV's keys are undef.
Doesn't modify any system variables.
This may not be cleaning up the environment enough.
That one might be a bit risky, but File::Spec::Win32::tmpdir doesn't call any external processes, so it should be safe.
That seems safe. Tony |
From @bulk88This 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. -- |
From @cpansproutOn Mon Sep 21 23:49:05 2015, tonyc wrote:
Does the attached patch work for you?
But it would be a lot more work. (And ‘work’ is a four-letter word.) -- Father Chrysostomos |
From @cpansproutInline Patchdiff --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); |
From @bulk88On Sun Jul 17 16:19:57 2016, sprout wrote:
Yes. -- |
From @cpansproutOn Wed Aug 03 20:43:57 2016, bulk88 wrote:
Thank you for confirming. I have applied it as acffc8a. -- Father Chrysostomos |
@cpansprout - Status changed from 'open' to 'pending release' |
From @khwilliamsonThank 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 Perl 5.26.0 may be downloaded via: If you find that the problem persists, feel free to reopen this ticket. |
@khwilliamson - Status changed from 'pending release' to 'resolved' |
Migrated from rt.perl.org#126041 (status was 'resolved')
Searchable as RT126041$
The text was updated successfully, but these errors were encountered: