Cygwin versus MinGW/MSYS - differing behavior of 'export -p'
Tim Bell
tim.bell at oracle.com
Tue Sep 18 22:12:42 PDT 2012
All -
I have been working on getting build-infra/common/bin/extractvcvars.sh
working under MSYS. extractvcvars.sh runs vcvarsall.bat[1] to find the
VStudio tools. It does this by writing and executing a small .bat file
that runs 'bash -c export -p' before and after vcvarsall.bat, then
diffing the output.
If you open a Cygwin window and run 'bash -c export -p' you get a list
of all your environment variables, for example:
% bash -c export -p | sort -f
declare -x !C:
declare -x _="/usr/bin/bash"
[... snip ...]
declare -x TEMP="/tmp"
declare -x temp="C:\\Users\\tbbell\\AppData\\Local\\Temp"
declare -x TERM="cygwin"
declare -x TMP="/tmp"
declare -x tmp="C:\\Users\\tbbell\\AppData\\Local\\Temp"
declare -x TMPDIR="/cygdrive/c/Users/tbbell/AppData/Local/Temp"
Note the upper/lower case environment variables listed.
If you run the MSYS bash in the same window (same environment):
% /cygdrive/c/jprt/products/P1/MinGW/msys/1.0/bin/bash -c export -p |
sort -f
declare -x !C:="C:\\cygwin\\bin"
declare -x _="/cygdrive/c/jprt/products/P1/MinGW/msys/1.0/bin/bash"
[... snip ...]
declare -x TEMP="/tmp"
declare -x TERM="cygwin"
declare -x TMP="/tmp"
declare -x TMPDIR="/tmp"
Notice we get back only upper case environment variables. In the case
of TMP versus tmp and TEMP versus temp, the uppercase variable wins.
I don't think this behavior will affect the project, and I plan to move
forward tomorrow. Yet I find the difference somewhat startling, and it
will be something to look out for.
Tim
[1] located here on my Windows 7 development system:
c:/Program Files (x86)/Microsoft Visual Studio
10.0/Common7/Tools/../../VC/vcvarsall.bat
More information about the build-infra-dev
mailing list