This bug has been migrated to another issue tracking site. It has been closed here and may no longer be being monitored.

If you would like to get updates for this issue, or to participate in it, you may do so at Red Hat Issue Tracker .
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 2192940 - subscription-manager commands that list a large amount of repositories piped to less outputs an error but completes
Summary: subscription-manager commands that list a large amount of repositories piped ...
Keywords:
Status: CLOSED MIGRATED
Alias: None
Product: Red Hat Enterprise Linux 8
Classification: Red Hat
Component: subscription-manager
Version: ---
Hardware: Unspecified
OS: Unspecified
medium
low
Target Milestone: rc
: ---
Assignee: candlepin-bugs
QA Contact: Red Hat subscription-manager QE Team
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2023-05-03 15:59 UTC by Benjamin Kielhold
Modified: 2023-09-22 14:11 UTC (History)
3 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2023-09-22 14:11:50 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   RHEL-7196 0 None Migrated None 2023-09-22 14:11:45 UTC
Red Hat Issue Tracker RHELPLAN-156317 0 None None None 2023-05-03 16:00:58 UTC
Red Hat Issue Tracker RHELPLAN-156318 0 None None None 2023-05-03 16:01:00 UTC
Red Hat Knowledge Base (Solution) 7010986 0 None None None 2023-05-03 22:31:18 UTC

Description Benjamin Kielhold 2023-05-03 15:59:53 UTC
Description of problem:
-----------------------
Executing subscription-manager commands in relation to listing a long list of repositories piped to less on RHEL 7 or RHEL 8 with SCA enabled results with the following output if the user does not scroll to the end:


RHEL 8:
---

  # subscription-manager repos --list | less 
  Network error, unable to connect to server. Please see /var/log/rhsm/rhsm.log for more information.

  Checking /var/log/rhsm/rhsm.log, the following can be observed:
 ~~~
2023-05-03 11:34:54,608 [ERROR] subscription-manager:46708:MainThread @managercli.py:229 - exception caught in subscripti
on-manager
2023-05-03 11:34:54,608 [ERROR] subscription-manager:46708:MainThread @managercli.py:230 - [Errno 32] Broken pipe
Traceback (most recent call last):
  File "/usr/lib64/python3.6/site-packages/subscription_manager/managercli.py", line 546, in main
    return_code = self._do_command()
  File "/usr/lib64/python3.6/site-packages/subscription_manager/managercli.py", line 3018, in _do_command
    repo["enabled"]) + "\n")
BrokenPipeError: [Errno 32] Broken pipe
 ~~~

RHEL 7:
---

  # subscription-manager repos --list | less

 ~~~
Traceback (most recent call last):
  File "/usr/sbin/subscription-manager", line 9, in <module>
    load_entry_point('subscription-manager==1.24.51', 'console_scripts', 'subscription-manager')()
  File "/usr/lib64/python2.7/site-packages/subscription_manager/scripts/subscription_manager.py", line 86, in main
    return managercli.ManagerCLI().main()
  File "/usr/lib64/python2.7/site-packages/subscription_manager/managercli.py", line 3070, in main
    ret = CLI.main(self)
  File "/usr/lib64/python2.7/site-packages/subscription_manager/cli.py", line 183, in main
    return cmd.main()
  File "/usr/lib64/python2.7/site-packages/subscription_manager/managercli.py", line 545, in main
    return_code = self._do_command()
  File "/usr/lib64/python2.7/site-packages/subscription_manager/managercli.py", line 2397, in _do_command
    repo["enabled"]) + "\n")
IOError: [Errno 32] Broken pipe

 ~~~

Version-Release number of selected component (if applicable):
---
Red Hat Enterprise Linux release 8.7
subscription-manager-1.28.32-1.el8.x86_64

Red Hat Enterprise Linux Server release 7.9
subscription-manager-1.24.51-1.el7_9.x86_64

How reproducible:
100%


Steps to Reproduce:
---
1. On a RHEL 7 or RHEL 8 server that is using subscription-manager, execute subscription-manager command piped to less that would provide a long output.

2. Exit the less early with minimal scrolling and/or none

3. Output will be presented to the user like the examples provided above



Expected results:
---
Expect if subscription-manager command is piped to less that it would close correctly and not provide a `Network error` or `Broken pipe` output.

Comment 1 Pino Toscano 2023-05-04 07:33:06 UTC
Hello,

thanks for your report, improvements on error messaging is definitely something we always want to improve.

As result of bug 1971995 in 8.8, the reported message for this situation is now the following:

  # LANG=C subscription-manager repos | less
  Connection error: Broken pipe (error code 32)

the "connection error" prefix is there because the Python exception for this (i.e. BrokenPipeError) is a subclass of ConnectionError, which represents all the connection-related issues, and as such is considered a network error. In this case it is not a network error, as the issue is that stdout is closed, and thus print() fails; the problem is that BrokenPipeError can be raisen also during network communication, and at the moment we have no way to distinguish the two situations.

That said: regardless of the "connection error" prefix, I think the (new) behaviour of printing "Broken pipe" is correct, considering what is happening; I remember "classic" Unix tools (e.g. tar) also erroring out with "broken pipe" on the same situation in the (distant?) past, although I cannot reproduce it anymore on a Fedora 38 system. If we have a way to distinguish BrokenPipeError because of socket/network issues rather than print() failing because of a closed stdout, then this could be easily done.

Comment 4 RHEL Program Management 2023-09-22 14:11:18 UTC
Issue migration from Bugzilla to Jira is in process at this time. This will be the last message in Jira copied from the Bugzilla bug.

Comment 5 RHEL Program Management 2023-09-22 14:11:50 UTC
This BZ has been automatically migrated to the issues.redhat.com Red Hat Issue Tracker. All future work related to this report will be managed there.

Due to differences in account names between systems, some fields were not replicated.  Be sure to add yourself to Jira issue's "Watchers" field to continue receiving updates and add others to the "Need Info From" field to continue requesting information.

To find the migrated issue, look in the "Links" section for a direct link to the new issue location. The issue key will have an icon of 2 footprints next to it, and begin with "RHEL-" followed by an integer.  You can also find this issue by visiting https://issues.redhat.com/issues/?jql= and searching the "Bugzilla Bug" field for this BZ's number, e.g. a search like:

"Bugzilla Bug" = 1234567

In the event you have trouble locating or viewing this issue, you can file an issue by sending mail to rh-issues. You can also visit https://access.redhat.com/articles/7032570 for general account information.


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