Bug 245296 - ruptime: Leaves spurious extra spaces for the load average of machines that are down
Summary: ruptime: Leaves spurious extra spaces for the load average of machines that a...
Status: Closed FIXED
Alias: None
Product: Base System
Classification: Unclassified
Component: bin (show other bugs)
Version: 11.3-RELEASE
Hardware: Any Any
: --- Affects Some People
Assignee: Takahashi Yoshihiro
URL:
Keywords: needs-qa
Depends on:
Blocks:
 
Reported: 2020-04-02 20:48 UTC by martin
Modified: 2020-04-11 07:52 UTC (History)
1 user (show)

See Also:
koobs: maintainer-feedback? (nyan)
nyan: mfc-stable12+
nyan: mfc-stable11+


Attachments
Fix maxloadav calculation (778 bytes, patch)
2020-04-02 20:48 UTC, martin
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
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 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 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 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