test/system: Test fixes due to changed behavior in new bash version#1699
test/system: Test fixes due to changed behavior in new bash version#1699debarshiray merged 2 commits intocontainers:mainfrom
Conversation
|
Build succeeded. ✔️ unit-test SUCCESS in 2m 11s |
debarshiray
left a comment
There was a problem hiding this comment.
Thanks for fixing the tests, @DaliborKr ! It looks good to me.
You made me curious and I went digging into the Bash sources to understand the exact change more.
I was able to reproduce the problem with just:
$ exec /etc
...I was able to narrow it down to Bash commit b8c60bc9ca365f82. See how exec_builtin() handles EX_NOEXEC and EISDIR from shell_execve() to avoid printing a duplicate error message.
Bash is a weird project. It creates one massive commit for each release, so it's either very difficult or impossible to understand the changes. :)
Bash 5.3.0 changed the error messages shown by its exec built-in [1].
With Bash 5.2.37:
$ exec /etc
bash: /etc: Is a directory
bash: exec: /etc: cannot execute: Is a directory
With Bash 5.3.0:
$ exec /etc
bash: /etc: Is a directory
The 'assert' function cannot directly handle compound commands. So,
those need to be wrapped in 'bash -c "..."' [2].
[1] Bash commit b8c60bc9ca365f82
See how exec_builtin() handles EX_NOEXEC and EISDIR from
shell_execve() to avoid printing a duplicate error message.
https://cgit.git.savannah.gnu.org/cgit/bash.git/commit/?id=b8c60bc9ca365f82
[2] https://github.com/bats-core/bats-assert
containers#1688
containers#1699
b65296e to
0907287
Compare
I updated the commit message to add a reference to the Bash change. |
Detected by https://www.shellcheck.net/: Line 1255: if ! localtime_target=$(readlink /etc/localtime >/dev/null 2>&3) \ ^-- SC2327 (warning): This command substitution will be empty because the command's output gets redirected away. ^-- SC2328 (error): This redirection takes output away from the command substitution. See: https://www.shellcheck.net/wiki/SC2327 https://www.shellcheck.net/wiki/SC2328 Fallout from 8db414d containers#1701
Bash 5.3.0 changed the error messages shown by its exec built-in [1].
With Bash 5.2.37:
$ exec /etc
bash: /etc: Is a directory
bash: exec: /etc: cannot execute: Is a directory
With Bash 5.3.0:
$ exec /etc
bash: /etc: Is a directory
The 'assert' function cannot directly handle compound commands. So,
those need to be wrapped in 'bash -c "..."' [2].
[1] Bash commit b8c60bc9ca365f82
See how exec_builtin() handles EX_NOEXEC and EISDIR from
shell_execve() to avoid printing a duplicate error message.
https://cgit.git.savannah.gnu.org/cgit/bash.git/commit/?id=b8c60bc9ca365f82
[2] https://github.com/bats-core/bats-assert
containers#1688
containers#1699
0907287 to
6c98db6
Compare
|
Build failed. ✔️ unit-test SUCCESS in 2m 28s |
|
recheck |
|
Damn! The CI timed out. I'll merge once it passes. |
|
Build succeeded. ✔️ unit-test SUCCESS in 2m 18s |
Bash 5.3.0 changed the error messages shown by its exec built-in [1].
With Bash 5.2.37:
$ exec /etc
bash: /etc: Is a directory
bash: exec: /etc: cannot execute: Is a directory
With Bash 5.3.0:
$ exec /etc
bash: /etc: Is a directory
The 'assert' function cannot directly handle compound commands. So,
those need to be wrapped in 'bash -c "..."' [2].
[1] Bash commit b8c60bc9ca365f82
See how exec_builtin() handles EX_NOEXEC and EISDIR from
shell_execve() to avoid printing a duplicate error message.
https://cgit.git.savannah.gnu.org/cgit/bash.git/commit/?id=b8c60bc9ca365f82
[2] https://github.com/bats-core/bats-assert
containers#1688
containers#1699
containers#1739
(backported from commit 6c98db6)
Bash 5.3.0 changed the error messages shown by its exec built-in [1].
With Bash 5.2.37:
$ exec /etc
bash: /etc: Is a directory
bash: exec: /etc: cannot execute: Is a directory
With Bash 5.3.0:
$ exec /etc
bash: /etc: Is a directory
The 'assert' function cannot directly handle compound commands. So,
those need to be wrapped in 'bash -c "..."' [2].
[1] Bash commit b8c60bc9ca365f82
See how exec_builtin() handles EX_NOEXEC and EISDIR from
shell_execve() to avoid printing a duplicate error message.
https://cgit.git.savannah.gnu.org/cgit/bash.git/commit/?id=b8c60bc9ca365f82
[2] https://github.com/bats-core/bats-assert
containers#1688
containers#1699
containers#1739
containers#1743
(backported from commit 6c98db6)
(cherry picked from commit 0090893)
Bash 5.3.0 changed the error messages shown by its exec built-in [1].
With Bash 5.2.37:
$ exec /etc
bash: /etc: Is a directory
bash: exec: /etc: cannot execute: Is a directory
With Bash 5.3.0:
$ exec /etc
bash: /etc: Is a directory
The 'assert' function cannot directly handle compound commands. So,
those need to be wrapped in 'bash -c "..."' [2].
[1] Bash commit b8c60bc9ca365f82
See how exec_builtin() handles EX_NOEXEC and EISDIR from
shell_execve() to avoid printing a duplicate error message.
https://cgit.git.savannah.gnu.org/cgit/bash.git/commit/?id=b8c60bc9ca365f82
[2] https://github.com/bats-core/bats-assert
containers#1688
containers#1699
containers#1739
containers#1744
(backported from commit 6c98db6)
(cherry picked from commit 0090893)
In the new version of bash, the error output has been changed, and this caused a test failure in Toolbx CI on Fedora Rawhide.
#1688 (review)