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

Re: [PATCH] latest ash has broken 'echo' command



On Sun, Oct 24, 1999 at 11:50:19AM -0400, Raul Miller wrote:
> On Mon, Oct 25, 1999 at 12:00:32AM +1000, Herbert Xu wrote:
> > If you mean they use ash as /bin/sh and rely on features that are not
> > part of POSIX, they are on their own.
> 
> echo -n is an optional part of POSIX.  The POSIX committee clearly
> intends that systems continue to support echo -n or backslash escape
> codes to support their legacy software.

If they did they would've made it mandatory.

> Your desire to break this is not justified by the POSIX standard.

OK, let me spell it out to you again.  ash only exists on Debian to serve as
an alternative /bin/sh.  That's only possible if all #!/bin/sh scripts were
restircted by some standard.  That standard happens to be POSIX.2, which
currently forbids the use of *any* options in shell scripts because it does
not require them in shells.

> > > There's nothing wrong with the debian fork of ash, from the POSIX point
> > > of view.  There's nothing wrong with the upstream form of ash, from the
> > > POSIX point of view.  They're just different.
> > 
> > Actually, neither are POSIX compliant at the moment with respect to echo.
> 
> Please provide a quote from the standard which supports this point of
> view.

Both support -e.

> > POSIX does not allow you to exit with an error.
> 
> <quote>
>     string      A string to be written to standard output.  If the first
>                 operand is "-n" or if any of the operands contain a
>                 backslash (\) character, the results are implementation
>                 defined.
> </quote>
> 
> Ok, it's true that I've not verified that "exit with an error" fits within
> the technical POSIX definition for "implementation defined".  I've lost
> the url for the posix draft.  If you know of a reference which shows that
> exit with an error is an inappropriate "implementation defined" result
> then I'll accept that this isn't the right approach.

True, exiting for -n is probably within the parameters.  But remember we're
trying to catch -e as well.

> > Also, POSIX actually supports escape codes by default.  So escape codes can
> > always be used.  I know that I've indicated to the contrary before, but now
> > that I've got the draft (which AFAIK has been passed by IEEE and ISO) from
> > Sven, it's very clear that escape codes are in, and -n is implementation
> > defined.
> 
> The above quoted text seems to contradict this idea of yours.

OK, so escape codes hasn't been enshrined into a released standard yet.  But
the bit about -n is exactly what I said.  So to recap, POSIX compliant shell
scripts cannot use -n as well as excape codes.
-- 
Debian GNU/Linux 2.1 is out! ( http://www.debian.org/ )
Email:  Herbert Xu ~{PmV>HI~} <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt


Reply to: