From nobody@FreeBSD.org  Thu May  1 10:09:33 2014
Return-Path: <nobody@FreeBSD.org>
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1])
	(using TLSv1 with cipher ADH-AES256-SHA (256/256 bits))
	(No client certificate requested)
	by hub.freebsd.org (Postfix) with ESMTPS id 79439A84
	for <freebsd-gnats-submit@FreeBSD.org>; Thu,  1 May 2014 10:09:33 +0000 (UTC)
Received: from cgiserv.freebsd.org (cgiserv.freebsd.org [IPv6:2001:1900:2254:206a::50:4])
	(using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits))
	(Client did not present a certificate)
	by mx1.freebsd.org (Postfix) with ESMTPS id 672E3178D
	for <freebsd-gnats-submit@FreeBSD.org>; Thu,  1 May 2014 10:09:33 +0000 (UTC)
Received: from cgiserv.freebsd.org ([127.0.1.6])
	by cgiserv.freebsd.org (8.14.8/8.14.8) with ESMTP id s41A9X2B011899
	for <freebsd-gnats-submit@FreeBSD.org>; Thu, 1 May 2014 10:09:33 GMT
	(envelope-from nobody@cgiserv.freebsd.org)
Received: (from nobody@localhost)
	by cgiserv.freebsd.org (8.14.8/8.14.8/Submit) id s41A9X8l011898;
	Thu, 1 May 2014 10:09:33 GMT
	(envelope-from nobody)
Message-Id: <201405011009.s41A9X8l011898@cgiserv.freebsd.org>
Date: Thu, 1 May 2014 10:09:33 GMT
From: Mark Willson <cdr.nil@gmail.com>
To: freebsd-gnats-submit@FreeBSD.org
Subject: Show Last Changed Rev in uname -a output
X-Send-Pr-Version: www-3.1
X-GNATS-Notify:

>Number:         189180
>Category:       bin
>Synopsis:       [patch] uname(1): show last changed rev in uname -a output
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Thu May 01 10:10:00 UTC 2014
>Closed-Date:    
>Last-Modified:  Sun May 04 02:27:25 UTC 2014
>Originator:     Mark Willson
>Release:        10.0
>Organization:
>Environment:
FreeBSD topaz 10.0-RELEASE-p2 FreeBSD 10.0-RELEASE-p2 #0 r265136: Wed Apr 30 18\
:35:11 BST 2014     root@cobalt:/usr/obj/usr/src/sys/GENERIC  i386

>Description:
uname -a displays a svn rev number which appears to be from the 'top' of the svn repository, not the latest revision in the current branch (releng/10.0 in my case).

With the attached patch the uname -a output would look like:

FreeBSD topaz 10.0-RELEASE-p2 FreeBSD 10.0-RELEASE-p2 #0 r265124: Wed Apr 30 18\
:35:11 BST 2014     root@cobalt:/usr/obj/usr/src/sys/GENERIC  i386

Now it shows the actual revision for the -p2 update. This I would find useful; not sure how many other people would agree.
>How-To-Repeat:
make buildworld
>Fix:
Add -c argument to /usr/bin/svnliteversion, and extract release number.

See attached patch.

Patch attached with submission follows:

--- newvers_orig.sh	2014-05-01 09:13:28.000000000 +0100
+++ newvers.sh	2014-05-01 11:00:40.000000000 +0100
@@ -110,12 +110,11 @@
 if [ -z "${svnversion}" ] && [ -x /usr/bin/svnliteversion ] ; then
 	/usr/bin/svnliteversion $(realpath ${0}) >/dev/null 2>&1
 	if [ $? -eq 0 ]; then
-		svnversion=/usr/bin/svnliteversion
+		svnversion="/usr/bin/svnliteversion -c"
 	else
 		svnversion=
 	fi
 fi
-
 for dir in /usr/bin /usr/local/bin; do
 	if [ -x "${dir}/p4" ] && [ -z ${p4_cmd} ] ; then
 		p4_cmd=${dir}/p4
@@ -133,7 +132,7 @@
 if [ -n "$svnversion" ] ; then
 	svn=`cd ${SYSDIR} && $svnversion 2>/dev/null`
 	case "$svn" in
-	[0-9]*)	svn=" r${svn}" ;;
+	[0-9]*) svn=" r${svn#*:}" ;;
 	*)	unset svn ;;
 	esac
 fi


>Release-Note:
>Audit-Trail:
>Unformatted:
