On 7/22/19 2:48 PM, Stephane Chazelas wrote:
> 2019-07-23 00:56:59 +0700, k...@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

Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to