diff options
author | markj <markj@FreeBSD.org> | 2017-07-26 17:36:58 +0000 |
---|---|---|
committer | markj <markj@FreeBSD.org> | 2017-07-26 17:36:58 +0000 |
commit | 3f187517a99cbc5df9cff8d76850412a7154684e (patch) | |
tree | 01bf4e615dbd7c79c0a12ae42120b3891ed4a056 /usr.sbin | |
parent | 178d676339ea9d88cf42000c2704089cdab356b6 (diff) | |
download | FreeBSD-src-3f187517a99cbc5df9cff8d76850412a7154684e.zip FreeBSD-src-3f187517a99cbc5df9cff8d76850412a7154684e.tar.gz |
MFC r321228:
Allow matches of truncated version strings.
Diffstat (limited to 'usr.sbin')
-rwxr-xr-x | usr.sbin/crashinfo/crashinfo.sh | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/usr.sbin/crashinfo/crashinfo.sh b/usr.sbin/crashinfo/crashinfo.sh index 24bd180..14021d9 100755 --- a/usr.sbin/crashinfo/crashinfo.sh +++ b/usr.sbin/crashinfo/crashinfo.sh @@ -69,10 +69,12 @@ find_kernel() } }' $INFO) - # Look for a matching kernel version. + # Look for a matching kernel version, handling possible truncation + # of the version string recovered from the dump. for k in `sysctl -n kern.bootfile` $(ls -t /boot/*/kernel); do - kvers=$(gdb_command $k 'printf " Version String: %s", version' \ - 2>/dev/null) + kvers=$(gdb_command $k 'printf " Version String: %s", version' | \ + awk "{line=line\$0\"\n\"} END{print substr(line,1,${#ivers})}" \ + 2>/dev/null) if [ "$ivers" = "$kvers" ]; then KERNEL=$k break |