Bug 2217490
| Summary: | callgrind Python scripts not working on RHEL-8.9 | ||
|---|---|---|---|
| Product: | Red Hat Enterprise Linux 8 | Reporter: | Jesus Checa <jchecahi> |
| Component: | valgrind | Assignee: | Mark Wielaard <mjw> |
| valgrind sub component: | system-version | QA Contact: | Jesus Checa <jchecahi> |
| Status: | CLOSED ERRATA | Docs Contact: | |
| Severity: | unspecified | ||
| Priority: | unspecified | CC: | fweimer, jakub, ohudlick |
| Version: | 8.9 | Keywords: | Triaged |
| Target Milestone: | rc | Flags: | pm-rhel:
mirror+
|
| Target Release: | --- | ||
| Hardware: | Unspecified | ||
| OS: | Unspecified | ||
| Whiteboard: | |||
| Fixed In Version: | valgrind-3.21.0-8.el8 | Doc Type: | No Doc Update |
| Doc Text: | Story Points: | --- | |
| Clone Of: | Environment: | ||
| Last Closed: | 2023-11-14 15:32:03 UTC | Type: | Bug |
| Regression: | --- | Mount Type: | --- |
| Documentation: | --- | CRM: | |
| Verified Versions: | Category: | --- | |
| oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | |
| Cloudforms Team: | --- | Target Upstream Version: | |
| Embargoed: | |||
| Deadline: | 2023-07-03 | ||
It seems that the scripts also use the "BooleanOptionalAction" action from the argparse module, which is available from Python 3.9. If we try to run the scripts with python38 (to cover the support of annotations and walrus operator), we get the following traceback:
# cg_annotate --version
Traceback (most recent call last):
File "/usr/bin/cg_annotate", line 41, in <module>
from argparse import ArgumentParser, BooleanOptionalAction, Namespace
ImportError: cannot import name 'BooleanOptionalAction' from 'argparse' (/usr/lib64/python3.8/argparse.py)
The solution is easy, just add BuildRequires for python39 and python39-rpm-macros this will make sure the testsuite is run with python3.9 as python3 and the rpm-macros will adjust the installed scripts to use #!/usr/bin/python3.9 (and add a Requires for that to the package). Looks like python39 is a "module" and so cannot be easily used as BuildRequires. But we can use python3.11 since that is newer and isn't a module. Gating tests are all passing. Tested valgrind-3.21.0-8.el8: the python scripts now work as expected. The "Sanity/valgrind-scripts-smoke" testcase passes with this new build, while fails with previous valgrind-3.21.0-7.el8 build. Additionally there are no more "post check failures" in the %check rpmbuild testsuite in the tests that involved cg_merg, cg_diff and cg_annotate scripts. Since the problem described in this bug report should be resolved in a recent advisory, it has been closed with a resolution of ERRATA. For information on the advisory (valgrind bug fix and enhancement update), and where to find the updated files, follow the link below. If the solution does not work for you, open a new bug report. https://access.redhat.com/errata/RHBA-2023:6953 |
Description of problem: callgrind scripts (cg_annotate, cg_merge, cg_diff) were rewritten as Python scripts for valgrind 3.21 release. These include features such as type annotations and the new walrus operator which are supported only in Python versions 3.7 and 3.8 respectively. This causes several issues when running cg_* scripts because RHEL-8 ships Python 3.6 as default, for example: File "../cg_annotate", line 449 while line := readline(): ^ SyntaxError: invalid syntax Version-Release number of selected component (if applicable): valgrind-3.21.0-3.el8 How reproducible: 100% Steps to Reproduce: 1. cg_annotate --version 2. cg_merge --version 3. cg_diff --version Actual results: # cg_annotate --version File "/usr/bin/cg_annotate", line 449 while line := readline(): ^ SyntaxError: invalid syntax # cg_merge --version File "/usr/bin/cg_merge", line 164 while line := readline(): ^ SyntaxError: invalid syntax # cg_diff --version File "/usr/bin/cg_diff", line 218 while line := readline(): ^ SyntaxError: invalid syntax