[PATCH v2 4/5] tests/init.sh: use != test operator instead of -ne
Dmitry V. Levin
ldv at strace.io
Wed Nov 22 07:48:48 UTC 2023
On Sun, Nov 19, 2023 at 02:30:24PM +0900, Masatake YAMATO wrote:
> In get_config_option(), -ne operator was used to
> compare the value extracted from config.h with 0.
>
> Using -ne makes sense if OPTION is defined with "#define". However,
> if it is not defined or explictly undefined with "#undef", an empty
> string is passed to -ne as left side operand. This causes an error
> in dash and bash:
>
> % dash
> $ [ -n '' -a '' -ne 0 ]
> dash: 1: [: Illegal number:
>
> % bash
> $ [ -n '' -a '' -ne 0 ]
> bash: [: : integer expression expected
>
> * tests/init.sh (get_config_option): Use != operand instead of -ne
> operator.
Thanks. I think a better fix is to avoid using -a in test expressions,
so I'll be replacing this commit in the series with another one that
removes use of -a.
Also, as a general rule of thumb, we try to be friendly to those who use
git bisect, and for this reason we try not to add test regressions.
In this case, I'll add the commit that fixes this issue before the commit
that will start relying on it to be fixed.
--
ldv
More information about the Strace-devel
mailing list