Cygwin versus MinGW/MSYS - differing behavior of 'export -p'

Kelly O'Hair kelly.ohair at oracle.com
Wed Sep 19 11:22:48 PDT 2012


The TMP or TEMP (can't remember which) are used by VS2010 as I recall, kind of an undocumented dependency.
Might be in the VS2010 license checking maybe.
Anyway, it has been my experience that these must be windows-ish paths, e.g. C:\TEMP
or VS2010 will have crazy failures.

TMPDIR I think is a CYGWIN or unix only thing, I think, so it's probably ok as a plain /tmpdir type path.

The variables TMP or TEMP are also used by some CYGWIN utilities, maybe cpio, so they have conflicting
uses as I recall.

-kto


On Sep 18, 2012, at 10:12 PM, Tim Bell wrote:

> 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