ports/160504: sysutils/bsdstats: 300.statistics outputs an error message: expr: not a decimal number: ' 43905'

KOIE Hidetaka koie at suri.co.jp
Tue Sep 6 06:00:04 UTC 2011


>Number:         160504
>Category:       ports
>Synopsis:       sysutils/bsdstats: 300.statistics outputs an error message: expr: not a decimal number: '   43905'
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-ports-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Tue Sep 06 06:00:03 UTC 2011
>Closed-Date:
>Last-Modified:
>Originator:     KOIE Hidetaka
>Release:        CURRENT
>Organization:
surigiken
>Environment:
FreeBSD guriandgura 9.0-BETA1 FreeBSD 9.0-BETA1 #1 r224703+3f3da7edb9db,ver-hg,nice-powerd: Mon Aug  8 17:48:22 JST 2011     root at guriandgura:/usr/obj/usr/src/sys/GURIANDGURA  amd64
>Description:
/usr/local/etc/periodic/monthly/300.statistics of sysutils/bsdstats reports with an error message since 2011-08-01, like this:

Doing login accounting:
        total                              343.90
        koie                               343.90
Posting monthly OS statistics to rpt.bsdstats.org
Posting monthly device statistics to rpt.bsdstats.org
Posting monthly CPU statistics to rpt.bsdstats.org
expr: not a decimal number: '   43905'
Posting monthly ports statistics to rpt.bsdstats.org

-- End of monthly output --


>How-To-Repeat:
sudo /usr/local/etc/periodic/monthly/300.statistics
>Fix:
at the head of 300.statistics, IFS is set to newline.
I suspect /bin/sh has been changed for IFS or command substitution.

# sample script
set -x
IFS="
"
A="    123"
B=`expr $A + 1`
echo $B

% sh sample.sh
+ IFS='
'
+ A='    123'
+ expr '    123' + 1
expr: not a decimal number: '    123'
+ B=''
+ echo

%



Patch attached with submission follows:

--- 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


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



More information about the freebsd-ports-bugs mailing list