[illumos-Developer] webrev: printf
Nicholas George
nicholas.george.homeoffice at googlemail.com
Thu Oct 14 08:37:35 PDT 2010
On 14 October 2010 17:03, Guido Berhoerster
<guido+illumos.org at berhoerster.name> wrote:
> * Garrett D'Amore <garrett at nexenta.com> [2010-10-14 04:08]:
>> So I finally got tired of waiting for someone else to do a printf
>> replacement-- I had thought this would be a trivial thing to do via
>> ksh93. It wasn't, and I wound up taking a different route after first
>> trying to use ksh93. There are details here:
>>
>> http://gdamore.blogspot.com/2010/10/new-implementation-of-printf.html
>>
>
> What compatibility problems is this supposed to address or better
> what is the overall strategy regarding shell and shell-utilities
> compatibility here?
>
> Is this really necessary when both /sbin/sh and /usr/bin/ksh in
> current OpenSolaris/Illumos are already fundamentally incopatible
> to Solaris 10 and earlier?
>
> Any /sbin/sh script calling printf without absolute path will get
> the ksh93 builtin anyway (and is likely break in other ways if it
> expects to get the SVR4 shell).
>
> BTW, this behavior is not ksh93-specific, the builtins of bash
> and even ancient ash barf on such broken usage of printf.
I have to second that. I don't want to join the argument fray of bash
vs Freebsd vs ksh93 but my opinion is that Garrett's bashing of David
Korn is unjustified.
The issue whether /bin/printf must print options it does not support
on stdout or barf with an error has been the topic of discussions and
a interpretation request. The binding conclusion is that printf
followed by a - and character, while used sparsely in the past, is NOT
a valid usage, except the - and the character compose a valid option
for the implementation.
According to these findings VSC has a whopping 9 new tests to verify
that printf does reject unsupported options and vendors, starting with
IBM's AIX, have acted and modified their /bin/printf implementation to
match the standard.
In my humble opinion, bash/ksh93/ash or not, /bin/printf in Illumos
should follow the standard and not introduce a behaviour which is in
violation of that standard.
Nicholas
--
Nicholas George
MBDA System Integration (home office)
More information about the Developer
mailing list