This is the mail archive of the
cygwin
mailing list for the Cygwin project.
execvp* and spawnvp* react differently to same PATH environment variable
- From: "donpedro.tdcadsl.dk via cygwin" <cygwin at cygwin dot com>
- To: cygwin at cygwin dot com
- Cc: pdtychsen dot ext at gn dot com
- Date: Mon, 7 Oct 2019 22:51:35 +0200 (CEST)
- Subject: execvp* and spawnvp* react differently to same PATH environment variable
- Reply-to: donpedro at tdcadsl dot dk
Hi all,
While working on something i noticed that execvp* and spawnvp* behave differently with regards to $PATH, which i think is not correct.
----------------------------------------------
1) The execvp* functions are called like this:
return spawnve ( _P_OVERLAY | _P_PATH_TYPE_EXEC ,
find_exec ( file , buf , "PATH" , FE_NNF ) ? : "" ,
argv , envp );
This calls find_exec() with FE_NNF, which causes the path to be NULL if not found in $PATH.
This later causes cygwin to fail correctly if the program is not in $PATH.
----------------------------------------------
2) The spawnvp* functions are called like this:
return spawnve (mode | _P_PATH_TYPE_EXEC, find_exec (file, buf), argv, cur_environ ());
This does _not_ calls find_exec() with FE_NNF which causes the path to be the posix form, as it is not found in path.
This later causes cygwin to find the program even though it was not in $PATH which seems wrong.
----------------------------------------------
This seems like a bug in spawnvp* functions unless i am missing something?
Any thoughts?
Thanks,
/pedro
--
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