[DTrace-devel] [PATCH v2 2/4] test: fix check_result.sh

Nick Alcock nick.alcock at oracle.com
Mon Nov 6 11:41:21 UTC 2023


On 2 Nov 2023, Eugene Loh via DTrace-devel outgrape:

> On 11/2/23 09:13, Nick Alcock wrote:
>
>> On 1 Nov 2023, Eugene Loh via DTrace-devel uttered the following:
>>> I don't argue with the patch, but for my personal edification I'd like
>>> to understand the commit message better.  The pre-existing syntax
>>> seemed to have worked perfectly for me and I don't ever remember
>>> encountering the problem described.  Ah well.  The patch is fine
>>> regardless.
>> You don't get any actual runtest-visible error when this happens; the
>> tests don't fail, you just get a syntax error on stderr, and tests don't
>> fail that perhaps should have done. You need to look in the runtest.log
>> to see it.
>>
>> It might be specific to some versions of bash or something, though I'd
>> be rather surprised if it was. This was on OL9, with bash 5.1.8.
>
> Interesting, thanks.  I guess I'll just accept this as some mystery I don't understand and don't need to.  FWIW:
>
> $ cat /etc/oracle-release
> Oracle Linux Server release 9.0

I observed the failure on 9.2 with... the exact same bash. Allegedly. No
doubt the set of patches is different.

> $ bash --version
> GNU bash, version 5.1.8(1)-release (x86_64-redhat-linux-gnu)
> Copyright (C) 2020 Free Software Foundation, Inc.
> License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
>
> This is free software; you are free to change and redistribute it.
> There is NO WARRANTY, to the extent permitted by law.
> $ cat z
> #!/bin/bash
>
> expect=10
> margin=2
> for actual in 6 7 8 9 10 11 12 13 14; do
>     printf " check %10s;  against %10s;  margin %10s:  " $actual $expect $margin
>     if [ $actual -lt $(($expect - $margin)) ]; then
>         echo ERROR too small
>     elif [ $actual -gt $(($expect + $margin)) ]; then
>         echo ERROR too large
>     else
>         echo
>     fi
> done
> $ ./z
>  check          6;  against         10;  margin          2:  ERROR too small
>  check          7;  against         10;  margin          2:  ERROR too small

Yes, I expected exactly that, and was distinctly surprised to find bash
reporting a syntax error! Nonetheless, at least some versions clearly
*do*. Maybe it's a local patch added to the bash package after 9.0 broke
things? Regardless, the fix is trivial and harmless...

-- 
NULL && (void)



More information about the DTrace-devel mailing list