Bug 245296

Summary: ruptime: Leaves spurious extra spaces for the load average of machines that are down
Product: Base System Reporter: martin
Component: binAssignee: Yoshihiro Takahashi <nyan>
Status: Closed FIXED    
Severity: Affects Some People CC: nyan
Priority: --- Keywords: needs-qa
Version: 11.3-RELEASEFlags: koobs: maintainer-feedback? (nyan)
nyan: mfc-stable12+
nyan: mfc-stable11+
Hardware: Any   
OS: Any   
See Also: https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=234239
Attachments:
Description Flags
Fix maxloadav calculation none

Description martin 2020-04-02 20:48:34 UTC
Created attachment 212992 [details]
Fix maxloadav calculation

The calculation for maxloadav in usr.bin/ruptime/ruptime.c includes machines that are down, even though the load averages for those machines are not printed.  This can leave spurious extra spaces when printing the load averages if a machine is down with a load >= 10.

For example, I see output like this with two spaces before the 0.00 for methane:

methane                    up    6+10:55,     0 users,  load  0.00,  0.00,  0.00
odroid                   down      20:10

because the load average for odroid was 28 before it stopped responding.

It should be like this:

methane                    up    6+10:55,     0 users,  load 0.00, 0.00, 0.00
odroid                   down      20:10

This is fixed by the attached patch.
Comment 1 commit-hook freebsd_committer freebsd_triage 2020-04-04 12:08:11 UTC
A commit references this bug:

Author: nyan
Date: Sat Apr  4 12:07:36 UTC 2020
New revision: 359631
URL: https://svnweb.freebsd.org/changeset/base/359631

Log:
  Remove extra spaces for the load average of machines that are down.

  PR:		245296
  Submitted by:	martin _at_ lispworks.com
  MFC after:	1 week

Changes:
  head/usr.bin/ruptime/ruptime.c
Comment 2 commit-hook freebsd_committer freebsd_triage 2020-04-11 07:31:27 UTC
A commit references this bug:

Author: nyan
Date: Sat Apr 11 07:31:16 UTC 2020
New revision: 359796
URL: https://svnweb.freebsd.org/changeset/base/359796

Log:
  MFC: r359631

  Remove extra spaces for the load average of machines that are down.

  PR:		245296
  Submitted by:	martin _at_ lispworks.com

Changes:
_U  stable/12/
  stable/12/usr.bin/ruptime/ruptime.c
Comment 3 commit-hook freebsd_committer freebsd_triage 2020-04-11 07:47:31 UTC
A commit references this bug:

Author: nyan
Date: Sat Apr 11 07:46:39 UTC 2020
New revision: 359799
URL: https://svnweb.freebsd.org/changeset/base/359799

Log:
  MFC: r342965

  > Fix indentation in ruptime command output for hosts in the "down" state.

  MFC: r359631

  > Remove extra spaces for the load average of machines that are down.

  PR:		234239, 245296

Changes:
_U  stable/11/
  stable/11/usr.bin/ruptime/ruptime.c