Hello Bastien, For various reasons, I applied a different patch. See below.
On 1/30/21 12:29 AM, roucaries.bast...@gmail.com wrote: > From: Bastien Roucariès <ro...@debian.org> > > Document PATH resolution, particularly null sequence and empty PATH > > Document also that since POSIX.1-2001 null sequence for . are deprecated. But your patch *doesn't* document that the null sequence is deprecated! > > Signed-off-by: Bastien Roucariès <ro...@debian.org> > --- > 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. As I already remarked, we can't simply lift passages of text from POSIX. Please don't do this. > +.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), > I instead applied the patch below. Cheers, Michael diff --git a/man7/environ.7 b/man7/environ.7 index dd35050b2..11dfb4862 100644 --- a/man7/environ.7 +++ b/man7/environ.7 @@ -98,8 +98,22 @@ The sequence of directory prefixes that .BR sh (1) and many other programs employ when searching for an executable file that is specified -as a simple filename (containing no slashes). -The prefixes are separated by \(aq\fB:\fP\(aq. +as a simple filename (i.a., a pathname that contains no slashes). +The prefixes are separated by colons (\fB:\fP). +The list of prefixes is searched from beginning to end, +by checking the pathname formed by concatenating +a prefix, a slash, and the filename, +until a file with execute permission is found. +.IP +As a legacy feature, a zero-length prefix +(specified as two adjacent colons, or an initial or terminating colon) +is interpreted to mean the current working directory. +However, use of this feature is deprecated, +and POSIX notes that a conforming application shall use +an explicit pathname (e.g., +.IR . ) +to specify the current working directory. +.IP (Similarly one has .B CDPATH used by some shells to find the target -- Michael Kerrisk Linux man-pages maintainer; http://www.kernel.org/doc/man-pages/ Linux/UNIX System Programming Training: http://man7.org/training/