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

Christian Franke
Mon Apr 10 20:29:00 GMT 2017

A few years after
I found another use case of an unset PATH variable:

The configure script from mandoc ( 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 
( 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 ...]
[... time travel ...]
on Slackware 1.0.1 from 1993 :-)
(Thanks to 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 ?


Problem reports:
Unsubscribe info:

More information about the Cygwin mailing list