Web lists-archives.com

Re: Use a default path in exec*p*() if PATH is unset?




cyg Simple wrote:

   -i, --ignore-environment  start with an empty environment

A relative use of the executable will not be found if the environment is
empty.

Not necessarily (see Linux, *BSD, ...). POSIX says this is "implementation-defined" - under the assumption that 'env' uses execvp() which is the case for the GNU coreutils version.


Interestingly the approach in newlib/libc/posix/execvp.c differs from
Cygwin and others:
execvp() with PATH unset calls execv(). This has the same effect as
execvp() with PATH set to current directory only.

Why do you assume that this is an issue with execvp?

I never did (otherwise this would be a thread on cygwin-patches list).

The above only means that it is IMO interesting that the Cygwin source package contains two implementations of execvp() which handle the unset PATH situation differently.


The user should
not expect that an undefined behavior behaves the same way on other
systems.

Of course. But even then it is a reasonable question which possible alternative should be implemented by Cygwin. Cygwin homepage says "Get that Linux feeling, ...". So "implementation-defined" behavior should possibly be close to Linux :-)

Christian


--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple