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 821005 - Error message when running the rpm plugin on sosreport
Summary: Error message when running the rpm plugin on sosreport
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 6
Classification: Red Hat
Component: sos
Version: 6.2
Hardware: All
OS: Linux
unspecified
low
Target Milestone: rc
: ---
Assignee: Bryn M. Reeves
QA Contact: David Kutálek
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2012-05-11 14:32 UTC by Thias
Modified: 2013-02-21 10:57 UTC (History)
4 users (show)

Fixed In Version: sos-2.2-30.el6
Doc Type: Bug Fix
Doc Text:
Cause: Previous versions of sos passed an unescaped '~~' (double tilde) character sequence to a command executed by the system shell. Consequence: On some systems expansion of the '~~' sequence results in an error written to syslog when the shell's home directory expansion attempts a lookup for an account named '~', Fix: The sequence is now correctly double-quoted to disable shell expansion of the string. Result: No spurious account lookup or log message is triggered.
Clone Of:
Environment:
Last Closed: 2013-02-21 10:57:17 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2013:0474 0 normal SHIPPED_LIVE sos bug fix and enhancement update 2013-02-20 21:06:54 UTC

Description Thias 2012-05-11 14:32:43 UTC
Description of problem: 
An error message is rised in the logs when sosreport is run: nslcd[27628]: [364d9d] nslcd_passwd_byname(~): invalid user name

Version-Release number of selected component (if applicable):
yum list | grep sos
sos.noarch                          2.2-17.el6_2.3          @rhel-x86_64-server-6

How reproducible:
This happens every time the sosreport is run (with rpm plugin enabled, and nslcd installed - ldap authentication)

Steps to Reproduce:
1. run sosreport -o rpm
2.
3.
  
Actual results:
May 11 15:33:04 srvname nslcd[27628]: [364d9d] nslcd_passwd_byname(~): invalid user name
is logged in /var/log/messages

Expected results:
No error in /var/log/messages

Additional info:
This most likely comes from the /usr/lib/python2.6/site-packages/sos/plugins/rpm.py file containing:
            self.collectExtOutput("/bin/rpm -qa --qf=\"%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}~~%{INSTALLTIME:date}\n\" --nosignature --nodigest|/bin/awk -F ~~ '{printf \"%-60s%s\\n\",$1,$2}'|sort", root_symlink = "installed-rpms")

instead of

            self.collectExtOutput("/bin/rpm -qa --qf=\"%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}~~%{INSTALLTIME:date}\n\" --nosignature --nodigest|/bin/awk -F '~~' '{printf \"%-60s%s\\n\",$1,$2}'|sort", root_symlink = "installed-rpms")

Comment 2 Bryn M. Reeves 2012-05-11 15:40:39 UTC
Thanks for the report and analysis. You're correct - that unguarded tilde is being expanded by the shell. Since it does not expand to a valid user you get the log message.

It's a cosmetic problem but easily fixed and we should be able to get this into the next available release.

commit ee58ac651a264f5614196493f87b4cf0432f23a6
Author: Bryn M. Reeves <bmr>
Date:   Fri May 11 16:17:01 2012 +0100

    Commit changes for testing on private branch
    Resolves: bz821005

diff --git a/sos-bz821005-rpm-quote-tildes-defensively.patch b/sos-bz821005-rpm-quote-tildes-defensively.patch
new file mode 100644
index 0000000..5a2349d
--- /dev/null
+++ b/sos-bz821005-rpm-quote-tildes-defensively.patch
@@ -0,0 +1,12 @@
+diff -up sos-2.2/sos/plugins/rpm.py.orig sos-2.2/sos/plugins/rpm.py
+--- sos-2.2/sos/plugins/rpm.py.orig    2012-05-11 16:10:11.910118556 +0100
++++ sos-2.2/sos/plugins/rpm.py 2012-05-11 16:11:02.309416127 +0100
+@@ -24,7 +24,7 @@ class rpm(sos.plugintools.PluginBase):
+         self.addCopySpec("/var/log/rpmpkgs")
+ 
+         if self.getOption("rpmq"):
+-            self.collectExtOutput("/bin/rpm -qa --qf=\"%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}~~%{INSTALLTIME:date}\n\" --nosignature --nodigest|/bin/awk -F ~~ '{printf \"%-59s %s\\n\",$1,$2}'|sort", symlink = "installed-rpms")
++            self.collectExtOutput("/bin/rpm -qa --qf=\"%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}~~%{INSTALLTIME:date}\n\" --nosignature --nodigest|/bin/awk -F '~~' '{printf \"%-59s %s\\n\",$1,$2}'|sort", symlink = "installed-rpms")
+ 
+         if self.getOption("rpmva"):
+             self.collectExtOutput("/bin/rpm -Va", symlink = "rpm-Va", timeout = 3600)

I can make packages available for testing if you'd like to check that this resolves the problem for you.

Comment 3 Bryn M. Reeves 2012-05-11 16:16:54 UTC
Test packages are available here:

http://people.redhat.com/breeves/packages/sos/2.2/27.el6_3.1.bz821005/

Comment 4 RHEL Program Management 2012-05-15 04:04:26 UTC
This request was not resolved in time for the current release.
Red Hat invites you to ask your support representative to
propose this request, if still desired, for consideration in
the next release of Red Hat Enterprise Linux.

Comment 6 RHEL Program Management 2012-07-10 08:46:54 UTC
This request was not resolved in time for the current release.
Red Hat invites you to ask your support representative to
propose this request, if still desired, for consideration in
the next release of Red Hat Enterprise Linux.

Comment 7 RHEL Program Management 2012-07-11 01:58:30 UTC
This request was erroneously removed from consideration in Red Hat Enterprise Linux 6.4, which is currently under development.  This request will be evaluated for inclusion in Red Hat Enterprise Linux 6.4.

Comment 12 errata-xmlrpc 2013-02-21 10:57:17 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.

http://rhn.redhat.com/errata/RHBA-2013-0474.html


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