Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 17 Jul 2017 09:48:53 -0700
From:      John Baldwin <jhb@freebsd.org>
To:        Mark Johnston <markj@freebsd.org>
Cc:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   Re: svn commit: r320918 - head/sbin/savecore
Message-ID:  <7394656.HeKS8RJobr@ralph.baldwin.cx>
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>

next in thread | previous in thread | raw e-mail | index | archive | help
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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?7394656.HeKS8RJobr>