From owner-svn-src-head@freebsd.org Wed Jul 19 18:41:17 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 907EACFF8E5; Wed, 19 Jul 2017 18:41:17 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 5FB03668D2; Wed, 19 Jul 2017 18:41:17 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v6JIfGg7078142; Wed, 19 Jul 2017 18:41:16 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6JIfGq6078141; Wed, 19 Jul 2017 18:41:16 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201707191841.v6JIfGq6078141@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Wed, 19 Jul 2017 18:41:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r321228 - head/usr.sbin/crashinfo X-SVN-Group: head X-SVN-Commit-Author: markj X-SVN-Commit-Paths: head/usr.sbin/crashinfo X-SVN-Commit-Revision: 321228 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 19 Jul 2017 18:41:17 -0000 Author: markj Date: Wed Jul 19 18:41:16 2017 New Revision: 321228 URL: https://svnweb.freebsd.org/changeset/base/321228 Log: Allow matches of truncated version strings. Long objdir paths make it easy to hit the version string length limit in kernel dump headers. The build number and timestamp are unlikely to be truncated and ought to be sufficient to protect against false positives. Discussed with: jhb MFC after: 1 week Modified: head/usr.sbin/crashinfo/crashinfo.sh Modified: head/usr.sbin/crashinfo/crashinfo.sh ============================================================================== --- head/usr.sbin/crashinfo/crashinfo.sh Wed Jul 19 18:30:16 2017 (r321227) +++ head/usr.sbin/crashinfo/crashinfo.sh Wed Jul 19 18:41:16 2017 (r321228) @@ -83,10 +83,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