Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.
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 1671285

Summary: Regression introduced by errata RHBA-2018:0967
Product: Red Hat Enterprise Linux 7 Reporter: Renaud Métrich <rmetrich>
Component: tunaAssignee: John Kacur <jkacur>
Status: CLOSED ERRATA QA Contact: Qiao Zhao <qzhao>
Severity: high Docs Contact:
Priority: high    
Version: 7.7CC: bhu, jkacur, jon.marsh, qzhao
Target Milestone: rc   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: No Doc Update
Doc Text:
Story Points: ---
Clone Of:
: 1671440 (view as bug list) Environment:
RHTS=/kernel/rt-tests/us/us/tuna
Last Closed: 2019-08-06 12:48:53 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:
Bug Depends On:    
Bug Blocks: 1655694, 1671440    
Attachments:
Description Flags
Fix undefined global name stderr none

Description Renaud Métrich 2019-01-31 10:03:02 UTC
Description of problem:

Errata RHBA-2018:0967 fixes BZ 1472840 which introduces a regression when using the tuna command as shown below:

# tuna --threads=* --cpus=0 --move

Traceback (most recent call last):
  File "/usr/bin/tuna", line 710, in <module>
    main()
  File "/usr/bin/tuna", line 592, in main
    spread = spread)
  File "/usr/lib/python2.7/site-packages/tuna/tuna.py", line 275, in move_threads_to_cpu
    print >> stderr, "thread %(pid)d cannot be moved as requested" %{'pid':pid}
NameError: global name 'stderr' is not defined


Version-Release number of selected component (if applicable):

tuna-0.13-6.el7.noarch


How reproducible:

Always

Steps to Reproduce:

1. Execute the command

# tuna --threads=* --cpus=0 --move


Actual results:

Traceback (most recent call last):
  File "/bin/tuna", line 710, in <module>
    main()
  File "/bin/tuna", line 592, in main
    spread = spread)
  File "/usr/lib/python2.7/site-packages/tuna/tuna.py", line 275, in move_threads_to_cpu
    print >> stderr, "thread %(pid)d cannot be moved as requested" %{'pid':pid}
NameError: global name 'stderr' is not defined


Expected results:

No exception


Additional info:

Patch "tuna-Use-errno-codes-instead-of-numbers.patch" introduced the typo ("stderr" instead of "sys.stderr"):

117 @@ -267,12 +267,12 @@ def move_threads_to_cpu(cpus, pid_list, set_affinity_warning = None,
118                                                 print "move_threads_to_cpu: %s " % \
119                                                       (_("could not change %(pid)d affinity to %(new_    affinity)s") % \
120                                                        {'pid':pid, 'new_affinity':new_affinity})
121 -               except (SystemError, OSError) as e: # (3, 'No such process') old python-schedutils in    correctly raised SystemError
122 -                       if e[0] == 3:
123 +               except (SystemError, OSError) as e: # old python-schedutils incorrectly raised System    Error
124 +                       if e[0] == errno.ESRCH:
125                                 # process died
126                                 continue
127 -                       elif e[0] == 22: # (22, EINVAL - unmovable thread)
128 -                               print "thread %(pid)d cannot be moved as requested" %{'pid':pid}
129 +                        elif e[0] == errno.EINVAL: # unmovable thread)
130 +                               print >> stderr, "thread %(pid)d cannot be moved as requested" %{'pid    ':pid}
131                                 continue
132                         raise e
133         return changed

--> Line 130

Comment 4 John Kacur 2019-02-01 00:46:14 UTC
Created attachment 1525629 [details]
Fix undefined global name stderr

Comment 8 errata-xmlrpc 2019-08-06 12:48:53 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, 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-2019:2116