Re: [PATCH v2 1/4] tests/erofs_test: Fix mkfs.erofs version test to not use process substitution bashism

Daniel Kiper
2025-11-12T21:50:21Z

On Sun, Nov 09, 2025 at 09:56:29PM -0600, Glenn Washburn wrote:
> The shell used to run the tests is generally /bin/sh, which does not
> support process substitution.
>
> Fixes: b990df0bef9e (tests/util/grub-fs-tester: Fix EROFS label tests in grub-fs-tester)
> Signed-off-by: Glenn Washburn <development@efficientek.com>
> ---
> tests/util/grub-fs-tester.in | 8 ++++----
> 1 file changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/tests/util/grub-fs-tester.in b/tests/util/grub-fs-tester.in
> index cac58dafa8ad..106edfa8a0f4 100644
> --- a/tests/util/grub-fs-tester.in
> +++ b/tests/util/grub-fs-tester.in
> @@ -596,11 +596,11 @@ for LOGSECSIZE in $(range "$MINLOGSECSIZE" "$MAXLOGSECSIZE" 1); do
> | x"minix3" | xreiserfs_old)
> NOFSLABEL=y;;
> x"erofs_"*)
> - MKFS_EROFS_VERSION=$(mkfs.erofs -V 2>/dev/null | tr ' ' '\n' | grep '^[0-9]')
> - # check if the version is at least 1.6

Why do you drop this comment?

> - if [ $(sort -V <(echo "$MKFS_EROFS_VERSION") <(echo "1.6") | head -n 1) != "1.6" ]; then
> + VER=$(mkfs.erofs 2>/dev/null | head -n1 | (read _ V; echo $V))

I would avoid here so generic name as VER. So, s/VER/MKFS_EROFS_VERSION/...

s/head -n1/head -n 1/

> + if [ "$(echo -e "${VER}\n1.6" | sort -V | head -n1)" != "1.6" ]; then

s/head -n1/head -n 1/

> NOFSLABEL=y
> - fi
> + unset FSLABEL
> + fi;;
> esac

Daniel