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



    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!)

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;




Home | Main Index | Thread Index | Old Index