public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
* Use a default path in exec*p*() if PATH is unset?
@ 2017-04-10 20:29 Christian Franke
  2017-04-11  6:09 ` Thomas Wolff
  0 siblings, 1 reply; 8+ messages in thread
From: Christian Franke @ 2017-04-10 20:29 UTC (permalink / raw)
  To: cygwin

A few years after https://cygwin.com/ml/cygwin/2014-09/msg00204.html
I found another use case of an unset PATH variable:

The configure script from mandoc (http://mdocml.bsd.lv/) uses this 
interesting approach to query default CC command from make:

CC=`printf "all:\\n\\t@echo \\\$(CC)\\n" | env -i make -sf -`

This works at least on Linux, (Free|Net|Open)BSD and OpenIndiana. It 
fails on Cygwin because 'env -i' unsets everything and execvp() does not 
use a default path then. This is OK from the POSIX 
("implementation-defined") point of view but differs from existing practice.

At least some Linux distros use ".:/bin:/usr/bin" as default path 
(https://linux.die.net/man/3/exec). Including the current directory is 
IMO a bad idea.

This is apparently inherited from the early days:
The current directory is included on current Debian stable, and
[... time travel ...]
also
[... time travel ...]
on Slackware 1.0.1 from 1993 :-)
(Thanks to http://www.qemu-advent-calendar.org/2014/ for this image)

Other OS typically use a default path without current directory.

Should Cygwin also use a default path, for example _PATH_DEFPATH=/bin ?

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

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2017-04-12 17:27 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-04-10 20:29 Use a default path in exec*p*() if PATH is unset? Christian Franke
2017-04-11  6:09 ` Thomas Wolff
2017-04-11 11:11   ` Christian Franke
2017-04-11 13:58     ` cyg Simple
2017-04-11 19:02       ` Christian Franke
2017-04-13  4:29         ` cyg Simple
2017-04-13 12:34           ` Christian Franke
2017-04-13 13:13             ` cyg Simple

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).