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)

From Eric Blake <eblake@redhat.com>
Newsgroups gnu.bash.bug
Subject Re: Incorrect option processing in builtin printf(1)
Date 2019-07-22 14:55 -0500
Organization Red Hat, Inc.
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>

Show all headers | 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