[Top][All Lists]

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

Re: portability of 'printf' command

From: Eric Blake
Subject: Re: portability of 'printf' command
Date: Mon, 05 Apr 2010 13:49:17 -0600
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv: Gecko/20100330 Fedora/3.0.4-1.fc12 Lightning/1.0b1 Thunderbird/3.0.4

On 01/-10/-28163 12:59 PM, Bruno Haible wrote:
> Is the 'printf' command portable enough to be used in configure files
> and autoconf macros?
> The GNU Coding Standards [1] don't mention it as a portable utility. Indeed,
> when you use bash version 1 (which does not have 'printf' built-in) on a
> platform that does not have a /usr/bin/printf program, you would be hosed.
> But which platforms are this? The Autoconf manual [2] does not mention a lack
> of 'printf' anywhere.
> 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?

Index: ChangeLog
RCS file: /sources/gnustandards/gnustandards/ChangeLog,v
retrieving revision 1.108
diff -u -p -r1.108 ChangeLog
--- ChangeLog   28 Mar 2010 00:07:38 -0000      1.108
+++ ChangeLog   5 Apr 2010 19:49:01 -0000
@@ -1,3 +1,7 @@
+2010-04-05  Eric Blake  <address@hidden>
+       * make-stds.texi (Utilities in Makefiles): Allow printf.
 2010-03-27  Karl Berry  <address@hidden>

        * standards.texi (Graphical Interfaces): Recommend D-Bus
@@ -671,7 +675,8 @@
        (Copyright Papers): typo - missing verb.

-Copyright (C) 2004, 2005 Free Software Foundation, Inc.
+Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010 Free Software
+Foundation, Inc.

 Copying and distribution of this file, with or without modification,
 are permitted in any medium without royalty provided the copyright
Index: make-stds.texi
RCS file: /sources/gnustandards/gnustandards/make-stds.texi,v
retrieving revision 1.57
diff -u -p -r1.57 make-stds.texi
--- make-stds.texi      23 Feb 2010 14:13:13 -0000      1.57
+++ make-stds.texi      5 Apr 2010 19:49:01 -0000
@@ -160,7 +160,7 @@ installation should not use any utilitie

 awk cat cmp cp diff echo egrep expr false grep install-info
-ln ls mkdir mv pwd rm rmdir sed sleep sort tar test touch tr true
+ln ls mkdir mv printf pwd rm rmdir sed sleep sort tar test touch tr true
 @end example

 Compression programs such as @code{gzip} can be used in the

Eric Blake   address@hidden    +1-801-349-2682
Libvirt virtualization library

Attachment: signature.asc
Description: OpenPGP digital signature

reply via email to

[Prev in Thread] Current Thread [Next in Thread]