Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 9 Jan 2002 16:20:05 -0800 (PST)
From:      Garrett Wollman <wollman@khavrinen.lcs.mit.edu>
To:        freebsd-bugs@FreeBSD.org
Subject:   Re: kern/33738: [PATCH] empty argv
Message-ID:  <200201100020.g0A0K5W41473@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help
The following reply was made to PR kern/33738; it has been noted by GNATS.

From: Garrett Wollman <wollman@khavrinen.lcs.mit.edu>
To: Marc Olzheim <marcolz@stack.nl>
Cc: freebsd-gnats-submit@FreeBSD.ORG
Subject: Re: kern/33738: [PATCH] empty argv
Date: Wed, 9 Jan 2002 19:11:33 -0500 (EST)

 <<On Thu, 10 Jan 2002 00:54:20 +0100, Marc Olzheim <marcolz@stack.nl> said:
 
 > Perhaps this should be caught as well in execve(2). One could also argue
 > that setuid programmers should expect the unexpected, but why not make
 > it easier on them...
 
 The POSIX specification is clear: calling execve() with zero arguments
 must be permitted (but no Strictly Conforming Application may do so),
 and programs must expect to be called without arguments.  The
 Rationale states this explicitly:
 
 # Early proposals required that the value of argc passed to main( ) be
 # ``one or greater''. This was driven by the same requirement in
 # drafts of the ISO C standard. In fact, historical implementations
 # have passed a value of zero when no arguments are supplied to the
 # caller of the exec functions. This requirement was removed from the
 # ISO C standard and subsequently removed from this volume of IEEE Std
 # 1003.1-200x as well. The wording, in particular the use of the word
 # should, requires a Strictly Conforming POSIX Application to pass at
 # least one argument to the exec function, thus guaranteeing that argc
 # be one or greater when invoked by such an application. In fact, this
 # is good practice, since many existing applications reference argv[0]
 # without first checking the value of argc.
 
 (XSHd7, p. 758)
 
 If the Standard does not say that a list must be non-empty, then it
 may be empty.
 
 -GAWollman
 

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-bugs" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200201100020.g0A0K5W41473>