Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > gnu.bash.bug > #15202

Re: Incorrect option processing in builtin printf(1)

Path csiph.com!xmission!news.snarked.org!news.linkpendium.com!news.linkpendium.com!panix!usenet.stanford.edu!not-for-mail
From Eric Blake <eblake@redhat.com>
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 <mailman.2025.1563825312.2688.bug-bash@gnu.org> (permalink)
References <201907221756.x6MHuxaR019063@jinx.noi.kre.to> <mailman.2014.1563818289.2688.bug-bash@gnu.org> <20190722194843.azebfqpardb76fdd@chaz.gmail.com> <c5f167d3-c0bd-dccd-a7a2-125a1bd3385d@redhat.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 <stephane.chazelas@gmail.com>, 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+trk2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WWAN3gHiJqmJZPkhFPUIozZUCeEc76pS/IUN72NfprZmF Dp6/QDjDFtfS39bHSWXKVZUbqaMPqlj/z6Ugk027/3GUjHHr8WkeL1ezWepYDY7WSoXwfoAL 2UXYsMAr/uUncSKlfjvArhsej0S4zbqim2ZY6S8aRWw94J3bSvJR+Nwbs34GPTD4Pg==
User-Agent Mozilla/5.0 (X11; Linux x86_64; rv: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 <bug-bash.gnu.org>
List-Unsubscribe <https://lists.gnu.org/mailman/options/bug-bash>, <mailto:bug-bash-request@gnu.org?subject=unsubscribe>
List-Archive <https://lists.gnu.org/archive/html/bug-bash>
List-Post <mailto:bug-bash@gnu.org>
List-Help <mailto:bug-bash-request@gnu.org?subject=help>
List-Subscribe <https://lists.gnu.org/mailman/listinfo/bug-bash>, <mailto:bug-bash-request@gnu.org?subject=subscribe>
X-Mailman-Original-Message-ID <c5f167d3-c0bd-dccd-a7a2-125a1bd3385d@redhat.com>
X-Mailman-Original-References <201907221756.x6MHuxaR019063@jinx.noi.kre.to> <mailman.2014.1563818289.2688.bug-bash@gnu.org> <20190722194843.azebfqpardb76fdd@chaz.gmail.com>
Xref csiph.com gnu.bash.bug:15202

Show key headers only | View raw


[Multipart message — attachments visible in raw view] - view raw

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.
> [...]
> 
> 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).
> 
> Even if POSIX didn't mandate
> 
> printf -- -%s x
> 
> 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.

-- 
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3226
Virtualization:  qemu.org | libvirt.org

Back to gnu.bash.bug | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Incorrect option processing in builtin printf(1) kre@munnari.OZ.AU - 2019-07-23 00:56 +0700
  Re: Incorrect option processing in builtin printf(1) Stephane Chazelas <stephane.chazelas@gmail.com> - 2019-07-22 20:48 +0100
  Re: Incorrect option processing in builtin printf(1) Eric Blake <eblake@redhat.com> - 2019-07-22 14:55 -0500
  Re: Incorrect option processing in builtin printf(1) Stephane Chazelas <stephane.chazelas@gmail.com> - 2019-07-22 21:10 +0100

csiph-web