From: Bastien Roucariès <[email protected]> Document PATH resolution, particularly null sequence and empty PATH
Document also that since POSIX.1-2001 null sequence for . are deprecated. Signed-off-by: Bastien Roucariès <[email protected]> --- man7/environ.7 | 26 +++++++++++++++++++++++--- 1 file changed, 23 insertions(+), 3 deletions(-) diff --git a/man7/environ.7 b/man7/environ.7 index e33dcc754..9ac86f357 100644 --- a/man7/environ.7 +++ b/man7/environ.7 @@ -97,16 +97,28 @@ environment variables). The sequence of directory prefixes that .BR sh (1) and many other -programs apply in searching for a file known by an incomplete pathname. +programs using +.BR execlp (3) +apply in searching for a file known by an incomplete pathname. The prefixes are separated by \(aq\fB:\fP\(aq. -(Similarly one has +When a non-zero-length prefix is applied to this pathname, a \(aq\fB/\fP\(aq +(slash) shall be inserted between the prefix and the filename if the prefix +did not end in +\(aq\fB\(sl\fP\(aq (slash). +A zero length prefix is a legacy sequence that indicate the current directory or +\(aq\fB.\fP\(aq (see section BUGS below). +The list of prefixes shall be searched from beginning to end, applying the +pathname to each prefix, until an executable file with the specified name +and appropriate execution permissions is found. +.IP +Similarly one has .B CDPATH used by some shells to find the target of a change directory command, .B MANPATH used by .BR man (1) -to find manual pages, and so on) +to find manual pages, and so on. .TP .B PWD The current working directory. @@ -323,6 +335,14 @@ The authors of .I gzip should consider renaming their option to .BR GZIP_OPT . +.PP +.B PATH +zero lengh sequence, +that appears as two adjacent colons \(aq\fB::\fP\(aq, as a initial colon +\(aq\fB:\fP\(aq preceding the rest of the list, +or as a trailing colon \(aq\fB:\fP\(aq following the rest of the list, +shall be replaced by implicit \(aq\fB.\fP\(aq, in order to be portable +and strictly conformant to POSIX.1-2001. .SH SEE ALSO .BR bash (1), .BR csh (1), -- 2.29.2

