public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
From: "donpedro.tdcadsl.dk via cygwin" <cygwin@cygwin.com>
To: cygwin@cygwin.com
Cc: pdtychsen.ext@gn.com
Subject: execvp* and spawnvp* react differently to same PATH environment variable
Date: Mon, 07 Oct 2019 20:51:00 -0000	[thread overview]
Message-ID: <1549599310.1980812.1570481495155.JavaMail.zimbra@tdcadsl.dk> (raw)

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

             reply	other threads:[~2019-10-07 20:51 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-10-07 20:51 donpedro.tdcadsl.dk via cygwin [this message]
2019-10-09 16:43 ` Ken Brown
2019-10-09 23:25   ` Peter Dons Tychsen via cygwin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1549599310.1980812.1570481495155.JavaMail.zimbra@tdcadsl.dk \
    --to=cygwin@cygwin.com \
    --cc=donpedro@tdcadsl.dk \
    --cc=pdtychsen.ext@gn.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).