Date: Sat, 14 Oct 2000 15:22:45 +0200 From: Gerhard Sittig <Gerhard.Sittig@gmx.net> To: FreeBSD-gnats-submit@freebsd.org Subject: docs/21990: exec(3) manpage vs source inconsistency Message-ID: <20001014152245.M25237@speedy.gsinet>
next in thread | raw e-mail | index | archive | help
>Number: 21990
>Category: docs
>Synopsis: exec(3) manpage vs source inconsistency
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: freebsd-doc
>State: open
>Quarter:
>Keywords:
>Date-Required:
>Class: doc-bug
>Submitter-Id: current-users
>Arrival-Date: Sat Oct 14 10:00:01 PDT 2000
>Closed-Date:
>Last-Modified:
>Originator: Gerhard Sittig
>Release: FreeBSD 4.1-STABLE i386
>Organization:
in private
>Environment:
Seen this in a manpage on a FreeBSD 4-STABLE system as well as
verified that it is in the -CURRENT sources.
>Description:
The exec(3) manpage states that the exec?p functions fall back to
a search path of "/bin:/usr/bin:" in the absense of a "/" in
argv[0] as well as a "PATH" variable. This is quite a difference
from the "/bin:/usr/bin" path that actually applies.
>How-To-Repeat:
~/FreeBSD-source $ find \
src-current/lib/libc src-current/include \
src-stable/lib/libc src-stable/include \
-type f -print0 | xargs -0 grep -w _PATH_DEFPATH /dev/null
src-current/lib/libc/gen/exec.c: path = _PATH_DEFPATH;
src-current/include/paths.h:#define _PATH_DEFPATH "/usr/bin:/bin"
src-stable/lib/libc/gen/exec.c: path = _PATH_DEFPATH;
src-stable/include/paths.h:#define _PATH_DEFPATH "/usr/bin:/bin"
man 3 execvp (on a -STABLE machine)
-----------------------------------------------------------------
...
The functions execlp() and execvp() will duplicate the actions of the
shell in searching for an executable file if the specified file name does
not contain a slash ``/'' character. The search path is the path speci-
fied in the environment by ``PATH'' variable. If this variable isn't
specified, the default path ``/bin:/usr/bin:'' is used. In addition,
certain errors are treated specially.
...
-----------------------------------------------------------------
>Fix:
Not sure about it due to further reading in the manpage:
-----------------------------------------------------------------
...
COMPATIBILITY
Historically, the default path for the execlp() and execvp() functions
was ``:/bin:/usr/bin''. This was changed to place the current directory
last to enhance system security.
...
-----------------------------------------------------------------
Either the source or the doc is wrong in this respect. As I'm
not sure, there's no patch to be included here. Although I like
the current behaviour very much to *not* include the current
directory when not explicitely specified in the PATH variable
(and those who do get what they deserve ...). So I feel the
manpage to be behind the established situation. Please don't
tell me the source is. :)
virtually yours 82D1 9B9C 01DC 4FB4 D7B4 61BE 3F49 4F77 72DE DA76
Gerhard Sittig true | mail -s "get gpg key" Gerhard.Sittig@gmx.net
--
If you don't understand or are scared by any of the above
ask your parents or an adult to help you.
>Release-Note:
>Audit-Trail:
>Unformatted:
To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-doc" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20001014152245.M25237>
