svn commit: r321569 - stable/11/usr.sbin/crashinfo

Mark Johnston markj at FreeBSD.org
Wed Jul 26 17:36:59 UTC 2017


Author: markj
Date: Wed Jul 26 17:36:58 2017
New Revision: 321569
URL: https://svnweb.freebsd.org/changeset/base/321569

Log:
  MFC r321228:
  Allow matches of truncated version strings.

Modified:
  stable/11/usr.sbin/crashinfo/crashinfo.sh
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/usr.sbin/crashinfo/crashinfo.sh
==============================================================================
--- stable/11/usr.sbin/crashinfo/crashinfo.sh	Wed Jul 26 17:36:30 2017	(r321568)
+++ stable/11/usr.sbin/crashinfo/crashinfo.sh	Wed Jul 26 17:36:58 2017	(r321569)
@@ -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


More information about the svn-src-all mailing list