[New-bugs-announce] [issue40436] pythoninfo collect_gdb() blows up when gdb fails to run

Miro Hrončok report at bugs.python.org
Wed Apr 29 07:36:45 EDT 2020


New submission from Miro Hrončok <miro at hroncok.cz>:

We had this weird traceback when running pythoninfo in Fedora build with Python 3.9.0a6:

+ /builddir/build/BUILD/Python-3.9.0a6/build/optimized/python -m test.pythoninfo
ERROR: collect_gdb() failed
Traceback (most recent call last):
  File "/builddir/build/BUILD/Python-3.9.0a6/Lib/test/pythoninfo.py", line 761, in collect_info
    collect_func(info_add)
  File "/builddir/build/BUILD/Python-3.9.0a6/Lib/test/pythoninfo.py", line 383, in collect_gdb
    version = version.splitlines()[0]
IndexError: list index out of range


I have debugged the problem and it is:


>>> subprocess.run(["gdb", "-nx", "--version"])
CompletedProcess(args=['gdb', '-nx', '--version'], returncode=-11)

There is a segfault. Possibly because gdb was linked to libpython from 3.9.0a5 and we run it trough subprocess from 3.9.0a6.


The code in pythoninfo is:

    try:
        proc = subprocess.Popen(["gdb", "-nx", "--version"],
                                stdout=subprocess.PIPE,
                                stderr=subprocess.PIPE,
                                universal_newlines=True)
        version = proc.communicate()[0]
    except OSError:
        return

That means it is designed to ignore errors. But it only ignores some errors. Should it only attempt to parse the version when proc.returncode is 0?

I don't know yet if the tests will fail as well, maybe the problem will be bigger.

----------
components: Tests
messages: 367641
nosy: hroncok, vstinner
priority: normal
severity: normal
status: open
title: pythoninfo collect_gdb() blows up when gdb fails to run
versions: Python 3.7, Python 3.8, Python 3.9

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


More information about the New-bugs-announce mailing list