On Wed, Oct 17, 2007 at 10:46:46AM +0800, Herbert Xu wrote:
> On Tue, Oct 16, 2007 at 10:30:15PM +0200, Oleg Verych wrote:
> >
> > > 1) The real Korn shell does the same thing;
> > > 2) It makes the code bigger :)
> > 
> > Well, i don't know all that korn/bourne/tcsh/bash/whatever hell.
> 
> The POSIX specification is mostly based on the Korn shell and
> it is the prototypical POSIX compliant shell.
> 
> However, more importantly this behaviour is consistent with
> POSIX.  Since one of the primary aims of dash is to be as small
> as possible (the one being as fast as possible) while staying
> within the realms of POSIX-compliance,

OK.

> I'd rather not apply this patch.  Unless of course if you can show me a
> way to do it while at the same time making dash smaller :)

That long historical bugs journey on opengroup's site about `test` makes
me sick. I think, this is example of how not to implement things. I like
size optimized system programming. But while going that, i also like to
have silly-bug free implementations, especially in "ah, 'cmon,
arithmetics is hard" part :). BTW i did size optimization patch before
this one exactly because i wanted to have overall new-old delta negative.
And it is so.

> > Also, this hides real bugs, when arithmetical comparsion succeeds, even
> 
> I think this is debatable.

Well, before major shell scripting i decided to make all my stuff
`set -e` strong. Works for me, but not for shells (some times :). Also
this is very good requirement in Debian,

When test is used like this:

[ "$PARAM" -ge 0 ]

It will work in `dash`, but will fail in `bash`. Oops,

> Even if dash made this an error it still may escape detection because
> the test command is not a special built-in and cannot cause the whole
> script to abort. So all this will do is print something to stderr and
> cause the test to return false instead of a possible true value.
> 
> BTW, even bash is not completely consistent here:

let's not touch `bash`, please! It's very doomed stuff, IMHO.

> $ bash -o posix -c '[ "" -lt 3 ]'
> bash: line 0: [: : integer expression expected

> $ bash -o posix -c '[ " " -lt 3 ]'

I know, but see above :) How many broken and slow things its developer
brought to the world... This must be left behind and remembered as
classic case of "what not to do".
____



-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

Reply via email to