Re: portability of 'printf' command

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 04/05/2010 05:42 PM, Dr. David Kirkby wrote:
>>> Is someone aware of a platform that does not have a /usr/bin/printf or
>>> /bin/printf program?
>>
>> Given that Solaris 8 is about as far back as gnulib currently supports,
>> I think we are at the point where the known lack of printf(1) in older
>> Solaris is no longer worth worrying about.  And, given that we document
>> that awk is safe to use in Makefiles, in spite of its portability
>> problems, I don't think it is too much of a stretch to support careful
>> use of printf in portable scripting (the Autoconf manual already does a
>> good job at documenting considerations to be careful of before using
>> printf).  So, does this patch seem reasonable?
> 
> There are quite a few pre Solaris 8 systems around - since Solaris tends
> to be used for mission-critical applications, it is often not wise to
> update them just because a new release has extra features.

You missed my point.  Solaris 8 _has_ printf(1) (even though it is not a
shell built-in of /bin/sh, and it can dump core on super-long input), so
the request to add printf as a portable tool does _not_ exclude Solaris
8.  The question at hand is whether it is enough to know how to portably
use printf while avoiding core dumps of less-than-stellar
implementations, and blindly assume that printf(1) exists, or whether we
still need to cater to even older systems (SunOS 4, for example) that
have no printf(1) at all.

And the reason that I would _like_ to have printf(1) added to the list
of portable tools is because of the number of non-portable shell scripts
that are currently using 'echo -n', which is doomed to failure in some
shells, instead of printf because printf was not listed in the permitted
tools.

-- 
Eric Blake   eblake@xxxxxxxxxx    +1-801-349-2682
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature

_______________________________________________
Autoconf mailing list
Autoconf@xxxxxxx
http://lists.gnu.org/mailman/listinfo/autoconf

[Index of Archives]     [GCC Help]     [Kernel Discussion]     [RPM Discussion]     [Red Hat Development]     [Yosemite News]     [Linux USB]     [Samba]

  Powered by Linux