From owner-freebsd-ports-bugs@FreeBSD.ORG Tue Sep 6 08:20:07 2011 Return-Path: Delivered-To: freebsd-ports-bugs@hub.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 012081065672 for ; Tue, 6 Sep 2011 08:20:06 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:4f8:fff6::28]) by mx1.freebsd.org (Postfix) with ESMTP id C71F08FC12 for ; Tue, 6 Sep 2011 08:20:06 +0000 (UTC) Received: from freefall.freebsd.org (localhost [127.0.0.1]) by freefall.freebsd.org (8.14.4/8.14.4) with ESMTP id p868K6H3075826 for ; Tue, 6 Sep 2011 08:20:06 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.14.4/8.14.4/Submit) id p868K6SU075820; Tue, 6 Sep 2011 08:20:06 GMT (envelope-from gnats) Date: Tue, 6 Sep 2011 08:20:06 GMT Message-Id: <201109060820.p868K6SU075820@freefall.freebsd.org> To: freebsd-ports-bugs@FreeBSD.org From: h h Cc: Subject: Re: ports/160504: sysutils/bsdstats: 300.statistics outputs an error message: expr: not a decimal number: ' 43905' X-BeenThere: freebsd-ports-bugs@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: h h List-Id: Ports bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 06 Sep 2011 08:20:07 -0000 The following reply was made to PR ports/160504; it has been noted by GNATS. From: h h To: KOIE Hidetaka Cc: bug-followup@FreeBSD.org Subject: Re: ports/160504: sysutils/bsdstats: 300.statistics outputs an error message: expr: not a decimal number: ' 43905' Date: Tue, 06 Sep 2011 11:53:40 +0400 --=-=-= Content-Type: text/plain; charset=utf-8 KOIE Hidetaka writes: > --- 300.statistics.orig 2011-09-06 14:30:53.572040919 +0900 > +++ 300.statistics 2011-09-06 14:32:56.860042305 +0900 > @@ -171,7 +171,7 @@ > > > # Make the request > - string_length=`echo ${query_string} | wc -m` > + string_length=`echo ${query_string} | wc -m | sed 's/^ *//'` > string_length=`expr ${string_length} - 1` > > echo "POST ${url_prefix}/scripts/report_ports.php HTTP/1.0 Why not just eliminate expr(1) rather than trying to conform to its quirks? from expr(1) man page: The syntax of the expr command in general is historic and inconvenient. New applications are advised to use shell arithmetic rather than expr. and later ยท Leading white space and/or a plus sign before an otherwise valid positive numberic operand are allowed and will be ignored. After r223881 this does not seem to be true $ expr -- ' 1' + 1 expr: not a decimal number: ' 1' Exit 2 $ expr -e -- ' 1' + 1 2 default behavior is similar to `expr' from GNU coreutils $ gexpr -- ' 1' + 1 gexpr: non-integer argument Exit 2 http://svnweb.freebsd.org/base?view=revision&revision=223881 --=-=-= Content-Type: text/x-patch Content-Disposition: inline; filename=a.diff Index: sysutils/bsdstats/files/300.statistics.in =================================================================== RCS file: /a/.csup/ports/sysutils/bsdstats/files/300.statistics.in,v retrieving revision 1.44 diff -u -p -r1.44 300.statistics.in --- sysutils/bsdstats/files/300.statistics.in 19 Aug 2010 03:06:13 -0000 1.44 +++ sysutils/bsdstats/files/300.statistics.in 6 Sep 2011 07:20:48 -0000 @@ -172,7 +172,7 @@ report_ports () { # Make the request string_length=`echo ${query_string} | wc -m` - string_length=`expr ${string_length} - 1` + string_length=$((string_length - 1)) echo "POST ${url_prefix}/scripts/report_ports.php HTTP/1.0 Host: ${checkin_server} --=-=-=--