Make bootscripts more POSIX compliant

Matthew Burgess matthew at linuxfromscratch.org
Thu Feb 22 14:02:25 PST 2007


On Thursday 22 February 2007 21:13, Dan Nicholson wrote:
> On 2/22/07, Matthew Burgess <matthew at linuxfromscratch.org> wrote:
> > On Thursday 22 February 2007 19:05, Dan Nicholson wrote:
> > > The problem with using printf is that POSIX doesn't say that it needs
> > > to be a builtin (although it is in dash) and the coreutils executable
> > > is in /usr/bin.
> >
> > Well, I think that POSIX does state that printf should be a builtin. 
> > There are codes that appear in a utility's Synopsis section, which
> > determine whether it is optional or mandatory.  Compare, for example, the
> > specifications of 'admin' and 'alias' to those of 'echo' and 'printf'. (I
> > don't want to paste links as free registration is preferred by The Open
> > Group).
>
> Could you send me the link off-list? I'm registered, but I can't find
> this part. I might be looking at the wrong doc, too.

After re-reading the docs, it's pretty clear that I actually misread them 
earlier on.  What they state is which utilities have to be available on a 
system, and which are optional.  It doesn't stipulate whether those utilities 
have to be available as shell builtins or not.

As Dan also found out, posh doesn't have a builtin version of printf, but it 
does have echo as a builtin.  Given that there are no guarantees that either 
echo or printf will be available as a builtin, or whether they'll be POSIX 
compliant, it looks like a run-time check is the only safe way of ensuring 
our output will be sane.  Dan, if you could apply your ${ECHO} patch along 
with the others you posted that'd be great!

Matt



More information about the lfs-dev mailing list