From owner-freebsd-doc Sat Oct 14 10: 0:11 2000 Delivered-To: freebsd-doc@freebsd.org Received: from freefall.freebsd.org (freefall.FreeBSD.org [216.136.204.21]) by hub.freebsd.org (Postfix) with ESMTP id DCD7337B503 for ; Sat, 14 Oct 2000 10:00:03 -0700 (PDT) Received: (from gnats@localhost) by freefall.freebsd.org (8.9.3/8.9.2) id KAA02713; Sat, 14 Oct 2000 10:00:03 -0700 (PDT) (envelope-from gnats@FreeBSD.org) Received: from mail.gmx.net (pop.gmx.net [194.221.183.20]) by hub.freebsd.org (Postfix) with SMTP id F3D0937B503 for ; 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 To: FreeBSD-gnats-submit@freebsd.org Subject: docs/21990: exec(3) manpage vs source inconsistency Sender: owner-freebsd-doc@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.org >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