Date: Wed, 09 May 2018 07:13:42 +0000 From: bugzilla-noreply@freebsd.org To: bugs@FreeBSD.org Subject: [Bug 228088] /usr/src/usr.bin/killall/killall.1 - killall recognizes only first option of conjoined option argument Message-ID: <bug-228088-227@https.bugs.freebsd.org/bugzilla/>
next in thread | raw e-mail | index | archive | help
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D228088 Bug ID: 228088 Summary: /usr/src/usr.bin/killall/killall.1 - killall recognizes only first option of conjoined option argument Product: Documentation Version: Latest Hardware: Any OS: Any Status: New Severity: Affects Many People Priority: --- Component: Manual Pages Assignee: bugs@FreeBSD.org Reporter: ossbsd@gmail.com CC: doc@FreeBSD.org Created attachment 193199 --> https://bugs.freebsd.org/bugzilla/attachment.cgi?id=3D193199&action= =3Dedit killall.1 patch ### Problem killall uses a custom option parser that silently ignores all but the first option in a conjoined nonargument option set. This behavior differs from th= at exhibited by the FreeBSD C Standard Library POSIX.1 getopt(3) function.=20 ### Explication This user was surprised to find that=20 $ killall -zs foo=20 did not work as implied by the manpage, a potential pitfall for the unaware= .=20 A quick perusal of /usr/src/usr.bin/killall.c shows the custom option parser handles option -zs by doing the following (in algol/c ish psuedocode): av++/ac-- loop=20=20 ... if **av =3D=3D '-' // aha, likely an option then ++*av switch (**av)) {=20 case 'z': // yes, it is ... // handle option break } fi=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20 av++/ac-- // loop driver pool Back at loop top, *av now points at what originally was *(av+1). Thus the conjoined option 's' is now buried in string pointed to by *(av-1) and sile= ntly ignored.=20 ### Solution Either rewrite option parsing to be more POSIXish in behavior, or change the manpage. I take the second approach and attach a patch for the killall.1 manpage. $ man killall ... SYNOPSIS killall [-delmsvz] [-help] [-I] [-j jail] [-u user] [-t tty] .... by patch changes to $ man killall ... SYNOPSIS killall [-d] [-e] [-l] [-m] [-s] [-v] [-z] [-help] [-I] [-j jail] [-u user] [-t tty] ... CAVEATS This utility silently ignores all but the first member of conjoined options. E.g., option -zs is interpreted as if option -z alone were present. ### Files See attached patch. --=20 You are receiving this mail because: You are the assignee for the bug.=
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?bug-228088-227>