Date: Fri, 21 Nov 2025 21:40:15 +0000 From: bugzilla-noreply@freebsd.org To: bugs@FreeBSD.org Subject: [Bug 291141] ministat(1) reports "Unknown option" when legal option given but argument missing Message-ID: <bug-291141-227@https.bugs.freebsd.org/bugzilla/>
index | next in thread | raw e-mail
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=291141 Bug ID: 291141 Summary: ministat(1) reports "Unknown option" when legal option given but argument missing Product: Base System Version: 14.3-RELEASE Hardware: Any OS: Any Status: New Severity: Affects Only Me Priority: --- Component: bin Assignee: bugs@FreeBSD.org Reporter: bigsneaky@duck.com When an option with an impermissible argument is supplied to ministat(1), it prints a usage message to stderr, preceded by a statement explaining which option triggered the error and why, e.g. > $ ministat -c 72 > No support for confidence level > Usage: ... > $ ministat -C 0 > Column number should be positive. > Usage: ... This printing occurs as part of the `usage` function in lines 527-549: https://github.com/freebsd/freebsd-src/blob/main/usr.bin/ministat/ministat.c Minor nit: as above, some of the explanations end in a period (full stop) and some do not. There's no apparent pattern to this: some are only sentence fragments but still have a period, others are complete sentences but don't. They should probably all end in a period. When an illegal option is supplied, or a legal option that requires an argument is supplied without one, getopt(3) prints an error message first. The switch statement that parses the options in ministat has the less informative default `usage("Unknown option");` - see lines 623-5. This produces: > $ ministat -z > ministat: illegal option --z > Unknown option > Usage: ... Here, "Unknown option" is redundant to the getopt error printed before it - and, since it doesn't identify the problematic option, is much less helpful. > $ ministat -C > ministat: option requires an argument --C > Unknown option > Usage: ... Now "Unknown option" is incorrect since -C is a legal option, it just requires an argument. Tested on 14.3, but these results should be unaffected by https://reviews.freebsd.org/D53710 and may be of interest to 0mp@? -- You are receiving this mail because: You are the assignee for the bug.home | help
Want to link to this message? Use this
URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?bug-291141-227>
