Bug 193671 - [acpiconf] Extra whitespace at the end of the State: line
Summary: [acpiconf] Extra whitespace at the end of the State: line
Status: Closed FIXED
Alias: None
Product: Base System
Classification: Unclassified
Component: bin (show other bugs)
Version: 10.0-RELEASE
Hardware: i386 Any
: --- Affects Only Me
Assignee: Jung-uk Kim
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-09-15 20:48 UTC by Moviuro
Modified: 2015-04-11 01:18 UTC (History)
2 users (show)

See Also:


Attachments
A patch to test (1.46 KB, patch)
2015-04-06 20:14 UTC, Jung-uk Kim
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Moviuro 2014-09-15 20:48:42 UTC
Running "acpiconf -i 0" produces the following output on my laptop (fresh 10.0-RELEASE install, as well as 10.0-p8): http://ix.io/elA ; http://sprunge.us/CNCN ; Note the extra whitespace after the "State:" line, L13.

It is only an annoyance because it breaks the switch/case syntax in shell scripts. I suspect the behavior is the same when "discharging" (can't test right now though, as I'm working on a remote machine).
Comment 1 John Baldwin freebsd_committer freebsd_triage 2015-04-06 17:28:46 UTC
Please see https://reviews.freebsd.org/D2243
Comment 2 Jung-uk Kim freebsd_committer 2015-04-06 20:14:20 UTC
Created attachment 155290 [details]
A patch to test
Comment 3 Jung-uk Kim freebsd_committer 2015-04-06 20:16:13 UTC
(In reply to John Baldwin from comment #1)
I am okay with your patch.  However, I'd like to clearly note that other states are invalid.  Please let me know what you think.
Comment 4 John Baldwin freebsd_committer freebsd_triage 2015-04-06 21:25:01 UTC
Comment on attachment 155290 [details]
A patch to test

Hah, I actually started with something like this myself but worried it was too verbose.  I'm fine with this approach though.  The only thing I would suggest is outputting the raw hex value for invalid values.  You could do that by using printf() instead of the state variable.
Comment 5 Jung-uk Kim freebsd_committer 2015-04-06 21:45:36 UTC
(In reply to John Baldwin from comment #4)
No, it is not necessary because practically there is only one invalid value, i.e., ACPI_BATT_STAT_DISCHARG | ACPI_BATT_STAT_CHARGING. :-)
Comment 6 commit-hook freebsd_committer 2015-04-06 21:52:34 UTC
A commit references this bug:

Author: jkim
Date: Mon Apr  6 21:51:55 UTC 2015
New revision: 281171
URL: https://svnweb.freebsd.org/changeset/base/281171

Log:
  Tidy up battery status information.  Remove a trailing white space.

  PR:		193671

Changes:
  head/usr.sbin/acpi/acpiconf/acpiconf.c
Comment 7 John Baldwin freebsd_committer freebsd_triage 2015-04-06 22:11:14 UTC
(In reply to Jung-uk Kim from comment #5)

Ah, I had originally complained if any reserved bits were set as well, but your patch is fine.
Comment 8 commit-hook freebsd_committer 2015-04-11 01:18:01 UTC
A commit references this bug:

Author: jkim
Date: Sat Apr 11 01:17:22 UTC 2015
New revision: 281389
URL: https://svnweb.freebsd.org/changeset/base/281389

Log:
  MFC:	r281171

  Tidy up battery status information.  Remove a trailing white space.

  PR:		193671

Changes:
_U  stable/10/
  stable/10/usr.sbin/acpi/acpiconf/acpiconf.c
_U  stable/8/usr.sbin/acpi/acpiconf/
  stable/8/usr.sbin/acpi/acpiconf/acpiconf.c
_U  stable/9/usr.sbin/acpi/acpiconf/
  stable/9/usr.sbin/acpi/acpiconf/acpiconf.c