RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Bug 2217490 - callgrind Python scripts not working on RHEL-8.9
Summary: callgrind Python scripts not working on RHEL-8.9
Keywords:
Status: CLOSED ERRATA
Alias: None
Deadline: 2023-07-03
Product: Red Hat Enterprise Linux 8
Classification: Red Hat
Component: valgrind
Version: 8.9
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: rc
: ---
Assignee: Mark Wielaard
QA Contact: Jesus Checa
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2023-06-26 12:22 UTC by Jesus Checa
Modified: 2023-11-14 16:47 UTC (History)
3 users (show)

Fixed In Version: valgrind-3.21.0-8.el8
Doc Type: No Doc Update
Doc Text:
Clone Of:
Environment:
Last Closed: 2023-11-14 15:32:03 UTC
Type: Bug
Target Upstream Version:
Embargoed:
pm-rhel: mirror+


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Issue Tracker RHELPLAN-160766 0 None None None 2023-06-26 12:25:01 UTC
Red Hat Issue Tracker RHELPLAN-160767 0 None None None 2023-06-26 12:25:05 UTC
Red Hat Product Errata RHBA-2023:6953 0 None None None 2023-11-14 15:32:13 UTC

Description Jesus Checa 2023-06-26 12:22:50 UTC
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

Comment 1 Jesus Checa 2023-06-26 12:55:30 UTC
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)

Comment 2 Mark Wielaard 2023-06-27 09:34:12 UTC
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).

Comment 3 Mark Wielaard 2023-06-27 10:45:00 UTC
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.

Comment 4 Jesus Checa 2023-06-28 06:11:52 UTC
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.

Comment 9 errata-xmlrpc 2023-11-14 15:32:03 UTC
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


Note You need to log in before you can comment on or make changes to this bug.