_PATH_DEFPATH, _PATH_STDPATH, etc.

Jilles Tjoelker jilles at stack.nl
Fri Aug 6 11:48:12 PDT 2004


In $FreeBSD: src/include/paths.h,v 1.24 2003/06/29 18:35:36 gordon Exp $, 
the following PATHs are defined:

/* Default search path. */
#define	_PATH_DEFPATH	"/usr/bin:/bin"
/* All standard utilities path. */
#define	_PATH_STDPATH \
	"/usr/bin:/bin:/usr/sbin:/sbin:"
/* Locate system binaries */
#define _PATH_SYSPATH	\
	"/sbin:/usr/sbin"

and #ifdef RESCUE
#define	_PATH_DEFPATH	"/rescue:/usr/bin:/bin"
#define	_PATH_STDPATH	"/rescue:/usr/bin:/bin:/usr/sbin:/sbin"
#define	_PATH_SYSPATH	"/rescue:/sbin:/usr/sbin"

I think it is not a good idea to have the current directory in
_PATH_STDPATH, which is returned by confstr(_CS_PATH) and getconf PATH.
Those are defined by POSIX to return a path that will find all standard
utilities. Also, _PATH_STDPATH is used in many places as a default path
for the root user, although in most of those cases, it is overwritten by
explicit PATH assignments in files like /etc/crontab and
/etc/login.conf.

NetBSD cleared up the difference between _PATH_DEFPATH and _PATH_STDPATH
in 1998:

http://cvsweb.netbsd.org/bsdweb.cgi/src/include/paths.h.diff?r1=1.10&r2=1.11
and NetBSD PR #4304

_PATH_SYSPATH is used by fsck(8) and mount(8) to find
filesystem-specific versions.

On a related note, why is md5(1) in /sbin?

-- 
Jilles Tjoelker


More information about the freebsd-arch mailing list