From owner-freebsd-bugs@freebsd.org Wed May 9 07:13:47 2018 Return-Path: Delivered-To: freebsd-bugs@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 28C9AFACAFA for ; Wed, 9 May 2018 07:13:47 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from mailman.ysv.freebsd.org (mailman.ysv.freebsd.org [IPv6:2001:1900:2254:206a::50:5]) by mx1.freebsd.org (Postfix) with ESMTP id B4F9B6FA00 for ; Wed, 9 May 2018 07:13:46 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: by mailman.ysv.freebsd.org (Postfix) id 7688EFACAF8; Wed, 9 May 2018 07:13:46 +0000 (UTC) Delivered-To: bugs@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 372C7FACAF5 for ; Wed, 9 May 2018 07:13:46 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from mxrelay.ysv.freebsd.org (mxrelay.ysv.freebsd.org [IPv6:2001:1900:2254:206a::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.ysv.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id BD2AA6F9D5 for ; Wed, 9 May 2018 07:13:45 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from kenobi.freebsd.org (kenobi.freebsd.org [IPv6:2001:1900:2254:206a::16:76]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.ysv.freebsd.org (Postfix) with ESMTPS id D62E869D4 for ; Wed, 9 May 2018 07:13:44 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from kenobi.freebsd.org ([127.0.1.118]) by kenobi.freebsd.org (8.15.2/8.15.2) with ESMTP id w497Di8O053150 for ; Wed, 9 May 2018 07:13:44 GMT (envelope-from bugzilla-noreply@freebsd.org) Received: (from www@localhost) by kenobi.freebsd.org (8.15.2/8.15.2/Submit) id w497DiVg053149 for bugs@FreeBSD.org; Wed, 9 May 2018 07:13:44 GMT (envelope-from bugzilla-noreply@freebsd.org) X-Authentication-Warning: kenobi.freebsd.org: www set sender to bugzilla-noreply@freebsd.org using -f 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 Date: Wed, 09 May 2018 07:13:42 +0000 X-Bugzilla-Reason: AssignedTo X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: Documentation X-Bugzilla-Component: Manual Pages X-Bugzilla-Version: Latest X-Bugzilla-Keywords: X-Bugzilla-Severity: Affects Many People X-Bugzilla-Who: ossbsd@gmail.com X-Bugzilla-Status: New X-Bugzilla-Resolution: X-Bugzilla-Priority: --- X-Bugzilla-Assigned-To: bugs@FreeBSD.org X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_id short_desc product version rep_platform op_sys bug_status bug_severity priority component assigned_to reporter cc attachments.created Message-ID: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: https://bugs.freebsd.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-BeenThere: freebsd-bugs@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: Bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 09 May 2018 07:13:47 -0000 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.=