File s390-tools-sles11sp2-dbginfo-fix-kernel-version-checks.patch of Package s390-tools
Description: dbginfo.sh: does not run under kernel 3.x
Symptom: 1. The dbginfo.sh script does not run under kernel 3.x and debug
data is not collected properly.
2. In case of invalid options dbginfo.sh returns 0 instead of 1
Problem: 1. Kernel version checks are incomplete.
2. In case of invalid options dbginfo.sh returns 0.
Solution: 1. Adjusted kernel version checks for new version 3.x.
2. In case of invalid options dbginfo.sh returns now 1
Problem-ID: 75088
---
scripts/dbginfo.sh | 19 ++++++++++++-------
1 file changed, 12 insertions(+), 7 deletions(-)
--- a/scripts/dbginfo.sh
+++ b/scripts/dbginfo.sh
@@ -320,7 +320,8 @@ check_cmdline()
echo
echo "$SCRIPTNAME: invalid option $1"
echo "Try '$SCRIPTNAME --help' for more information"
- echo
+ echo
+ exit 1
fi
exit 0
elif [[ $# -ge 1 ]]
@@ -416,8 +417,10 @@ collect_sysfs()
# check if debugfs is mounted
mount | grep -q $MOUNT_POINT_DEBUGFS
rc_mount=$?
- if [ $rc_mount -eq 1 ] && [ $kernel_version_tmp -ge 13 ]; then
- mount -t debugfs debugfs $MOUNT_POINT_DEBUGFS
+ if [ $rc_mount -eq 1 ]; then
+ if [ $kernel_version_tmp -ge 13 ] || [ "${kernel_version:0:1}" \> 2 ] ; then
+ mount -t debugfs debugfs $MOUNT_POINT_DEBUGFS
+ fi
fi
echo "Get file list of /sys" | tee -a $LOGFILE
@@ -437,8 +440,10 @@ collect_sysfs()
fi
done
#unmount debugfs if not mounted at the beginning
- if [ $rc_mount -eq 1 ] && [ $kernel_version_tmp -ge 13 ]; then
- umount $MOUNT_POINT_DEBUGFS
+ if [ $rc_mount -eq 1 ]; then
+ if [ $kernel_version_tmp -ge 13 ] || [ "${kernel_version:0:1}" \> 2 ] ; then
+ umount $MOUNT_POINT_DEBUGFS
+ fi
fi
}
@@ -623,13 +628,13 @@ kernel_version_tmp=`echo ${kernel_versio
check_cmdline $*
prepare_workdir
printversion >$LOGFILE
-if [ $kernel_version_tmp -lt 13 ]
+if [ $kernel_version_tmp -lt 13 ] && [ "${kernel_version:0:1}" \< 3 ]
then
collect_s390dbf
fi
collect_procfs $PROCFILES
collect_cmdsout "$CMDS" "$CMDOUTPUT"
-if [ "${kernel_version:2:1}" \> 4 ]
+if [ "${kernel_version:2:1}" \> 4 ] || [ "${kernel_version:0:1}" \> 2 ]
then
collect_sysfs
else