Bug: Cygwin won't export environ vars to win32 programs, when the current work dir contains non-ascii characters.

Lenik lenik@bodz.net
Wed Apr 29 09:13:00 GMT 2009


(Following example is based on bash, but the same to ash, tcsh, ksh, 
etc., so this should be bug of cygwin.)

(1) English only:
         C:\Profiles\Shecti\test>bash -c "cmd /c set"
         ALLUSERSPROFILE=C:\Profiles\All Users
         APPDATA=C:\Profiles\Shecti\Application Data
         CLIENTNAME=Console
         COMMONPROGRAMFILES=C:\Program Files\Common Files
         COMPUTERNAME=CLSVM
         COMSPEC=C:\WINDOWS\system32\cmd.exe
         CYGWIN=nodosfilewarning noenvcache title
         FP_NO_HOST_CHECK=NO
         HOME=C:\Profiles\Shecti
         HOMEDRIVE=C:
         HOMEPATH=\Profiles\Shecti
         LABJA_ROOT=c:\lenix
         LOGONSERVER=\\CLSVM
         NUMBER_OF_PROCESSORS=1
         OS=Windows_NT
         
PATH=C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;c:\lenix\bin
         PATHEXT=.COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH
         PROCESSOR_ARCHITECTURE=x86
         PROCESSOR_IDENTIFIER=x86 Family 15 Model 4 Stepping 9, GenuineIntel
         PROCESSOR_LEVEL=15
         PROCESSOR_REVISION=0409
         PROGRAMFILES=C:\Program Files
         PROMPT=$P$G
         PWD=/mnt/c/Profiles/Shecti/test
         SESSIONNAME=Console
         SHLVL=1
         SYSTEMDRIVE=C:
         SYSTEMROOT=C:\WINDOWS
         TEMP=C:\Profiles\Shecti\Temp
         TERM=cygwin
         TMP=C:\Profiles\Shecti\Temp
         USERDOMAIN=CLSVM
         USERNAME=Shecti
         USERPROFILE=C:\Profiles\Shecti
         WINDIR=C:\WINDOWS
         _=/mnt/c/WINDOWS/system32/cmd

(2) With Chinese characters, most variables are lost:
         C:\Profiles\Shecti\测试>bash -c "cmd /c set"
         COMSPEC=C:\WINDOWS\system32\cmd.exe
         PATHEXT=.COM;.EXE;.BAT;.CMD;.VBS;.JS;.WS
         PROMPT=$P$G

         C:\Profiles\Shecti\测试>


This problem seems only related to the working directory name, other 
environ variables are ok to include native characters:

     C:\Profiles\Shecti\test>set hello=Hello

     C:\Profiles\Shecti\test>bash -c "cmd /c set h"
     HOME=C:\Profiles\Shecti
     HOMEDRIVE=C:
     HOMEPATH=\Profiles\Shecti
     hello=Hello

     C:\Profiles\Shecti\test>set hello=你好

     C:\Profiles\Shecti\test>bash -c "cmd /c set h"
     HOME=C:\Profiles\Shecti
     HOMEDRIVE=C:
     HOMEPATH=\Profiles\Shecti
     hello=你好

     C:\Profiles\Shecti\test>set hello=

     C:\Profiles\Shecti\test>bash -c "env hello=你好 cmd /c set h"
     HOME=C:\Profiles\Shecti
     HOMEDRIVE=C:
     HOMEPATH=\Profiles\Shecti
     hello=你好

     C:\Profiles\Shecti\test>set h
     HOMEDRIVE=C:
     HOMEPATH=\Profiles\Shecti

     C:\Profiles\Shecti\test>bash -c "env CWD=你好 cmd /c set c"
     CLIENTNAME=Console
     COMMONPROGRAMFILES=C:\Program Files\Common Files
     COMPUTERNAME=CLSVM
     COMSPEC=C:\WINDOWS\system32\cmd.exe
     CWD=你好

     C:\Profiles\Shecti\test>md 你好

     C:\Profiles\Shecti\test>cd 你好

     C:\Profiles\Shecti\test\你好>bash -c "cmd /c set h"
     环境变量 h 没有定义 (Error: no environ variable starts with 'H')

     C:\Profiles\Shecti\test\你好>

-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: cygcheck.out
URL: <http://cygwin.com/pipermail/cygwin/attachments/20090429/f4221d57/attachment.ksh>
-------------- next part --------------
--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/


More information about the Cygwin mailing list