delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2003/02/07/18:55:15

Date: Fri, 7 Feb 2003 18:54:36 -0500
Message-Id: <200302072354.h17NsaF08105@envy.delorie.com>
X-Authentication-Warning: envy.delorie.com: dj set sender to dj AT delorie DOT com using -f
From: DJ Delorie <dj AT delorie DOT com>
To: abc AT anchorageinternet DOT org
CC: djgpp AT delorie DOT com
In-reply-to: <200302072342.h17NgJsB001895@en26.groggy.anc.acsalaska.net>
(abc AT anchorageinternet DOT org)
Subject: Re: Report a Bug (#! bash bug)
References: <200302072342 DOT h17NgJsB001895 AT en26 DOT groggy DOT anc DOT acsalaska DOT net>
Reply-To: djgpp AT delorie DOT com
Errors-To: nobody AT delorie DOT com
X-Mailing-List: djgpp AT delorie DOT com
X-Unsubscribes-To: listserv AT delorie DOT com

> I respectfully disagree with you in practical terms, in terms of
> compatibility, and in terms of the bash man page.

The functionality you reference is not handled by bash at all, so
quoting the bash man page is irrelevent.  The relevent man page
is the one for execve(), which states:

DESCRIPTION
       execve() executes the program pointed to by filename.  filename
       must be either a binary executable, or a script starting with a
       line of the form "#! interpreter [arg]".  In the latter case,
       the interpreter must be a valid pathname for an executable
       which is not itself a script, which will be invoked as
       interpreter [arg] filename.

Note it says [arg] and not [args]

> if you still disagree, i would like to see the standards you
> reference - to enlighten myself.

The System V Interface Definition documents the exec*() functions
as follows:

DESCRIPTION

  exec in all its forms overlays a new process image on an old
  process. The new pro-cess image is constructed from an ordinary
  executable file. This file is either an exe-cutable object file or a
  file of data for an interpreter. There can be no return from a
  successful e x e c because the calling process image is overlaid by
  the new process image.

  An interpreter file begins with a line of the form

    #! pathname [arg]

  where pathname is the path of the interpreter, and arg is an
  optional argument. When you exec an interpreter file, the system
  execs the specified interpreter. The pathname specified in the
  interpreter file is passed as arg0 to the interpreter. If arg was
  specified in the interpreter file, it is passed as arg1 to the
  interpreter. The remaining arguments to the interpreter are arg0
  through argn of the originally exe-cuted file.

Note that it explicitly requires that it be *one* argument.

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019