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

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



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.

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

> > 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.

> > If your goal is strict compliance with the POSIX draft then the newly
> > introduced ash should exit with an error, and an error message if there
> > are any backslash (\) characters in the argument (and that error message
> > should be locale specific).  And there are probably similar changes that
> > should be made in other aspects of that program.
> 
> 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.

> 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.

Perhaps you're looking at a different draft?

<quote>
 History_of_Decisions_Made

 In Draft 8, an attempt was made to merge the extensions of BSD and
 System V, supporting both -n and escape sequences.  During initial ballot
 resolution, a -e option was proposed to enable the escape conventions.
 Both attempts failed, as there are historical scripts that would be
 broken by any attempt at reconciliation.  Therefore, in Draft 9 only the
 simplest version of echo is presented.  Implementation-defined extensions
 on BSD and System V will keep historical applications content.  Portable
 applications that wish to do prompting without <newline>s or that could
 possibly be expecting to echo a "-n", should use the new printf utility
 (see 4.50), derived from the Ninth Edition.
</quote>

-- 
Raul


Reply to: