Gnu-win32 beta release 18: make bug - 'export' has no effect

Ross Casley casley@VSISInc.COM
Tue Oct 14 13:01:00 GMT 1997


annakam@lmc.com noticed in the last week that the export command in make
doesn't do what it should.  I had the same problem.  

Here's the deal.

make expects to change a process's environment by assigning to the global
variable environ.  Specifically, it constructs a new environment in envp
and starts off a new program using this code:

	environ = envp;
	execvp(argv[0], argv);

Unfortunately, that doesn't work in gnu-win32.  Assigning to environ does
not change the environment seen after an execvp() (or the environment used
by getenv() and putenv()).

One obvious fix is to replace execvp() with execve() so as to set the
environment explicitly.  But a nice thing about execvp() is that it
searches the path itself to find argv[0].  With execve() you have to
search the path yourself.

Can anybody point me to either

	- A good way to set the current environment to be envp, or
	- A good way to search for a program on PATH?

[Note that it is not really correct just to use putenv() to change the
 current environmant, since an 'unexport' command may require you to
 remove variables from the environment.]

Many thanks in advance,

-Ross Casley
-
For help on using this list (especially unsubscribing), send a message to
"gnu-win32-request@cygnus.com" with one line of text: "help".



More information about the Cygwin mailing list