This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Title: execve rejects empty argument list
Type: Stage:
Components: Library (Lib) Versions: Python 2.6
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: Tim.Newsham, arigo, docwatson, mwh, newsham
Priority: normal Keywords:

Created on 2004-05-13 00:54 by newsham, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Messages (5)
msg20790 - (view) Author: newsham (newsham) Date: 2004-05-13 00:54
The exec* family of calls in the os package does
not allow an empty list of arguments to be passed
in.  Passing is an empty list (ie. allow argv[0] to
be NULL and argc to be zero) is rarely desired, but
perfectly legal.

Verify by:

    import os
    os.execve("/bin/ls", [], {})

Tim N.
msg20791 - (view) Author: Michael Hudson (mwh) (Python committer) Date: 2004-08-07 21:48
Logged In: YES 

I think you'll need to supply a patch to have any hope of
this changing.
msg20792 - (view) Author: Dave Watson (docwatson) Date: 2004-08-14 23:53
Logged In: YES 

a patch has been submitted (# 1009075)
msg20793 - (view) Author: Armin Rigo (arigo) * (Python committer) Date: 2004-09-27 19:55
Logged In: YES 

Applied patch.
msg161545 - (view) Author: Tim Newsham (Tim.Newsham) Date: 2012-05-25 01:23
This still crashes in newer builds such as:
Python 2.6.5 (r265:79063, Apr 16 2010, 13:57:41) 
[GCC 4.4.3] on linux2

>>> import os
>>> os.execve("/bin/ls", [], {})
Segmentation fault

0  __strrchr_sse42 () at ../sysdeps/x86_64/multiarch/strrchr.S:134
#1  0x000000000040a36e in ?? ()
#2  0x0000000000407bce in ?? ()
#3  0x00007ffff744ac4d in __libc_start_main (main=<value optimized out>, 
    argc=<value optimized out>, ubp_av=<value optimized out>, 
    init=<value optimized out>, fini=<value optimized out>, 
    rtld_fini=<value optimized out>, stack_end=0x7fffffffee88)
    at libc-start.c:226
#4  0x0000000000402709 in ?? ()
#5  0x00007fffffffee88 in ?? ()
#6  0x000000000000001c in ?? ()
#7  0x0000000000000000 in ?? ()
Date User Action Args
2022-04-11 14:56:04adminsetgithub: 40251
2012-05-25 01:23:07Tim.Newshamsetnosy: + Tim.Newsham

messages: + msg161545
versions: + Python 2.6, - Python 2.3
2004-05-13 00:54:44newshamcreate