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

Garbled environment of child processess on Windows #9681

Open
p5pRT opened this issue Mar 13, 2009 · 5 comments
Open

Garbled environment of child processess on Windows #9681

p5pRT opened this issue Mar 13, 2009 · 5 comments

Comments

@p5pRT
Copy link

p5pRT commented Mar 13, 2009

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

Searchable as RT63844$

@p5pRT
Copy link
Author

p5pRT commented Mar 13, 2009

From stroornt@gmail.com

Created by stroornt@gmail.com

This is a bug report for perl from stroornt@​gmail.com,
generated with the help of perlbug 1.36 running under perl 5.10.0.

-----------------------------------------------------------------
On Windows GetEnvironmentStringsA returns the strings in the OEM code
page, but CreateProcess requires it to be ANSI - as a result processes
launched from perl get garbled environment. I solved this adding
AnsiGetEnvironmentStrings function​:

LPSTR AnsiGetEnvironmentStrings()
{
LPSTR envA;
int len;

if(IsWin95())
{
LPSTR envO, ptr;

envO=(LPSTR)GetEnvironmentStrings();
for(ptr=envO; *ptr; ptr+=strlen(ptr)+1);
len=(ptr-envO)+1;

Newx(envA, len, char);
OemToCharBuff(envO, envA, len);
FreeEnvironmentStrings(envO);
}
else
{
LPWSTR envW, ptr;

envW=GetEnvironmentStringsW();
for(ptr=envW; *ptr; ptr+=wcslen(ptr)+1);
len=(ptr-envW)+1;

int lenA=WideCharToMultiByte(CP_ACP, 0, envW, len, NULL, 0, NULL, NULL);
Newx(envA, lenA, char);
WideCharToMultiByte(CP_ACP, 0, envW, len, envA, lenA, NULL, NULL);
FreeEnvironmentStringsW(envW);
}
return envA;
}
Perl Info

Flags:
    category=core
    severity=medium

Site configuration information for perl 5.10.0:

Configured by SYSTEM at Wed Sep  3 13:16:08 2008.

Summary of my perl5 (revision 5 version 10 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='cl', ccflags ='-nologo -GF -W3 -MD -Zi -DNDEBUG -O1 -DWIN32 
-D_CONSOLE -DNO_STRICT -DHAVE_DES_FCRYPT -DUSE_SITECUSTOMIZE 
-DPRIVLIB_LAST_IN_INC -DPERL_IMPLICIT_CONTEXT -DPERL_IMPLICIT_SYS 
-DUSE_PERLIO -DPERL_MSVCRT_READFIX',
    optimize='-MD -Zi -DNDEBUG -O1',
    cppflags='-DWIN32'
    ccversion='15.0.30729', gccversion='', gccosandvers=''
    intsize=4, longsize=4, ptrsize=4, doublesize=8, byteorder=1234
    d_longlong=undef, longlongsize=8, d_longdbl=define, longdblsize=10
    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  
-libpath:"C:\Perl\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 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 msvcrt.lib
    libc=msvcrt.lib, so=dll, useshrplib=true, libperl=perl510.lib
    gnulibc_version=''
  Dynamic Linking:
    dlsrc=dl_win32.xs, dlext=dll, d_dlsymun=undef, ccdlflags=' '
    cccdlflags=' ', lddlflags='-dll -nologo -nodefaultlib -debug 
-opt:ref,icf  -libpath:"C:\Perl\lib\CORE"  -machine:x86'

Locally applied patches:
    ACTIVEPERL_LOCAL_PATCHES_ENTRY
    33741 avoids segfaults invoking S_raise_signal() (on Linux)
    33763 Win32 process ids can have more than 16 bits
    32809 Load 'loadable object' with non-default file extension
    32728 64-bit fix for Time::Local


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


Environment for perl 5.10.0:
    HOME (unset)
    LANG (unset)
    LANGUAGE (unset)
    LD_LIBRARY_PATH (unset)
    LOGDIR (unset)
    PATH=C:\Program Files (x86)\Microsoft Visual Studio 
9.0\Common7\IDE;C:\Program Files (x86)\Microsoft Visual Studio 
9.0\VC\BIN;C:\Program Files (x86)\Microsoft Visual Studio 
9.0\Common7\Tools;C:\Windows\Microsoft.NET\Framework\v3.5;C:\Windows\Microsoft.NET\Framework\v2.0.50727;C:\Program 
Files (x86)\Microsoft Visual Studio 9.0\VC\VCPackages;C:\Program 
Files\Microsoft SDKs\Windows\v6.1\bin;c:\program files 
(x86)\imagemagick-6.4.9-q8;C:\Program Files (x86)\AMD\AMD CAL 
1.3.0_beta\lib\lh64;C:\Program Files (x86)\AMD\AMD Brook+ 
1.3.0_beta\sdk\lib;C:\Perl\site\bin;C:\Perl\bin;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Program 
Files (x86)\ATI 
Technologies\ATI.ACE\Core-Static;c:\perl\bin;C:\G1\CygWin\bin;C:\G1\NASM;C:\Program 
Files\FAR\UTILS\Command
    PERL_BADLANG (unset)
    SHELL (unset)


@p5pRT
Copy link
Author

p5pRT commented Jul 17, 2012

From @bulk88

I think this ticket is related to, or was fixed by #12161

@p5pRT
Copy link
Author

p5pRT commented Jul 17, 2012

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

@p5pRT
Copy link
Author

p5pRT commented Jun 25, 2017

From itcharlie@gmail.com

This ticket hasn't been updated for some time and the Perl version reported is 5.10.

Bulk88 when you can, please review this ticket and update on whether ( #12161 ) resolves the reported issue.

@toddr
Copy link
Member

toddr commented Feb 12, 2020

@bulk88 can you confirm if this ticket can be closed?

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

3 participants