]> git.ipfire.org Git - thirdparty/man-pages.git/commitdiff
exec.3: glibc 2.24 dropped CWD from the defaul path
authorMichael Kerrisk <mtk.manpages@gmail.com>
Mon, 20 Nov 2017 19:28:11 +0000 (20:28 +0100)
committerMichael Kerrisk <mtk.manpages@gmail.com>
Mon, 20 Nov 2017 19:31:12 +0000 (20:31 +0100)
Document the glibc 2.24 change that dropped CWD from the default
search path employed by execlp(), execvp() and execvpe() when
PATH is not defined.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
man3/exec.3

index fedeef3dfa827cc3fa2ab7764d8cac20c171820c..0d531e921911c8706a178cacd1344a872cd4c72c 100644 (file)
@@ -146,11 +146,11 @@ specified in the
 .B PATH
 environment variable.
 If this variable isn't defined, the path list defaults to
-the current directory followed by the list of directories returned by
-.IR confstr(_CS_PATH) .
-(This
-.BR confstr (3)
-call typically returns the value "/bin:/usr/bin".)
+a list that includes the directories returned by
+.IR confstr(_CS_PATH)
+(which typically returns the value "/bin:/usr/bin")
+and possibly also the current working directory;
+see NOTES for further details.
 .PP
 If the specified filename includes a slash character, then
 .B PATH
@@ -219,15 +219,27 @@ The
 .BR execvpe ()
 function is a GNU extension.
 .SH NOTES
-On some other systems, the default path (used when the environment
-does not contain the variable \fBPATH\fR) has the current working
-directory listed after
+The default search path (used when the environment
+does not contain the variable \fBPATH\fR)
+shows some variation across systems.
+It generally includes
+.I /bin
+and
+.IR /usr/bin
+(in that order) and may also include the current working directory.
+On some other systems, the current working is included after
 .I /bin
 and
 .IR /usr/bin ,
 as an anti-Trojan-horse measure.
-Linux uses here the
-traditional "current directory first" default path.
+The glibc implementation long followed the traditional default where
+the current working directory is included at the start of the search path.
+However, some code refactoring during the development of glibc 2.24
+.\" glibc commit 1eb8930608705702d5746e5491bab4e4429fcb83
+caused the current working directory to be dropped altogether
+from the default search path.
+This accidental behavior change is considered mildly beneficial,
+and won't be reverted.
 .PP
 The behavior of
 .BR execlp ()