Description of problem: gdb-add-index which is part of gdb-headless uses "which". which is not listed in the required dependencies of gdb-headless. Version-Release number of selected component (if applicable): 14.2-1.fc39 How reproducible: Always Steps to Reproduce: 1. Install gdb-headless in a minimal chroot without any other packages 2. Try to use gdb-add-index Actual results: gdb-add-index complains about not finding a gdb installaton Expected results: gdb-add-index works Additional info:
Please list the commands that you're using to accomplish step 1, "Install gdb-headless in a minimal chroot without any other packages". I've tried the following: mock -r fedora-rawhide-x86_64 --scrub=all mock -r fedora-rawhide-x86_64 --install gdb-headless mock -r fedora-rawhide-x86_64 --shell ... <mock-chroot> sh-5.2# which cat /usr/bin/cat But I also see this even without the "--install gdb-headless" step. I noticed that the 'which' package seems to be in the minimal buildroot.
I guess you can achieve step 1, with: # mock -r fedora-39-x86_64 --init --config-opts chroot_setup_cmd="" Do note, buildroot is the minimal chroot + @buildsys-build , which includes "which". IMHO direct deps should be directly declared anyway
Indeed, I am building from a chroot without @buildsys-build installed, I would prefer the which dependency to be declared explicitly.
I've added a 'Requires: which' for gdb-14.2-5.fc41. Now, when I do the following... mock -r fedora-rawhide-x86_64 --scrub=all mock -r fedora-rawhide-x86_64 --init --config-opts chroot_setup_cmd="" mock -r fedora-rawhide-x86_64 --install bash mock -r fedora-rawhide-x86_64 --install gdb-headless mock -r fedora-rawhide-x86_64 --shell ...I see: <mock-chroot> sh-5.2# which bash /usr/bin/bash So, 'which' is present now. But, I also see: <mock-chroot> sh-5.2# gdb-add-index /usr/lib64/libc.so.6 /usr/bin/gdb-add-index: line 115: readelf: command not found Traceback (most recent call last): File "/usr/share/gdb/python/gdb/__init__.py", line 187, in _auto_load_packages __import__(modname) File "/usr/share/gdb/python/gdb/command/rpm-suggestions.py", line 18, in <module> import rpm ModuleNotFoundError: No module named 'rpm' Error while writing index for `/usr/lib64/libc.so.6': No debugging symbols gdb-add-index: No index was created for /usr/lib64/libc.so.6 gdb-add-index: [Was there no debuginfo? Was there already an index?] I am making further changes to gdb.spec so that binutils (which provide readelf and objcopy) has a Requires. I've also added a Recommends for python3-rpm, which will hopefully fix the python traceback.
I've been making changes to rawhide gdb, but in the problem description, it appears that you're using f39. Do you actually need these changes for f39? Or will fixing rawhide be sufficient?
f40 would be great, f39 is not required
(In reply to Kevin Buettner from comment #4) > But, I also see: > > <mock-chroot> sh-5.2# gdb-add-index /usr/lib64/libc.so.6 > /usr/bin/gdb-add-index: line 115: readelf: command not found > Traceback (most recent call last): > File "/usr/share/gdb/python/gdb/__init__.py", line 187, in > _auto_load_packages > __import__(modname) > File "/usr/share/gdb/python/gdb/command/rpm-suggestions.py", line 18, in > <module> > import rpm > ModuleNotFoundError: No module named 'rpm' I am seeing the same in the valgrind testsuite, which makes all valgrind/gdb tests fail. > I've also added a Recommends for > python3-rpm, which will hopefully fix the python traceback. Are you sure the Recommends is strong enough? It looks like a BuildRequires gdb which valgrind.spec uses still doesn't pull in python3-rpm If things should keep working even if python3-rpm isn't installed then maybe you can make the autoload script optional? Add something like: try: import sys except ImportError: None else: ... the rest of the script slightly indented ...
(In reply to Mark Wielaard from comment #7) > (In reply to Kevin Buettner from comment #4) > > But, I also see: > > > > <mock-chroot> sh-5.2# gdb-add-index /usr/lib64/libc.so.6 > > /usr/bin/gdb-add-index: line 115: readelf: command not found > > Traceback (most recent call last): > > File "/usr/share/gdb/python/gdb/__init__.py", line 187, in > > _auto_load_packages > > __import__(modname) > > File "/usr/share/gdb/python/gdb/command/rpm-suggestions.py", line 18, in > > <module> > > import rpm > > ModuleNotFoundError: No module named 'rpm' > > I am seeing the same in the valgrind testsuite, which makes all valgrind/gdb > tests fail. > > > I've also added a Recommends for > > python3-rpm, which will hopefully fix the python traceback. > > Are you sure the Recommends is strong enough? > It looks like a BuildRequires gdb which valgrind.spec uses still doesn't > pull in python3-rpm Yes, I see that too. It seems that "Recommends" is not strong enough. > If things should keep working even if python3-rpm isn't installed then maybe > you can make the autoload script optional? > Add something like: > > try: > import sys > except ImportError: > None > else: > ... the rest of the script slightly indented ... Andrew suggested something similar earlier in the week. I'll probably go with this approach, though I'm still pondering it.
I am seeing the same issue in F41/Rawhide trying to rebuild dwz. A number of tests are failing like this: ``` FAIL: /builddir/build/BUILD/dwz/testsuite/dwz.tests/odr-struct-ns.sh dwz version for-test Copyright (C) 2001-2021 Red Hat, Inc. Copyright (C) 1992-2021 Free Software Foundation, Inc. Copyright (C) 2019-2021 SUSE LLC. This program is free software; you may redistribute it under the terms of the GNU General Public License version 3 or (at your option) any later version. This program has absolutely no warranty. Traceback (most recent call last): File "/usr/share/gdb/python/gdb/__init__.py", line 187, in _auto_load_packages __import__(modname) File "/usr/share/gdb/python/gdb/command/rpm-suggestions.py", line 18, in <module> import rpm ModuleNotFoundError: No module named 'rpm' ``` ``` === dwz Summary === # of expected passes 49 # of unexpected failures 9 # of unsupported tests 4 make: *** [Makefile:192: check] Error 1 ```
The problems exposed by this bug should be fixed in gdb-14.2-9.fc41. With regard to the missing python3-rpm package, GDB will now print a message instead of showing a python traceback. In particular, this is the output that I now see when running gdb-add-index: <mock-chroot> sh-5.2# gdb-add-index /usr/lib64/libc.so.6 Unable to load 'rpm' module. Please install the python3-rpm package. Error while writing index for `/usr/lib64/libc.so.6': No debugging symbols gdb-add-index: No index was created for /usr/lib64/libc.so.6 gdb-add-index: [Was there no debuginfo? Was there already an index?] I am closing this bug - though do let me know if a backport is desired for F40 or F39. For those, I think it may be sufficient to just make the spec file changes.
The fix breaks building of all Pythons in Fedora and will eventually also break upstream buildbots. I am reopening for now to find a solution: We'd rather not install python3-rpm when building Python due to bootstrapping isues. test test.test_gdb.test_cfunction crashed -- Traceback (most recent call last): File "/builddir/build/BUILD/python3.12-3.12.3-build/Python-3.12.3/Lib/test/libregrtest/single.py", line 178, in _runtest_env_changed_exc _load_run_test(result, runtests) File "/builddir/build/BUILD/python3.12-3.12.3-build/Python-3.12.3/Lib/test/libregrtest/single.py", line 125, in _load_run_test test_mod = importlib.import_module(module_name) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/builddir/build/BUILD/python3.12-3.12.3-build/Python-3.12.3/Lib/importlib/__init__.py", line 90, in import_module return _bootstrap._gcd_import(name[level:], package, level) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "<frozen importlib._bootstrap>", line 1387, in _gcd_import File "<frozen importlib._bootstrap>", line 1360, in _find_and_load File "<frozen importlib._bootstrap>", line 1331, in _find_and_load_unlocked File "<frozen importlib._bootstrap>", line 935, in _load_unlocked File "<frozen importlib._bootstrap_external>", line 995, in exec_module File "<frozen importlib._bootstrap>", line 488, in _call_with_frames_removed File "/builddir/build/BUILD/python3.12-3.12.3-build/Python-3.12.3/Lib/test/test_gdb/test_cfunction.py", line 5, in <module> from .util import setup_module, DebuggerTests File "/builddir/build/BUILD/python3.12-3.12.3-build/Python-3.12.3/Lib/test/test_gdb/util.py", line 98, in <module> GDB_VERSION_TEXT, GDB_VERSION = get_gdb_version() ^^^^^^^^^^^^^^^^^ File "/builddir/build/BUILD/python3.12-3.12.3-build/Python-3.12.3/Lib/test/test_gdb/util.py", line 91, in get_gdb_version raise Exception("unable to parse gdb version: %r" % stdout) Exception: unable to parse gdb version: "Unable to load 'rpm' module. Please install the python3-rpm package.\nGNU gdb (Fedora Linux) 14.2-9.fc41\nCopyright (C) 2023 Free Software Foundation, Inc.\nLicense GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>\nThis is free software: you are free to change and redistribute it.\nThere is NO WARRANTY, to the extent permitted by law.\n" 0:04:05 load avg: 3.67 [2/5/2] test.test_gdb.test_backtrace failed (uncaught exception) Re-running test.test_gdb.test_backtrace in verbose mode (matching: ) test test.test_gdb.test_backtrace crashed -- Traceback (most recent call last): File "/builddir/build/BUILD/python3.12-3.12.3-build/Python-3.12.3/Lib/test/libregrtest/single.py", line 178, in _runtest_env_changed_exc _load_run_test(result, runtests) File "/builddir/build/BUILD/python3.12-3.12.3-build/Python-3.12.3/Lib/test/libregrtest/single.py", line 125, in _load_run_test test_mod = importlib.import_module(module_name) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/builddir/build/BUILD/python3.12-3.12.3-build/Python-3.12.3/Lib/importlib/__init__.py", line 90, in import_module return _bootstrap._gcd_import(name[level:], package, level) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "<frozen importlib._bootstrap>", line 1387, in _gcd_import File "<frozen importlib._bootstrap>", line 1360, in _find_and_load File "<frozen importlib._bootstrap>", line 1331, in _find_and_load_unlocked File "<frozen importlib._bootstrap>", line 935, in _load_unlocked File "<frozen importlib._bootstrap_external>", line 995, in exec_module File "<frozen importlib._bootstrap>", line 488, in _call_with_frames_removed File "/builddir/build/BUILD/python3.12-3.12.3-build/Python-3.12.3/Lib/test/test_gdb/test_backtrace.py", line 6, in <module> from .util import setup_module, DebuggerTests, CET_PROTECTION, SAMPLE_SCRIPT File "/builddir/build/BUILD/python3.12-3.12.3-build/Python-3.12.3/Lib/test/test_gdb/util.py", line 98, in <module> GDB_VERSION_TEXT, GDB_VERSION = get_gdb_version() ^^^^^^^^^^^^^^^^^ File "/builddir/build/BUILD/python3.12-3.12.3-build/Python-3.12.3/Lib/test/test_gdb/util.py", line 91, in get_gdb_version raise Exception("unable to parse gdb version: %r" % stdout) Exception: unable to parse gdb version: "Unable to load 'rpm' module. Please install the python3-rpm package.\nGNU gdb (Fedora Linux) 14.2-9.fc41\nCopyright (C) 2023 Free Software Foundation, Inc.\nLicense GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>\nThis is free software: you are free to change and redistribute it.\nThere is NO WARRANTY, to the extent permitted by law.\n" 0:04:05 load avg: 3.67 [3/5/3] test.test_gdb.test_misc failed (uncaught exception) Re-running test.test_gdb.test_misc in verbose mode (matching: ) test test.test_gdb.test_misc crashed -- Traceback (most recent call last): File "/builddir/build/BUILD/python3.12-3.12.3-build/Python-3.12.3/Lib/test/libregrtest/single.py", line 178, in _runtest_env_changed_exc _load_run_test(result, runtests) File "/builddir/build/BUILD/python3.12-3.12.3-build/Python-3.12.3/Lib/test/libregrtest/single.py", line 125, in _load_run_test test_mod = importlib.import_module(module_name) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/builddir/build/BUILD/python3.12-3.12.3-build/Python-3.12.3/Lib/importlib/__init__.py", line 90, in import_module return _bootstrap._gcd_import(name[level:], package, level) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "<frozen importlib._bootstrap>", line 1387, in _gcd_import File "<frozen importlib._bootstrap>", line 1360, in _find_and_load File "<frozen importlib._bootstrap>", line 1331, in _find_and_load_unlocked File "<frozen importlib._bootstrap>", line 935, in _load_unlocked File "<frozen importlib._bootstrap_external>", line 995, in exec_module File "<frozen importlib._bootstrap>", line 488, in _call_with_frames_removed File "/builddir/build/BUILD/python3.12-3.12.3-build/Python-3.12.3/Lib/test/test_gdb/test_misc.py", line 5, in <module> from .util import run_gdb, setup_module, DebuggerTests, SAMPLE_SCRIPT File "/builddir/build/BUILD/python3.12-3.12.3-build/Python-3.12.3/Lib/test/test_gdb/util.py", line 98, in <module> GDB_VERSION_TEXT, GDB_VERSION = get_gdb_version() ^^^^^^^^^^^^^^^^^ File "/builddir/build/BUILD/python3.12-3.12.3-build/Python-3.12.3/Lib/test/test_gdb/util.py", line 91, in get_gdb_version raise Exception("unable to parse gdb version: %r" % stdout) Exception: unable to parse gdb version: "Unable to load 'rpm' module. Please install the python3-rpm package.\nGNU gdb (Fedora Linux) 14.2-9.fc41\nCopyright (C) 2023 Free Software Foundation, Inc.\nLicense GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>\nThis is free software: you are free to change and redistribute it.\nThere is NO WARRANTY, to the extent permitted by law.\n" 0:04:05 load avg: 3.67 [4/5/4] test.test_gdb.test_cfunction_full failed (uncaught exception) Re-running test.test_gdb.test_cfunction_full in verbose mode (matching: ) test test.test_gdb.test_cfunction_full crashed -- Traceback (most recent call last): File "/builddir/build/BUILD/python3.12-3.12.3-build/Python-3.12.3/Lib/test/libregrtest/single.py", line 178, in _runtest_env_changed_exc _load_run_test(result, runtests) File "/builddir/build/BUILD/python3.12-3.12.3-build/Python-3.12.3/Lib/test/libregrtest/single.py", line 125, in _load_run_test test_mod = importlib.import_module(module_name) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/builddir/build/BUILD/python3.12-3.12.3-build/Python-3.12.3/Lib/importlib/__init__.py", line 90, in import_module return _bootstrap._gcd_import(name[level:], package, level) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "<frozen importlib._bootstrap>", line 1387, in _gcd_import File "<frozen importlib._bootstrap>", line 1360, in _find_and_load File "<frozen importlib._bootstrap>", line 1331, in _find_and_load_unlocked File "<frozen importlib._bootstrap>", line 935, in _load_unlocked File "<frozen importlib._bootstrap_external>", line 995, in exec_module File "<frozen importlib._bootstrap>", line 488, in _call_with_frames_removed File "/builddir/build/BUILD/python3.12-3.12.3-build/Python-3.12.3/Lib/test/test_gdb/test_cfunction_full.py", line 7, in <module> from .util import setup_module File "/builddir/build/BUILD/python3.12-3.12.3-build/Python-3.12.3/Lib/test/test_gdb/util.py", line 98, in <module> GDB_VERSION_TEXT, GDB_VERSION = get_gdb_version() ^^^^^^^^^^^^^^^^^ File "/builddir/build/BUILD/python3.12-3.12.3-build/Python-3.12.3/Lib/test/test_gdb/util.py", line 91, in get_gdb_version raise Exception("unable to parse gdb version: %r" % stdout) Exception: unable to parse gdb version: "Unable to load 'rpm' module. Please install the python3-rpm package.\nGNU gdb (Fedora Linux) 14.2-9.fc41\nCopyright (C) 2023 Free Software Foundation, Inc.\nLicense GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>\nThis is free software: you are free to change and redistribute it.\nThere is NO WARRANTY, to the extent permitted by law.\n" 0:04:05 load avg: 3.67 [5/5/5] test.test_gdb.test_pretty_print failed (uncaught exception) Re-running test.test_gdb.test_pretty_print in verbose mode (matching: ) test test.test_gdb.test_pretty_print crashed -- Traceback (most recent call last): File "/builddir/build/BUILD/python3.12-3.12.3-build/Python-3.12.3/Lib/test/libregrtest/single.py", line 178, in _runtest_env_changed_exc _load_run_test(result, runtests) File "/builddir/build/BUILD/python3.12-3.12.3-build/Python-3.12.3/Lib/test/libregrtest/single.py", line 125, in _load_run_test test_mod = importlib.import_module(module_name) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/builddir/build/BUILD/python3.12-3.12.3-build/Python-3.12.3/Lib/importlib/__init__.py", line 90, in import_module return _bootstrap._gcd_import(name[level:], package, level) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "<frozen importlib._bootstrap>", line 1387, in _gcd_import File "<frozen importlib._bootstrap>", line 1360, in _find_and_load File "<frozen importlib._bootstrap>", line 1331, in _find_and_load_unlocked File "<frozen importlib._bootstrap>", line 935, in _load_unlocked File "<frozen importlib._bootstrap_external>", line 995, in exec_module File "<frozen importlib._bootstrap>", line 488, in _call_with_frames_removed File "/builddir/build/BUILD/python3.12-3.12.3-build/Python-3.12.3/Lib/test/test_gdb/test_pretty_print.py", line 5, in <module> from .util import ( File "/builddir/build/BUILD/python3.12-3.12.3-build/Python-3.12.3/Lib/test/test_gdb/util.py", line 98, in <module> GDB_VERSION_TEXT, GDB_VERSION = get_gdb_version() ^^^^^^^^^^^^^^^^^ File "/builddir/build/BUILD/python3.12-3.12.3-build/Python-3.12.3/Lib/test/test_gdb/util.py", line 91, in get_gdb_version raise Exception("unable to parse gdb version: %r" % stdout) Exception: unable to parse gdb version: "Unable to load 'rpm' module. Please install the python3-rpm package.\nGNU gdb (Fedora Linux) 14.2-9.fc41\nCopyright (C) 2023 Free Software Foundation, Inc.\nLicense GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>\nThis is free software: you are free to change and redistribute it.\nThere is NO WARRANTY, to the extent permitted by law.\n" 5 tests failed again: test.test_gdb.test_backtrace test.test_gdb.test_cfunction test.test_gdb.test_cfunction_full test.test_gdb.test_misc test.test_gdb.test_pretty_print == Tests result: FAILURE then FAILURE ==
python3-rpm isn't required by GDB. The message being printed is merely an informational message, but I'm guessing that it's messing up the attempt to get the GDB version. Would things work if that message were not printed? Assuming "yes", would it also work if the message regarding python3-rpm were printed to stderr?
> would it also work if the message regarding python3-rpm were printed to stderr? I assume so, but I would need to test that assumption. Note that currently, gdb is mid-bootstrap for Python 3.13 rebuild, so we need to wait a bit with this anyway.
I've made a pull-request which will cause the "Unable to load 'rpm' module. Please install the python3-rpm package." message to be output to stderr. See: https://src.fedoraproject.org/rpms/gdb/pull-request/132 I've tested it in a local mock chroot - it does output the message to stderr. But I haven't been able to test whether it fixes the get_gdb_version problem shown in comment 11. Let me know if/when you want me to merge it... Kevin
FYI this message is also breaking GDB version detection in compiletest in Rust. Printing it to stderr would probably fix version detection, but I wouldn't be surprised if it breaks other things. TBH I don't think this message is useful. End users shouldn't really see it due to the Recommends, and if they do, they wouldn't know what to do about it anyway (or at least *I* don't know why I would want to install this package). And in RPM builds themselves we presumably wouldn't want to install the python3-rpm dependency. (Though it looks like this will be necessary to unblock builds for now.)
I've made a new pull request: https://src.fedoraproject.org/rpms/gdb/pull-request/135 It defers printing a potential error message regarding the missing rpm module until just prior to printing the GDB prompt. This should remove the need for filtering the error message when checking the GDB version. I've also attempted to make the message more useful. See the pull request for examples of what is now printed along with other implications.
gdb-14.2-13.fc41 is marked as stable now. It contains the changes that I made in pull request #135. I think that all problems discussed in this bug report have been resolved now. Therefore, I am closing it.