Jilles Tjoelker jilles at stack.nl
Thu Dec 24 23:13:53 UTC 2015

In <paths.h> there is a #define _PATH_DEFPATH which is set to
/usr/bin:/bin. This does not include /sbin, /usr/sbin and ports
(/usr/local/bin and /usr/local/sbin) directories and is therefore often

This is rarely a problem because _PATH_DEFPATH is overridden by
/etc/login.conf, ~/.login_conf and/or shell startup files. _PATH_DEFPATH
is still used as a default by execlp(), execvp(), posix_spawnp() and sh
if PATH is not set, and by cron.

Especially the latter is a common trap (most recently in PR 204813). We
can fix it for 99% by changing _PATH_DEFPATH to
This is the path in the default class in the default /etc/login.conf,
excluding ~/bin which would not be expanded properly in a string

For consistency, the _PATH_DEFPATH for RESCUE below and in 3 man pages
(exec.3, posix_spawn.3, crontab.5) need to be adjusted as well.

Jilles Tjoelker

More information about the freebsd-arch mailing list