Bug 229347 - [sysutils/bsdstats] device reporting broken
Summary: [sysutils/bsdstats] device reporting broken
Status: New
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Many People
Assignee: Yuri Victorovich
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2018-06-26 15:51 UTC by scrappy
Modified: 2018-06-26 15:51 UTC (History)
0 users

See Also:
bugzilla: maintainer-feedback? (yuri)


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description scrappy 2018-06-26 15:51:10 UTC
Incorrect usage of a for loop instead of while causes the query_string to be mis-generated, causing device reports to be unparseable on the server end ... following patch needs to be applied to fix ...

===
*** /tmp/300.statistics	Mon Jun 25 04:17:01 2018
--- /usr/local/etc/periodic/monthly/300.statistics	Mon Jun 25 04:28:00 2018
***************
*** 354,365 ****
     FreeBSD|DragonFly)
       local query_string=""
       local line
!       for line in $(${PCICONF} -l); do
         local DRIVER=$(echo "${line}" | ${AWK} -F\@ '{print $1}')
         local DEV=$(echo "${line}" | ${AWK} '{print $4}' | ${CUT} -c8-15)
         local CLASS=$(echo "${line}" | ${AWK} '{print $2}' | ${CUT} -c9-14)
         query_string=$query_string`echo \&dev[]=${DRIVER}:${DEV}:${CLASS}`
!       done

       echo_begin "Posting device statistics to ${checkin_server_description}"
       do_http_request_check_status "GET" "/scripts/report_devices.php?token=${TOKEN}&key=${KEY}$query_string" \
--- 354,368 ----
     FreeBSD|DragonFly)
       local query_string=""
       local line
!       while read line
!       do
         local DRIVER=$(echo "${line}" | ${AWK} -F\@ '{print $1}')
         local DEV=$(echo "${line}" | ${AWK} '{print $4}' | ${CUT} -c8-15)
         local CLASS=$(echo "${line}" | ${AWK} '{print $2}' | ${CUT} -c9-14)
         query_string=$query_string`echo \&dev[]=${DRIVER}:${DEV}:${CLASS}`
!       done << EOT
! $(${PCICONF} -l)
! EOT

       echo_begin "Posting device statistics to ${checkin_server_description}"
       do_http_request_check_status "GET" "/scripts/report_devices.php?token=${TOKEN}&key=${KEY}$query_string" \
===