ports/160504: sysutils/bsdstats: 300.statistics outputs an error message: expr: not a decimal number: ' 43905'
h h
aakuusta at gmail.com
Tue Sep 6 08:20:07 UTC 2011
The following reply was made to PR ports/160504; it has been noted by GNATS.
From: h h <aakuusta at gmail.com>
To: KOIE Hidetaka <koie at suri.co.jp>
Cc: bug-followup at 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 <koie at suri.co.jp> 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}
--=-=-=--
More information about the freebsd-ports-bugs
mailing list