environment setup problem with "env -"

Igor Pechtchanski pechtcha@cs.nyu.edu
Tue Jan 13 19:30:00 GMT 2004


On Tue, 13 Jan 2004, Nicholas Wourms wrote:

> Pierre.Humblet:
>
> > It's a "one thing led to another" situation.
> > 1) Windows programs expect those variables.
> > 2) They are user dependent and must be changed following a setuid.
> > 3) Due to a Windows quirk, some of the computation must be done *before*
> >    exec'ing the program following a setuid. That eventually led to
> >    generating the stuff on the fly and storing it in the cygheap.
> > 4) If they don't exist in the current environment, they are only
> >    produced when exec'ing potential Windows programs (see mount -X)
> >
> > Given 1) and the effort made in 4), we can argue forever whether it's
> > a bug. An alternative would be to only regenerate these variables
> > following a setuid. I vaguely recall doing that at some point.
>
> When they are added to the env, wouldn't it be better to just have
> cygwin escape the spaces or convert the path to 8.3 format (along the
> same lines that cygpath.exe -d operates)?  I know that this isn't the
> most elegant or aesthetically pleasing solution, but it seems like a
> reasonable compromise given your 4 statements above.
>
> Cheers,
> Nicholas

IMHO, it's not Cygwin's job to provide workarounds for broken programs.
If these programs can't handle spaces in filenames, they should be fixed,
or the startup scripts should be provided for them that "sanitize" the
relevant variables.  Also IMO, "env -" should not let *any* variables
through.  This could be done in Cygwin, or the "env" code (in sh-utils)
could have a Cygwin-specific section that does this.
	Igor
-- 
				http://cs.nyu.edu/~pechtcha/
      |\      _,,,---,,_		pechtcha@cs.nyu.edu
ZZZzz /,`.-'`'    -.  ;-;;,_		igor@watson.ibm.com
     |,4-  ) )-,_. ,\ (  `'-'		Igor Pechtchanski, Ph.D.
    '---''(_/--'  `-'\_) fL	a.k.a JaguaR-R-R-r-r-r-.-.-.  Meow!

"I have since come to realize that being between your mentor and his route
to the bathroom is a major career booster."  -- Patrick Naughton



More information about the Cygwin-developers mailing list