Open
Description
Hi,
As shown below, #2377 introduced a regression. Also of interest regarding the change is the last workaround below.
Since fish
is known to conflict with gdb
in various ways, maybe revert the change and force a SHELL=/bin/sh
environment; or flat out inform users that fish
isn't supported.
from pwn import *
io = gdb.debug(['/bin/ls', ' '])
io.interactive()
Output
[+] Starting local process '/bin/gdbserver': pid 2333898
[*] Process '/bin/gdbserver' stopped with exit code 1 (pid 2333898)
[ERROR] gdbserver did not output its pid (maybe chmod +x?): b"can't handle command-line argument containing whitespace\n"
Traceback (most recent call last):
File "/home/<redacted>/opt/virtualenvs/pwn/lib/python3.11/site-packages/pwnlib/gdb.py", line 386, in _gdbserver_port
gdbserver.pid = int(process_created.split()[-1], 0)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
ValueError: invalid literal for int() with base 0: b'whitespace'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/<redacted>/src/phoenix/amd64/heap0/s.py", line 3, in <module>
io = gdb.debug(['/bin/ls', ' '])
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/<redacted>/opt/virtualenvs/pwn/lib/python3.11/site-packages/pwnlib/context/__init__.py", line 1690, in setter
return function(*a, **kw)
^^^^^^^^^^^^^^^^^^
File "/home/<redacted>/opt/virtualenvs/pwn/lib/python3.11/site-packages/pwnlib/gdb.py", line 702, in debug
gdb_port = _gdbserver_port(gdbserver, ssh)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/<redacted>/opt/virtualenvs/pwn/lib/python3.11/site-packages/pwnlib/gdb.py", line 388, in _gdbserver_port
log.error('gdbserver did not output its pid (maybe chmod +x?): %r', process_created)
File "/home/<redacted>/opt/virtualenvs/pwn/lib/python3.11/site-packages/pwnlib/log.py", line 439, in error
raise PwnlibException(message % args)
pwnlib.exception.PwnlibException: gdbserver did not output its pid (maybe chmod +x?): b"can't handle command-line argument containing whitespace\n"
Workarounds
- Revert the patch
- Prevent entering the
else
branch:gdb.debug(args, env={'a': 'b'})