From owner-svn-src-all@freebsd.org Mon Jul 17 17:33:26 2017 Return-Path: Delivered-To: svn-src-all@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 E7E45D9B415; Mon, 17 Jul 2017 17:33:26 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from mail.baldwin.cx (bigwig.baldwin.cx [IPv6:2001:470:1f11:75::1]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id C5B6C68BDF; Mon, 17 Jul 2017 17:33:26 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from ralph.baldwin.cx (c-73-231-226-104.hsd1.ca.comcast.net [73.231.226.104]) by mail.baldwin.cx (Postfix) with ESMTPSA id 4D4FF10AF09; Mon, 17 Jul 2017 13:33:25 -0400 (EDT) From: John Baldwin To: Mark Johnston Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r320918 - head/sbin/savecore Date: Mon, 17 Jul 2017 09:48:53 -0700 Message-ID: <7394656.HeKS8RJobr@ralph.baldwin.cx> User-Agent: KMail/4.14.10 (FreeBSD/11.0-STABLE; KDE/4.14.10; amd64; ; ) In-Reply-To: <20170712234108.GA48612@wkstn-mjohnston.west.isilon.com> References: <201707121829.v6CITPxG012102@repo.freebsd.org> <1930640.IHpqZ2aWqS@ralph.baldwin.cx> <20170712234108.GA48612@wkstn-mjohnston.west.isilon.com> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.4.3 (mail.baldwin.cx); Mon, 17 Jul 2017 13:33:25 -0400 (EDT) X-Virus-Scanned: clamav-milter 0.99.2 at mail.baldwin.cx X-Virus-Status: Clean X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 17 Jul 2017 17:33:27 -0000 On Wednesday, July 12, 2017 04:41:09 PM Mark Johnston wrote: > On Wed, Jul 12, 2017 at 02:23:52PM -0700, John Baldwin wrote: > > On Wednesday, July 12, 2017 06:29:25 PM Mark Johnston wrote: > > > Author: markj > > > Date: Wed Jul 12 18:29:25 2017 > > > New Revision: 320918 > > > URL: https://svnweb.freebsd.org/changeset/base/320918 > > > > > > Log: > > > Add a newline after the version string. > > > > > > MFC after: 3 days > > > > I think the version string normally has a trailing \n emedded in it? > > You're right. The problem in my case is that the version string is > getting truncated in mkdumpheader(), and so the trailing \n is omitted. > > > Also, > > have you verified that crashinfo is still able to match the Version String > > from the generated info.X file? I think it might as it stops printing lines > > once it matches the second line of the version, so I think (just reading the > > awk) that it will not include the extra newline in the 'ivers' compared > > against 'version' from gdb. > > That's true, but it looks like it doesn't work properly in the truncated > case. What if we declare a match when the version string in the info.X > file matches a prefix of the version string reported by gdb? Sorry I didn't reply earlier. I think the patch below for crashinfo is fine (but have not tested it myself): > diff --git a/usr.sbin/crashinfo/crashinfo.sh b/usr.sbin/crashinfo/crashinfo.sh > index e52c01419b0d..b3029c6eea4a 100755 > --- a/usr.sbin/crashinfo/crashinfo.sh > +++ b/usr.sbin/crashinfo/crashinfo.sh > @@ -85,8 +85,9 @@ find_kernel() > > # Look for a matching kernel version. > 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 > -- John Baldwin