Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 6 Aug 2004 20:48:07 +0200
From:      Jilles Tjoelker <jilles@stack.nl>
To:        freebsd-arch@freebsd.org
Subject:   _PATH_DEFPATH, _PATH_STDPATH, etc.
Message-ID:  <20040806184807.GB4675@stack.nl>

next in thread | raw e-mail | index | archive | help
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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20040806184807.GB4675>