Bug 21990

Summary: exec(3) manpage vs source inconsistency
Product: Documentation Reporter: Gerhard Sittig <Gerhard.Sittig>
Component: Books & ArticlesAssignee: Jeroen Ruigrok van der Werven <asmodai>
Status: Closed FIXED    
Severity: Affects Only Me    
Priority: Normal    
Version: Latest   
Hardware: Any   
OS: Any   

Description Gerhard Sittig 2000-10-14 18:00:01 UTC
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.

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.
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.
...
-----------------------------------------------------------------
Comment 1 Jeroen Ruigrok van der Werven freebsd_committer freebsd_triage 2000-10-30 13:39:31 UTC
State Changed
From-To: open->suspended

Committed to CURRENT. 

Awaiting MFC in the near future. 


Comment 2 Jeroen Ruigrok van der Werven freebsd_committer freebsd_triage 2000-10-30 13:39:31 UTC
Responsible Changed
From-To: freebsd-doc->asmodai

I'll MFC it soon.
Comment 3 Jeroen Ruigrok van der Werven freebsd_committer freebsd_triage 2001-03-06 10:37:22 UTC
State Changed
From-To: suspended->closed

MFC'd in time for 4.3-RELEASE.