Bug 2192940
| Summary: | subscription-manager commands that list a large amount of repositories piped to less outputs an error but completes | ||
|---|---|---|---|
| Product: | Red Hat Enterprise Linux 8 | Reporter: | Benjamin Kielhold <bkielhol> |
| Component: | subscription-manager | Assignee: | candlepin-bugs |
| Status: | CLOSED MIGRATED | QA Contact: | Red Hat subscription-manager QE Team <rhsm-qe> |
| Severity: | low | Docs Contact: | |
| Priority: | medium | ||
| Version: | --- | CC: | ptoscano, redakkan, wpinheir |
| Target Milestone: | rc | Keywords: | MigratedToJIRA, Triaged |
| Target Release: | --- | Flags: | pm-rhel:
mirror+
|
| Hardware: | Unspecified | ||
| OS: | Unspecified | ||
| Whiteboard: | |||
| Fixed In Version: | Doc Type: | If docs needed, set a value | |
| Doc Text: | Story Points: | --- | |
| Clone Of: | Environment: | ||
| Last Closed: | 2023-09-22 14:11:50 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: | |||
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. 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. 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. |
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.