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

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



Herbert Xu <herbert@gondor.apana.org.au> wrote:

> It's not broken. The Single Unix Specification says that echo must
> not support any options. The kernel makefile should be fixed.

I'm not sure, what the correct implementation is.  Here's a little
comparison of different echo implementations:

                       -n      \c       -e \c       \007       -e \007

shutils /bin/echo       Y       N         Y           N           Y
ash 0.3.5-5             Y       N         Y           N           Y
ash 0.3.5-7             N       Y         N           Y           N
bash                    Y       N         Y           N           Y
pdksh                   Y       Y         Y           Y           Y
zsh                     Y       Y         Y           Y           Y

Compare this with DEC Unix 4.0B:
DEC /bin/sh             Y       Y         N           Y           N
DEC /bin/posix/sh       N       Y         N           Y           N
DEC ksh                 N       Y         N           Y           N
DEC /bin/echo           N       Y         N           Y           N

As you can see, there is no mechanism which always works :-(
But all Linux echo variants (except ash 0.3.5-7) support "-n" and
"-e", with the effect, that _many_ shell scripts in the Linux
environment use at least "-n" to write a line without linefeed at the
end (which is used in nearly all /etc/init.d scripts).


Now the question is, what /etc/init.d scripts should use to write a
line without linefeed.  printf(1) isn't an alternative here, because
it resides in /usr/bin, so it may not be available in the boot
process.  /bin/echo also isn't an alternative, because it has a
different behavior on DEC UNIX 4.0, as you can see above.

I think it is acceptable to use "-n" and "-e" on Debian systems (and
change the behavior of ash back to supporting this).  Additionally
everyone should try to avoid using "-n", "-e" and escape sequences for
compatibility reasons with other Unixes.

Please change back the behavior of ash to support "-n" and "-e" again,
otherwise _many_ package will heavily break (for example the file-rc
package will be completely broken with this).

Tschoeeee

        Roland

-- 
 * roland@spinnaker.de * http://www.spinnaker.de/ *
PGP (RSA): 1024R/DD08DD6D   2D E7 CC DE D5 8D 78 BE   3C A0 A4 F1 4B 09 CE AF
GPG (DSA): 1024D/BD8B050D   3A63 2410 4B40 422D 1111  1D2C 3BBF CF77 BD8B 050D


Reply to: