Error Message:
$ BATS_LIB_PATH=/usr/lib/bats bats test/assert_output.bats
✗ assert_output() --regexp <regexp>: returns 1 and displays an error message if <regexp> is not a valid extended regular expression
(from function `assert_test_fail' in file test/test_helper.bash, line 28,
in test file test/assert_output.bats, line 257)
`assert_test_fail <<'ERR_MSG'' failed
Check the error message and find that one extra line is in output, it is from bash 5.3
// before
result = sh_regmatch (arg1, arg2, mflags);
// after
errstr = NULL;
result = sh_regmatch (arg1, arg2, mflags, &errstr);
if (result == 2)
{
if (errstr && *errstr)
builtin_error (_("invalid regular expression `%s': %s"), arg2, errstr);
else
builtin_error (_("invalid regular expression `%s'"), arg2);
free (errstr);
}
https://github.com/bminor/bash/commit/b8c60bc9ca365f8261fa97900b6fa939f6ebc303
so it is easy to reproduce this case:
$ [[ '' =~ [.* ]]
bash: [[: invalid regular expression `[.*': Missing ']'
$ bash --version
GNU bash, version 5.3.3(1)-release (x86_64-alpine-linux-musl)
Error Message:
Check the error message and find that one extra line is in output, it is from bash 5.3
https://github.com/bminor/bash/commit/b8c60bc9ca365f8261fa97900b6fa939f6ebc303
so it is easy to reproduce this case: