Hide Forgot
+++ This bug was initially created as a clone of Bug #680935 +++ There is a user report of subscription-manager having difficulty during fact gathering on vmware 7. > [root@ice ~]# subscription-manager register --username=foo > --password=Password --force > The system with UUID 76blah1d-d7c1-4f1d-blah-7a2blah32ff6 has been > unregistered > /usr/sbin/virt-what: line 87: echo: write error: Broken pipe running virt-what directly works fine.
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