1
0
forked from rpms/sos
sos/sos-bz766583-allow-nonroot-symlinks.patch
Bryn M. Reeves 13178ca5fa Update sos to 2.2-29
This synchronises sos in master to the current upstream sos-2.2 branch and
includes all patches from RHEL6 not already present.
2012-06-22 12:16:21 +01:00

261 lines
15 KiB
Diff

diff -up sos-2.2/sos/plugins/devicemapper.py.orig sos-2.2/sos/plugins/devicemapper.py
--- sos-2.2/sos/plugins/devicemapper.py.orig 2012-03-06 14:23:24.361570691 +0000
+++ sos-2.2/sos/plugins/devicemapper.py 2012-03-06 14:23:27.535570770 +0000
@@ -34,7 +34,7 @@ class devicemapper(sos.plugintools.Plugi
self.collectExtOutput("/sbin/dmsetup status")
self.collectExtOutput("/sbin/dmsetup ls --tree")
- self.collectExtOutput("/sbin/vgdisplay -vv", root_symlink = "vgdisplay")
+ self.collectExtOutput("/sbin/vgdisplay -vv", symlink = "vgdisplay")
self.collectExtOutput("/sbin/vgscan -vvv")
self.collectExtOutput("/sbin/pvscan -v")
self.collectExtOutput("/sbin/lvs -a -o +devices")
diff -up sos-2.2/sos/plugins/filesys.py.orig sos-2.2/sos/plugins/filesys.py
--- sos-2.2/sos/plugins/filesys.py.orig 2012-03-06 14:23:24.364570691 +0000
+++ sos-2.2/sos/plugins/filesys.py 2012-03-06 14:23:27.536570767 +0000
@@ -30,12 +30,12 @@ class filesys(sos.plugintools.PluginBase
self.addCopySpec("/proc/mounts")
self.addCopySpec("/proc/mdstat")
self.addCopySpec("/etc/raidtab")
- mounts = self.collectOutputNow("/bin/mount -l", root_symlink = "mount")
+ mounts = self.collectOutputNow("/bin/mount -l", symlink = "mount")
self.addCopySpec("/etc/mdadm.conf")
- self.collectExtOutput("/bin/df -al", root_symlink = "df")
+ self.collectExtOutput("/bin/df -al", symlink = "df")
if self.getOption('lsof'):
- self.collectExtOutput("/usr/sbin/lsof -b +M -n -l -P", root_symlink = "lsof")
+ self.collectExtOutput("/usr/sbin/lsof -b +M -n -l -P", symlink = "lsof")
self.collectExtOutput("/sbin/blkid -c /dev/null")
self.collectExtOutput("/bin/lsblk")
diff -up sos-2.2/sos/plugins/general.py.orig sos-2.2/sos/plugins/general.py
--- sos-2.2/sos/plugins/general.py.orig 2012-03-06 14:23:24.366570691 +0000
+++ sos-2.2/sos/plugins/general.py 2012-03-06 14:23:27.536570767 +0000
@@ -43,12 +43,12 @@ class general(sos.plugintools.PluginBase
self.addCopySpec("/var/log/pm/suspend.log")
self.addCopySpec("/var/log/up2date")
self.addCopySpec("/etc/exports")
- self.collectExtOutput("/bin/hostname", root_symlink = "hostname")
- self.collectExtOutput("/bin/date", root_symlink = "date")
- self.collectExtOutput("/usr/bin/uptime", root_symlink = "uptime")
+ self.collectExtOutput("/bin/hostname", symlink = "hostname")
+ self.collectExtOutput("/bin/date", symlink = "date")
+ self.collectExtOutput("/usr/bin/uptime", symlink = "uptime")
self.collectExtOutput("/bin/dmesg")
self.addCopySpec("/root/anaconda-ks.cfg")
- self.collectExtOutput("/usr/sbin/alternatives --display java", root_symlink = "java")
+ self.collectExtOutput("/usr/sbin/alternatives --display java", symlink = "java")
self.collectExtOutput("/usr/bin/readlink -f /usr/bin/java")
# new entitlement certificate support
diff -up sos-2.2/sos/plugins/hardware.py.orig sos-2.2/sos/plugins/hardware.py
--- sos-2.2/sos/plugins/hardware.py.orig 2012-03-06 14:23:24.368570691 +0000
+++ sos-2.2/sos/plugins/hardware.py 2012-03-06 14:23:27.537570765 +0000
@@ -38,9 +38,9 @@ class hardware(sos.plugintools.PluginBas
self.addCopySpec("/sys/bus/scsi")
self.addCopySpec("/sys/state")
self.collectExtOutput("python /usr/share/rhn/up2date_client/hardware.py", suggest_filename="hardware.py")
- self.collectExtOutput("""/bin/echo -e "lspci:\n" ; /sbin/lspci ; /bin/echo -e "\nlspci -nvv:\n" ; /sbin/lspci -nvv ; /bin/echo -e "\nlspci -tv:\n" ; /sbin/lspci -tv""", suggest_filename = "lspci", root_symlink = "lspci")
+ self.collectExtOutput("""/bin/echo -e "lspci:\n" ; /sbin/lspci ; /bin/echo -e "\nlspci -nvv:\n" ; /sbin/lspci -nvv ; /bin/echo -e "\nlspci -tv:\n" ; /sbin/lspci -tv""", suggest_filename = "lspci", symlink = "lspci")
- self.collectExtOutput("/usr/sbin/dmidecode", root_symlink = "dmidecode")
+ self.collectExtOutput("/usr/sbin/dmidecode", symlink = "dmidecode")
self.collectExtOutput("/usr/bin/cpufreq-info")
if self.policy().getArch().endswith("386"):
diff -up sos-2.2/sos/plugins/kernel.py.orig sos-2.2/sos/plugins/kernel.py
--- sos-2.2/sos/plugins/kernel.py.orig 2012-03-06 14:23:24.371570691 +0000
+++ sos-2.2/sos/plugins/kernel.py 2012-03-06 14:23:27.537570765 +0000
@@ -41,8 +41,8 @@ class kernel(sos.plugintools.PluginBase)
]
def setup(self):
- self.collectExtOutput("/bin/uname -a", root_symlink = "uname")
- self.moduleFile = self.collectOutputNow("/sbin/lsmod", root_symlink = "lsmod")
+ self.collectExtOutput("/bin/uname -a", symlink = "uname")
+ self.moduleFile = self.collectOutputNow("/sbin/lsmod", symlink = "lsmod")
if self.getOption('modinfo'):
runcmd = ""
diff -up sos-2.2/sos/plugins/lsbrelease.py.orig sos-2.2/sos/plugins/lsbrelease.py
--- sos-2.2/sos/plugins/lsbrelease.py.orig 2012-03-06 14:23:24.373570691 +0000
+++ sos-2.2/sos/plugins/lsbrelease.py 2012-03-06 14:23:27.538570762 +0000
@@ -25,6 +25,6 @@ class lsbrelease(sos.plugintools.PluginB
return
def setup(self):
self.collectExtOutput("/usr/bin/lsb_release -a")
- self.collectExtOutput("/usr/bin/lsb_release -d", suggest_filename = "lsb_release", root_symlink = "lsb-release")
+ self.collectExtOutput("/usr/bin/lsb_release -d", suggest_filename = "lsb_release", symlink = "lsb-release")
self.addCopySpec("/etc/lsb-release*")
return
diff -up sos-2.2/sos/plugins/memory.py.orig sos-2.2/sos/plugins/memory.py
--- sos-2.2/sos/plugins/memory.py.orig 2012-03-06 14:23:24.375570691 +0000
+++ sos-2.2/sos/plugins/memory.py 2012-03-06 14:23:27.538570762 +0000
@@ -24,7 +24,7 @@ class memory(sos.plugintools.PluginBase)
self.addCopySpec("/proc/slabinfo")
self.collectExtOutput("/bin/dmesg | grep -e 'e820.' -e 'aperature.'")
- self.collectExtOutput("/usr/bin/free", root_symlink = "free")
+ self.collectExtOutput("/usr/bin/free", symlink = "free")
self.collectExtOutput("/usr/bin/free -m")
return
diff -up sos-2.2/sos/plugins/networking.py.orig sos-2.2/sos/plugins/networking.py
--- sos-2.2/sos/plugins/networking.py.orig 2012-03-06 14:23:24.378570691 +0000
+++ sos-2.2/sos/plugins/networking.py 2012-03-06 14:23:27.539570760 +0000
@@ -66,14 +66,14 @@ class networking(sos.plugintools.PluginB
self.addCopySpec("/etc/xinetd.d")
self.addCopySpec("/etc/host*")
self.addCopySpec("/etc/resolv.conf")
- ifconfigFile=self.collectOutputNow("/sbin/ifconfig -a", root_symlink = "ifconfig")
- self.collectExtOutput("/sbin/route -n", root_symlink = "route")
+ ifconfigFile=self.collectOutputNow("/sbin/ifconfig -a", symlink = "ifconfig")
+ self.collectExtOutput("/sbin/route -n", symlink = "route")
self.collectIPTable("filter")
self.collectIPTable("nat")
self.collectIPTable("mangle")
self.collectExtOutput("/bin/netstat -s")
self.collectExtOutput("/bin/netstat -agn")
- self.collectExtOutput("/bin/netstat -neopa", root_symlink = "netstat")
+ self.collectExtOutput("/bin/netstat -neopa", symlink = "netstat")
self.collectExtOutput("/sbin/ip route show table all")
self.collectExtOutput("/sbin/ip link")
self.collectExtOutput("/sbin/ip address")
diff -up sos-2.2/sos/plugins/process.py.orig sos-2.2/sos/plugins/process.py
--- sos-2.2/sos/plugins/process.py.orig 2012-03-06 14:23:24.380570691 +0000
+++ sos-2.2/sos/plugins/process.py 2012-03-06 14:23:27.539570760 +0000
@@ -20,11 +20,11 @@ class process(sos.plugintools.PluginBase
"""process information
"""
def setup(self):
- self.collectExtOutput("/bin/ps auxwww", root_symlink = "ps")
+ self.collectExtOutput("/bin/ps auxwww", symlink = "ps")
self.collectExtOutput("/bin/ps auxwwwm")
self.collectExtOutput("/bin/ps alxwww")
- self.collectExtOutput("/usr/bin/pstree", root_symlink = "pstree")
- self.collectExtOutput("/usr/sbin/lsof -b +M -n -l", root_symlink = "lsof")
+ self.collectExtOutput("/usr/bin/pstree", symlink = "pstree")
+ self.collectExtOutput("/usr/sbin/lsof -b +M -n -l", symlink = "lsof")
return
def find_mountpoint(s):
diff -up sos-2.2/sos/plugins/rhn.py.orig sos-2.2/sos/plugins/rhn.py
--- sos-2.2/sos/plugins/rhn.py.orig 2012-03-06 14:23:24.383570691 +0000
+++ sos-2.2/sos/plugins/rhn.py 2012-03-06 14:23:27.540570760 +0000
@@ -64,9 +64,9 @@ class rhn(sos.plugintools.PluginBase):
self.addCopySpec("/var/log/nocpulse/TSDBLocalQueue/TSDBLocalQueue.log")
self.addCopySpec("/root/ssl-build")
- self.collectExtOutput("rpm -qa --last", root_symlink = "rpm-manifest")
- self.collectExtOutput("/usr/bin/rhn-schema-version", root_symlink = "database-schema-version")
- self.collectExtOutput("/usr/bin/rhn-charsets", root_symlink = "database-character-sets")
+ self.collectExtOutput("rpm -qa --last", symlink = "rpm-manifest")
+ self.collectExtOutput("/usr/bin/rhn-schema-version", symlink = "database-schema-version")
+ self.collectExtOutput("/usr/bin/rhn-charsets", symlink = "database-character-sets")
if self.satellite:
self.addCopySpec("/etc/tnsnames.ora")
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-03-06 14:23:24.385570691 +0000
+++ sos-2.2/sos/plugins/rpm.py 2012-03-06 14:23:27.540570760 +0000
@@ -24,9 +24,9 @@ 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", root_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", root_symlink = "rpm-Va", timeout = 3600)
+ self.collectExtOutput("/bin/rpm -Va", symlink = "rpm-Va", timeout = 3600)
return
diff -up sos-2.2/sos/plugins/sar.py.orig sos-2.2/sos/plugins/sar.py
--- sos-2.2/sos/plugins/sar.py.orig 2012-03-06 14:23:24.387570691 +0000
+++ sos-2.2/sos/plugins/sar.py 2012-03-06 14:23:27.540570760 +0000
@@ -27,7 +27,7 @@ class sar(sos.plugintools.PluginBase):
sar_filename = 'sar' + fname[2:4]
if sar_filename not in dirList:
sar_command = "/bin/sh -c \"LANG=C /usr/bin/sar -A -f /var/log/sa/" + fname + "\""
- self.collectOutputNow(sar_command, sar_filename, root_symlink=sar_filename)
+ self.collectOutputNow(sar_command, sar_filename, symlink=sar_filename)
return
def checkenabled(self):
diff -up sos-2.2/sos/plugins/selinux.py.orig sos-2.2/sos/plugins/selinux.py
--- sos-2.2/sos/plugins/selinux.py.orig 2012-03-06 14:23:24.389570691 +0000
+++ sos-2.2/sos/plugins/selinux.py 2012-03-06 14:23:27.540570760 +0000
@@ -31,7 +31,7 @@ class selinux(sos.plugintools.PluginBase
def checkenabled(self):
# is selinux enabled ?
try:
- if self.collectOutputNow("/usr/sbin/sestatus", root_symlink = "sestatus").split(":")[1].strip() == "disabled":
+ if self.collectOutputNow("/usr/sbin/sestatus", symlink = "sestatus").split(":")[1].strip() == "disabled":
return False
except:
pass
diff -up sos-2.2/sos/plugins/startup.py.orig sos-2.2/sos/plugins/startup.py
--- sos-2.2/sos/plugins/startup.py.orig 2012-03-06 14:23:24.392570691 +0000
+++ sos-2.2/sos/plugins/startup.py 2012-03-06 14:23:27.541570762 +0000
@@ -22,7 +22,7 @@ class startup(sos.plugintools.PluginBase
def setup(self):
self.addCopySpec("/etc/rc.d")
- self.collectExtOutput("/sbin/chkconfig --list", root_symlink = "chkconfig")
+ self.collectExtOutput("/sbin/chkconfig --list", symlink = "chkconfig")
if self.getOption('servicestatus'):
self.collectExtOutput("/sbin/service --status-all")
self.collectExtOutput("/sbin/runlevel")
diff -up sos-2.2/sos/plugintools.py.orig sos-2.2/sos/plugintools.py
--- sos-2.2/sos/plugintools.py.orig 2012-03-06 14:23:19.578570582 +0000
+++ sos-2.2/sos/plugintools.py 2012-03-06 14:23:27.541570762 +0000
@@ -302,7 +302,7 @@ class PluginBase:
# ensuring we get at least some logs
if flog == files[0] and limit_reached:
self.collectExtOutput("tail -c%d %s" % (sizelimit, flog),
- "tail_" + os.path.basename(flog))
+ "tail_" + os.path.basename(flog), flog[1:])
def addCopySpec(self, copyspec):
""" Add a file specification (can be file, dir,or shell glob) to be
@@ -324,11 +324,11 @@ class PluginBase:
status, shout, runtime = sosGetCommandOutput(prog)
return (status, shout, runtime)
- def collectExtOutput(self, exe, suggest_filename = None, root_symlink = None, timeout = 300):
+ def collectExtOutput(self, exe, suggest_filename = None, symlink = None, timeout = 300):
"""
Run a program and collect the output
"""
- self.collectProgs.append( (exe, suggest_filename, root_symlink, timeout) )
+ self.collectProgs.append( (exe, suggest_filename, symlink, timeout) )
def fileGrep(self, regexp, fname):
try:
@@ -360,7 +360,7 @@ class PluginBase:
return outfn
- def collectOutputNow(self, exe, suggest_filename = None, root_symlink = False, timeout = 300):
+ def collectOutputNow(self, exe, suggest_filename = None, symlink = False, timeout = 300):
""" Execute a command and save the output to a file for inclusion in
the report
"""
@@ -385,11 +385,13 @@ class PluginBase:
outfd.write(shout+"\n")
outfd.close()
- if root_symlink:
+ if symlink:
+ dst_from_root = outfn[len(self.cInfo['dstroot'])+1:]
+ target = ("../" * string.count(symlink, "/")) + dst_from_root
curdir = os.getcwd()
os.chdir(self.cInfo['dstroot'])
try:
- os.symlink(outfn[len(self.cInfo['dstroot'])+1:], root_symlink.strip("/."))
+ os.symlink(target, symlink.strip("/."))
except:
pass
os.chdir(curdir)