[LFS Trac] #2646: scripts should use printf instead of echo

LFS Trac trac at linuxfromscratch.org
Sun May 9 23:29:06 PDT 2010

#2646: scripts should use printf instead of echo
 Reporter:  tito_puentes       |        Owner:  lfs-book@…                   
     Type:  defect             |       Status:  closed                       
 Priority:  low                |    Milestone:  6.7                          
Component:  Bootscripts        |      Version:  SVN                          
 Severity:  minor              |   Resolution:  wontfix                      
 Keywords:  echo printf POSIX  |  
Changes (by dj@…):

  * status:  new => closed
  * resolution:  => wontfix


 Replying to [comment:7 bon]:
 > > AFAICT, the stty sane bit can go, so we could put a lighter weight
 test case in each bootscript and source functions at each runlevel change
 to eliminate that
 > <snip>
 > are you saying you're going to source them once per runlevel?
 > then you'd have to export the functions, and export -f is a bashism
 > not to mention that exporting that many vars to begin with is bound to
 cause conflicts

 You are correct, we cannot do the above and continue to use /bin/sh for
 the schebang.  At any rate, as pointed out previously, the suggestion to
 use printf still does not account for all cases.

 While I agree that printf could be both cleaner and simplify the scripts a
 bit, while also making the assumption that printf is consistent across all
 implementations, I have to agree with the others and close as wontfix as
 there is currently no portability issue.

 When comparing apples to apples, we are discussing an estimated 3 second
 time deduction on even the oldest supported hardware (i486 running at
 33MHz) in exchange for several hours worth of work (when you include the
 time required to test).  The amount of work required is just far too much
 for such a minimal gain on scripts that I personally hope to see removed
 in the near future.  Going forward, however, printf will be preferable for
 scripts using /bin/sh.

Ticket URL: <http://wiki.linuxfromscratch.org/lfs/ticket/2646#comment:10>
LFS Trac <http://wiki.linuxfromscratch.org/lfs/>
Linux From Scratch: Your Distro, Your Rules.

More information about the lfs-book mailing list