Re: test -nt/-ot behavior

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

 



* Herbert Xu <herbert@xxxxxxxxxxxxxxxxxxx> [2010-02-22 07:50]:
> Guido Berhoerster <guido+kernel.org@xxxxxxxxxxxxxxxx> wrote:
> > 
> > It should be noted that pdksh contains many other subtle
> > differences and is not really compatible to either ksh88 or
> > ksh93, the behavior introduced by the test builtin of earlier
> > pdksh versions is likely due to a misunderstanding of ksh88's
> > specified behavior which was later fixed.  So IMHO the
> > consequence for ash should be to either merge the fix from pdksh
> > or to drop -nt, -ot, and -ef altogether, I would prefer that
> > latter since I think silently changing the behavior in an
> > incompatible way is bad practice and these features are not
> > specified in POSIX anyway.
> 
> Well, as you say the behaviour is not specified by POSIX so dash
> isn't doing anything wrong per se.  As this has been the documented
> behaviour within dash since forever I'm reluctant to change it or
> for that matter, removing the feature entirely.

It is not doing something "wrong", but my point (and that of the
original reporter of
http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=558989) is that
it is diverging from established behavior in widely used shells
such a ksh88, ksh93, bash, pdksh, and GNU userland, as I said
this was even fixed in pdksh where it originally came from.  I
don't know how many /bin/dash scripts there are which rely on
this behavior from test -nt/-ot but it can't be that many and
dash has only been called das since 2002.  On the other hand dash
is being widely used as /bin/sh, e.g. in Ubuntu, Debian, and
hopefully soon openSUSE.

Changing the behavior as pdksh did after ten years is certainly
not a good practice but removing it will lead to an clear error
message rather than unexpected behavior which would be an
advantage when dealing with scripts expecting -nt/-ot but using
/bin/sh. For this reason alone I'm inclined to patch this out on
openSUSE.

If dash aims to be a POSIX compliant /bin/sh which is "as small
as possible", why does it need test -nt/-ot/-ef at all?  BTW, why
did you go with pdksh's test instead of the one coming with ash?

-- 
Guido Berhoerster
--
To unsubscribe from this list: send the line "unsubscribe dash" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [LARTC]     [Bugtraq]     [Yosemite Forum]     [Photo]

  Powered by Linux