NetBSD-Bugs archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Re: bin/59969: iostat(8) doesn't obey -H 0 option
The following reply was made to PR bin/59969; it has been noted by GNATS.
From: Paul Goyette <paul%whooppee.com@localhost>
To: Robert Elz <kre%munnari.OZ.AU@localhost>
Cc: gnats-bugs%netbsd.org@localhost, netbsd-bugs%netbsd.org@localhost
Subject: Re: bin/59969: iostat(8) doesn't obey -H 0 option
Date: Sat, 7 Feb 2026 10:04:38 -0800 (PST)
Yes, your proposed patch fixes the -H0 issue. Please commit.
On Sat, 7 Feb 2026, Robert Elz wrote:
> Date: Sat, 7 Feb 2026 16:30:01 +0000 (UTC)
> From: "paul%whooppee.com@localhost via gnats" <gnats-admin%NetBSD.org@localhost>
> Message-ID: <20260207163001.1F4DE1A9242%mollari.NetBSD.org@localhost>
>
> | iostat -H 0 -c 2
> |
> | and observe repeated headers.
>
> You can work around that by using LINES instead:
>
> LINES=0 iostat -c 2
>
> (though doing it just for 2 output records seems pointless!)
This was just for a minimal-reproducer - any value >=2 would work
to show the problem; also -w would work, but requires ^C to exit.
:-)
> You can also try this patch, I think this should fix it (this also
> makes it kind of obvious what the issue is):
>
> Index: iostat.c
> ===================================================================
> RCS file: /cvsroot/src/usr.sbin/iostat/iostat.c,v
> retrieving revision 1.72
> diff -u -u -4 -r1.72 iostat.c
> --- iostat.c 30 Oct 2023 19:43:33 -0000 1.72
> +++ iostat.c 7 Feb 2026 16:53:47 -0000
> @@ -234,9 +234,10 @@
> case 'H':
> height = strtol(optarg, &ep, 10);
> if (height < 0 || *ep != '\0')
> errx(1, "bad height (-H) value.");
> - height += 2; /* magic, but needed to be sane */
> + if (height > 0)
> + height += 2; /* magic, but needed to be sane */
> break;
> #if 0
> case 'i':
> todo |= SHOW_TOTALS | SHOW_NEW_TOTALS;
+---------------------+--------------------------+----------------------+
| Paul Goyette (.sig) | PGP Key fingerprint: | E-mail addresses: |
| (Retired) | 1B11 1849 721C 56C8 F63A | paul%whooppee.com@localhost |
| Software Developer | 6E2E 05FD 15CE 9F2D 5102 | pgoyette%netbsd.org@localhost |
| & Network Engineer | | pgoyette99%gmail.com@localhost |
+---------------------+--------------------------+----------------------+
Home |
Main Index |
Thread Index |
Old Index