From Gerhard.Sittig@gmx.net  Sat Oct 14 09:55:28 2000
Return-Path: <Gerhard.Sittig@gmx.net>
Received: from mail.gmx.net (pop.gmx.net [194.221.183.20])
	by hub.freebsd.org (Postfix) with SMTP id F3D0937B503
	for <FreeBSD-gnats-submit@freebsd.org>; Sat, 14 Oct 2000 09:55:27 -0700 (PDT)
Received: (qmail 10200 invoked by uid 0); 14 Oct 2000 16:55:16 -0000
Received: from p3ee21601.dip.t-dialin.net (HELO speedy.gsinet) (62.226.22.1)
  by mail.gmx.net with SMTP; 14 Oct 2000 16:55:16 -0000
Received: (from sittig@localhost)
	by speedy.gsinet (8.8.8/8.8.8) id PAA29472
	for FreeBSD-gnats-submit@freebsd.org; Sat, 14 Oct 2000 15:22:45 +0200
Message-Id: <20001014152245.M25237@speedy.gsinet>
Date: Sat, 14 Oct 2000 15:22:45 +0200
From: Gerhard Sittig <Gerhard.Sittig@gmx.net>
To: FreeBSD-gnats-submit@freebsd.org
Subject: exec(3) manpage vs source inconsistency

>Number:         21990
>Category:       docs
>Synopsis:       exec(3) manpage vs source inconsistency
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    asmodai
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          doc-bug
>Submitter-Id:   current-users
>Arrival-Date:   Sat Oct 14 10:00:01 PDT 2000
>Closed-Date:    Tue Mar 6 02:37:22 PST 2001
>Last-Modified:  Tue Mar 06 02:37:42 PST 2001
>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:
State-Changed-From-To: open->suspended 
State-Changed-By: asmodai 
State-Changed-When: Mon Oct 30 05:39:31 PST 2000 
State-Changed-Why:  
Committed to CURRENT. 

Awaiting MFC in the near future. 


Responsible-Changed-From-To: freebsd-doc->asmodai 
Responsible-Changed-By: asmodai 
Responsible-Changed-When: Mon Oct 30 05:39:31 PST 2000 
Responsible-Changed-Why:  
I'll MFC it soon. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=21990 
State-Changed-From-To: suspended->closed 
State-Changed-By: asmodai 
State-Changed-When: Tue Mar 6 02:37:22 PST 2001 
State-Changed-Why:  
MFC'd in time for 4.3-RELEASE. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=21990 
>Unformatted:
