[New-bugs-announce] [issue37067] os.execl doesn't allow for empty string in mac

Siming Yuan report at bugs.python.org
Mon May 27 12:08:47 EDT 2019


New submission from Siming Yuan <siming85 at gmail.com>:

the following works in Linux

import os
os.execl('/bin/bash', '')

doesn't in mac:
>>> import os
>>> os.execl('/bin/bash', '')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Users/me/.pyenv/versions/3.6.4/lib/python3.6/os.py", line 527, in execl
    execv(file, args)
ValueError: execv() arg 2 first element cannot be empty

works if you add a space
>>> os.execl('/bin/bash', ' ')

notice the space in 2nd argument.

technically it is also possible to run a command without arguments - why not allow for the case where *args is []?

>>> os.execl('/bin/bash')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Users/siyuan/.pyenv/versions/3.6.4/lib/python3.6/os.py", line 527, in execl
    execv(file, args)
ValueError: execv() arg 2 must not be empty
>>>

----------
components: macOS
messages: 343655
nosy: ned.deily, ronaldoussoren, siming85
priority: normal
severity: normal
status: open
title: os.execl doesn't allow for empty string in mac
versions: Python 3.5, Python 3.6, Python 3.7

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue37067>
_______________________________________


More information about the New-bugs-announce mailing list