This is the mail archive of the
gdb-patches@sources.redhat.com
mailing list for the GDB project.
Re: RFA: compare strings carefully in gdbarch.sh
Andrew Cagney <ac131313@cygnus.com> writes:
> > Isn't that amazing? If it's the only thing there, then `[' knows it's
> > not a unary operator, and apparently applies the "true if string not
> > null" interpretation to it. But if it's followed by something, then
> > it assumes it's an operator.
>
> $ [ -1 ] && echo "hi"
> hi
> $ [ -1 -a -2 ] && echo "hi"
> hi
>
> It's more of a compatibility issue. The script works on Solaris and
> *BSD.
Yes, I don't mean to assert that GNU test is the One True Test. But I
think it's worth supporting, yes?
> > 2001-06-06 Jim Blandy <jimb@redhat.com>
> >
> > * gdbarch.sh: Make sure that '[' doesn't interpret interesting
> > variable values as operators.
>
> Yes, ok. Doug Evans posted a similar patch but that one had massive
> offsets so I dropped it.
Thanks, I'll apply it.