Path: csiph.com!xmission!news.snarked.org!news.linkpendium.com!news.linkpendium.com!panix!usenet.stanford.edu!not-for-mail From: Eric Blake Newsgroups: gnu.bash.bug Subject: Re: Incorrect option processing in builtin printf(1) Date: Mon, 22 Jul 2019 14:55:05 -0500 Organization: Red Hat, Inc. Lines: 74 Approved: bug-bash@gnu.org Message-ID: References: <201907221756.x6MHuxaR019063@jinx.noi.kre.to> <20190722194843.azebfqpardb76fdd@chaz.gmail.com> NNTP-Posting-Host: lists.gnu.org Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="J79Lebsd9QyPFgCf3V0o4PE8gzBuf5qXV" X-Trace: usenet.stanford.edu 1563825313 9603 209.51.188.17 (22 Jul 2019 19:55:13 GMT) X-Complaints-To: action@cs.stanford.edu Cc: bug-bash@gnu.org To: Stephane Chazelas , kre@munnari.OZ.AU Envelope-to: bug-bash@gnu.org Openpgp: preference=signencrypt Autocrypt: addr=eblake@redhat.com; keydata= xsBNBEvHyWwBCACw7DwsQIh0kAbUXyqhfiKAKOTVu6OiMGffw2w90Ggrp4bdVKmCaEXlrVLU xphBM8mb+wsFkU+pq9YR621WXo9REYVIl0FxKeQo9dyQBZ/XvmUMka4NOmHtFg74nvkpJFCD TUNzmqfcjdKhfFV0d7P/ixKQeZr2WP1xMcjmAQY5YvQ2lUoHP43m8TtpB1LkjyYBCodd+LkV GmCx2Bop1LSblbvbrOm2bKpZdBPjncRNob73eTpIXEutvEaHH72LzpzksfcKM+M18cyRH+nP sAd98xIbVjm3Jm4k4d5oQyE2HwOur+trk2EcxTgdp17QapuWPwMfhaNq3runaX7x34zhABEB AAHNHkVyaWMgQmxha2UgPGVibGFrZUByZWRoYXQuY29tPsLAegQTAQgAJAIbAwULCQgHAwUV CgkICwUWAgMBAAIeAQIXgAUCS8fL9QIZAQAKCRCnoWtKJSdDahBHCACbl/5FGkUqJ89GAjeX RjpAeJtdKhujir0iS4CMSIng7fCiGZ0fNJCpL5Rp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v:60.0) Gecko/20100101 Thunderbird/60.7.0 In-Reply-To: <20190722194843.azebfqpardb76fdd@chaz.gmail.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.49]); Mon, 22 Jul 2019 19:55:08 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 X-BeenThere: bug-bash@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Bug reports for the GNU Bourne Again SHell List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Mailman-Original-Message-ID: X-Mailman-Original-References: <201907221756.x6MHuxaR019063@jinx.noi.kre.to> <20190722194843.azebfqpardb76fdd@chaz.gmail.com> Xref: csiph.com gnu.bash.bug:15202 This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --J79Lebsd9QyPFgCf3V0o4PE8gzBuf5qXV Content-Type: multipart/mixed; boundary="aSDmlGWHCoS2rx6bpxwazoMZJxnaJxHTq"; protected-headers="v1" From: Eric Blake To: Stephane Chazelas , kre@munnari.OZ.AU Cc: bug-bash@gnu.org Message-ID: Subject: Re: Incorrect option processing in builtin printf(1) References: <201907221756.x6MHuxaR019063@jinx.noi.kre.to> <20190722194843.azebfqpardb76fdd@chaz.gmail.com> In-Reply-To: <20190722194843.azebfqpardb76fdd@chaz.gmail.com> --aSDmlGWHCoS2rx6bpxwazoMZJxnaJxHTq Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: quoted-printable On 7/22/19 2:48 PM, Stephane Chazelas wrote: > 2019-07-23 00:56:59 +0700, kre@munnari.OZ.AU: > [...] >> POSIX specifies that printf(1) has no options, and by not >> specifying that it is intended to comply with XBD 12.2 effectivly >> says that it is not. That is, in printf, the first arg is >> always the format string, whatever it contains. > [...] >=20 > If that was the case, then that would be bug in the POSIX > specification. I can't find a single printf implementations > where printf -- outputs -- (I tried bash, zsh, ksh93, GNU, yash, > busybox, busybox ash, Solaris /bin/printf). >=20 > Even if POSIX didn't mandate >=20 > printf -- -%s x >=20 > to output -x, I'd say it would be a bug in the POSIX > specification (it looks like it is). POSIX _does_ mandate 'printf -- -%s x' to output exactly '-x', by virtue of the fact that it mandates all utilities (other than special builtins) with the specification 'OPTIONS None.' to parse and ignore '--' as the end of options, whether or not the utility takes options as an extension. If NetBSD broke that behavior, that is a bug in NetBSD's shell, not bash nor POSIX. --=20 Eric Blake, Principal Software Engineer Red Hat, Inc. +1-919-301-3226 Virtualization: qemu.org | libvirt.org --aSDmlGWHCoS2rx6bpxwazoMZJxnaJxHTq-- --J79Lebsd9QyPFgCf3V0o4PE8gzBuf5qXV Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- iQEzBAEBCAAdFiEEccLMIrHEYCkn0vOqp6FrSiUnQ2oFAl02FJkACgkQp6FrSiUn Q2pf+wf+Ms8gJjr7lpoKWZD4K0TeR6MfNPAI4kvP+CrPeOJUAo5XMgAIGrxdcPmk cwE2SZH/cx0f5N0ajjWiiX9wdCzi0u2lHb36W+VkfneK/wXZ2DIm1qXVmUhF9h/G 1DuVuyrvGZbMqHIVWG/sq+6BZJ/tgt8cyAzNOIBGvQptW5qgYFKA6NKHZQ/I92Kb M6K7tuYudpdtA6+caGu3x3B2skz45OwKZvvHAae5f33quY3btLt2mPkwdBtEqDq1 9gTHY3A0BLT/qNPdnoSN9Z2coS2CLiESlmucYQliIVSGc8PUWRlyuSCBu815uLR0 6hXXp5LOy1DWANC7QcLsAsQ0LBqPaQ== =HMOi -----END PGP SIGNATURE----- --J79Lebsd9QyPFgCf3V0o4PE8gzBuf5qXV--