| Summary: | subscription-manager masks SIGPIPE when running virt-what, resulting in errors in shell commands | ||||||||
|---|---|---|---|---|---|---|---|---|---|
| Product: | Red Hat Enterprise Linux 6 | Reporter: | Chris Duryee <cduryee> | ||||||
| Component: | subscription-manager | Assignee: | Chris Duryee <cduryee> | ||||||
| Status: | CLOSED ERRATA | QA Contact: | John Sefler <jsefler> | ||||||
| Severity: | high | Docs Contact: | |||||||
| Priority: | high | ||||||||
| Version: | 6.1 | CC: | bkearney, francisco_javier.pena, meyering, mkhusid, rjones, syeghiay | ||||||
| Target Milestone: | rc | ||||||||
| Target Release: | --- | ||||||||
| Hardware: | Unspecified | ||||||||
| OS: | Unspecified | ||||||||
| Whiteboard: | |||||||||
| Fixed In Version: | Doc Type: | Bug Fix | |||||||
| Doc Text: | Story Points: | --- | |||||||
| Clone Of: | 680935 | Environment: | |||||||
| Last Closed: | 2011-05-19 13:39:58 UTC | Type: | --- | ||||||
| Regression: | --- | Mount Type: | --- | ||||||
| Documentation: | --- | CRM: | |||||||
| Verified Versions: | Category: | --- | |||||||
| oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | |||||||
| Cloudforms Team: | --- | Target Upstream Version: | |||||||
| Bug Depends On: | |||||||||
| Bug Blocks: | 568421 | ||||||||
| Attachments: |
|
||||||||
|
Description
Chris Duryee
2011-03-03 15:46:19 UTC
Grep is returning before the echo is done sending data, causing the broken pipe for some users in certain cases. virt-what uses "grep -q $FOO", but it should likely be using "grep $FOO 2>&1 /dev/null" instead. From the grep man page: Portable shell scripts should avoid both -q and -s and should redirect standard and error output to /dev/null instead. (In reply to comment #2) > Grep is returning before the echo is done sending data, causing the broken pipe > for some users in certain cases. > > virt-what uses "grep -q $FOO", but it should likely be using "grep $FOO 2>&1 > /dev/null" instead. > > From the grep man page: > > Portable shell scripts should avoid both -q and -s and should redirect > standard and error output to /dev/null instead. Interesting thanks. This bug is flagged for 6.1 which would make it very urgent. Are these flags correct? If this is something that very few users would encounter then I'd prefer to bump it to 6.2. Here's some more info about the bug incidence/severity: To my knowledge, one developer ran into it on a vmware vm, and a user also reported it during the entitlement beta (again, on vmware). I was unable to reproduce it locally, but it appears that if someone does get the error, they will get it consistently. The error doesn't cause any break in functionality, since the grep already finished up and returned the appropriate value. Let me know if you need more info for 6.1 vs 6.2 triaging. (In reply to comment #5) > oddly enough, it works fine if I call it by itself: > [root@ice ~]# virt-what > vmware > [root@ice ~]# > But it looks like when subscription manager calls it, it chokes. Thought: Is subscription manager leaking the SIGPIPE ignore mask across the fork? Created attachment 483155 [details]
test.sh
I'm fairly sure this is down to a bug in subscription
manager itself, leaking an incorrect SIGPIPE mask to the
child process (ie virt-what).
As an example of what I mean, take a look at the attached
shell script.
If you run this shell script from a normal shell, it won't
print anything:
$ ./test.sh
But if you run this script with an incorrect SIGPIPE mask
you will see the same error in grep:
$ perl -e '$SIG{PIPE}="IGNORE"; system("./test.sh")'
./test.sh: line 12: echo: write error: Broken pipe
Is the source for subscription-manager available somewhere
that I can take a look?
Created attachment 483159 [details] hwprobe.patch Turns out this is a misfeature of Python itself, see: http://bugs.python.org/issue1652 You could try the attached *untested* patch against subscription-manager. It works by setting the signal handler back to the default around the exec of virt-what. Thanks Richard! Fixed in rhel6 0.95.5+ 997bf58a829fc13e5eb92d3515cd053f8d0244ae fixed in master 0.96.2+ b5adbdd Note that it's difficult to replicate this issue inside of subscription-manager, we've been relying on test cases with mock code. It might be best to just do a no-break test for this, but just let me know on IRC if you want to try to set up a test. An advisory has been issued which should help the problem described in this bug report. This report is therefore being closed with a resolution of ERRATA. For more information on therefore solution and/or where to find the updated files, please follow the link below. You may reopen this bug report if the solution does not work for you. http://rhn.redhat.com/errata/RHEA-2011-0611.html |