make-w32
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: PATH vs. Path ([Fwd: Returned mail: see transcript for details]


From: Earnie Boyd
Subject: Re: PATH vs. Path ([Fwd: Returned mail: see transcript for details]
Date: Thu, 3 Mar 2005 07:10:54 -0500 (EST)
User-agent: SquirrelMail/1.4.3a

<quote who="Eli Zaretskii">
>
>> So, based on my discovery with MSYS and therefore Cygwin, I'm in favor
>> of
>> John Calcote's patch to uppercase all environment variable names for the
>> Windows build.
>
> Why do we have to upcase anything besides Path?  I'm not sure MSYS and
> Cygwin's lead is a reason good enough to do the same in the MinGW
> build.  The kind of sweeping change you suggest could have unintended
> consequences, so it seems to ne that upcasing only Path will solve the
> immediate problem at hand without risking too much.
>

MSYS and Cygwin as well as the child cmd.exe (at least on NT 5.1) will retain

export a=A
export A=a

in their respective environments.  However cmd.exe, even though both A and
a are variables, will pick A for either ``echo %a%'' or ``echo %A%'' and
return the value ``a''.  MSYS and Cygwin have no problem with picking the
correct variable.  Now in the cmd.exe shell when I ``set B=b'' and ``set
b=B'' what remains is B=B.  If I reverse the order of the set commands,
assuming neither B or b is a valid variable at the time, what remains is
b=b.  This environment variable quackery becomes even more burdonsome if
one makes use of the C runtime _environ pointer.  And even worse is the
envp argument to the main function, according to MSDN the variable may not
contain the correct data in all cases.

Uppercasing the variable name helps avoid confusion and possibly reduce
list noise.  We could replace getenv() and setenv() with our own versions
that read and write the _environ variable directly.  That is what Cygwin
and MSYS do.  That is how we get both A and a set in a child cmd.exe
process.  I may look at MSYS and make changes so that it emulates the
cmd.exe rules for setting an environment variable at some point when I
have more time than I do now.

Earnie

--
http://www.mingw.org
http://sourceforge.net/projects/mingw
https://sourceforge.net/donate/index.php?user_id=15438




reply via email to

[Prev in Thread] Current Thread [Next in Thread]