Skip to content

Conversation

@iliasotnikov
Copy link

Description

The change fixes Bash syntax error manifesting itself on RHEL8/9 (Rocky Linux 8/9, to be precise):

...
make -C linuxkm libwolfssl.ko
make[1]: Entering directory '/wolfssl/linuxkm'
bash: -c: line 1: syntax error near unexpected token `}'
bash: -c: line 1: `function resolved_link_is_equal() { [[ -L "$1" && ("$(readlink -f "$1")" == "$(readlink -f "$2")") ]] }'
make[1]: *** [Makefile:145: libwolfssl.ko] Error 2
...

Best reproduced with rockylinux/rockylinux:8 and rockylinux/rockylinux:9 Docker images (Bash versions 4.4.x and 5.1.x, respectively) - the configure options don't seem to matter, since the function in question doesn't use any configuration-dependent logic
Please describe the scope of the fix or feature addition.

Fixes zd# N/A

Testing

Local Docker-based environment (rockylinux/rockylinux:8 and rockylinux/rockylinux:9)

Checklist

  • added tests
  • updated/added doxygen
  • updated appropriate READMEs
  • Updated manual and documentation

The change fixes Bash syntax error manifesting itself on RHEL8/9 (Rocky
Linux 8/9, to be precise):

	...
	make -C linuxkm libwolfssl.ko
	make[1]: Entering directory '/wolfssl/linuxkm'
	bash: -c: line 1: syntax error near unexpected token `}'
	bash: -c: line 1: `function resolved_link_is_equal() { [[ -L "$1" && ("$(readlink -f "$1")" == "$(readlink -f "$2")") ]] }'
	make[1]: *** [Makefile:145: libwolfssl.ko] Error 2
	...

Best reproduced with `rockylinux/rockylinux:8` and
`rockylinux/rockylinux:9` Docker images (Bash versions 4.4.x and 5.1.x,
respecively) - the `configure` options don't seem to matter, since the
function in question doesn't use any configuration-dependent logic
@wolfSSL-Bot
Copy link

Can one of the admins verify this patch?

@iliasotnikov
Copy link
Author

Testing evidence on Rocky Linux 9:

$ cat /etc/os-release
NAME="Rocky Linux"
VERSION="9.6 (Blue Onyx)"
ID="rocky"
ID_LIKE="rhel centos fedora"
VERSION_ID="9.6"
PLATFORM_ID="platform:el9"
PRETTY_NAME="Rocky Linux 9.6 (Blue Onyx)"
ANSI_COLOR="0;32"
LOGO="fedora-logo-icon"
CPE_NAME="cpe:/o:rocky:rocky:9::baseos"
HOME_URL="https://rockylinux.org/"
VENDOR_NAME="RESF"
VENDOR_URL="https://resf.org/"
BUG_REPORT_URL="https://bugs.rockylinux.org/"
SUPPORT_END="2032-05-31"
ROCKY_SUPPORT_PRODUCT="Rocky-Linux-9"
ROCKY_SUPPORT_PRODUCT_VERSION="9.6"
REDHAT_SUPPORT_PRODUCT="Rocky Linux"
REDHAT_SUPPORT_PRODUCT_VERSION="9.6"

$ bash --version
GNU bash, version 5.1.8(1)-release (x86_64-redhat-linux-gnu)

$ ./autogen.sh
...
$ ./configure         --enable-linuxkm         --enable-cryptonly         --enable-aesni         --enable-fips=disabled         --enable-aesni-with-avx         --enable-aesxts         --with-linux-source=/usr/src/kernels/$(rpm -q --queryformat=%{VERSION}-%{RELEASE}.%{ARCH} kernel-devel)     && make module
...
./configure flags: '--enable-linuxkm' '--enable-cryptonly' '--enable-aesni' '--enable-fips=disabled' '--enable-aesni-with-avx' '--enable-aesxts' '--with-linux-source=/usr/src/kernels/5.14.0-570.58.1.el9_6.x86_64'
#20 14.82 ---
#20 14.82 Note: Make sure your application includes "wolfssl/options.h" before any other wolfSSL headers.
#20 14.82       You can define "WOLFSSL_USE_OPTIONS_H" in your application to include this automatically.
#20 14.91 make -C linuxkm libwolfssl.ko
#20 14.92 make[1]: Entering directory '/wolfssl/linuxkm'
#20 14.97 make[2]: Entering directory '/usr/src/kernels/5.14.0-570.58.1.el9_6.x86_64'
#20 15.77   HOSTCC  /wolfssl/linuxkm/linuxkm/get_thread_size
#20 16.01   CC [M]  /wolfssl/linuxkm/wolfcrypt/src/hmac.o
#20 16.52   CC [M]  /wolfssl/linuxkm/wolfcrypt/src/hash.o
#20 17.01   CC [M]  /wolfssl/linuxkm/wolfcrypt/src/cpuid.o
#20 17.36   CC [M]  /wolfssl/linuxkm/wolfcrypt/src/kdf.o
#20 17.78   CC [M]  /wolfssl/linuxkm/wolfcrypt/src/random.o
#20 18.40   CC [M]  /wolfssl/linuxkm/wolfcrypt/src/sha256.o
#20 18.94   CC [M]  /wolfssl/linuxkm/wolfcrypt/src/rsa.o
#20 19.82   CC [M]  /wolfssl/linuxkm/wolfcrypt/src/sp_int.o
#20 21.35   CC [M]  /wolfssl/linuxkm/wolfcrypt/src/aes.o
#20 22.68   CC [M]  /wolfssl/linuxkm/wolfcrypt/src/sha.o
#20 23.19   CC [M]  /wolfssl/linuxkm/wolfcrypt/src/sha512.o
#20 23.95   CC [M]  /wolfssl/linuxkm/wolfcrypt/src/sha3.o
#20 24.49   CC [M]  /wolfssl/linuxkm/wolfcrypt/src/logging.o
#20 24.86   CC [M]  /wolfssl/linuxkm/wolfcrypt/src/wc_port.o
#20 25.34   CC [M]  /wolfssl/linuxkm/wolfcrypt/src/error.o
#20 25.72   CC [M]  /wolfssl/linuxkm/wolfcrypt/src/wc_encrypt.o
#20 26.14   CC [M]  /wolfssl/linuxkm/wolfcrypt/src/signature.o
#20 26.58   CC [M]  /wolfssl/linuxkm/wolfcrypt/src/wolfmath.o
#20 27.04   CC [M]  /wolfssl/linuxkm/wolfcrypt/src/memory.o
#20 27.42   CC [M]  /wolfssl/linuxkm/wolfcrypt/src/dh.o
#20 27.99   CC [M]  /wolfssl/linuxkm/wolfcrypt/src/asn.o
#20 29.98   CC [M]  /wolfssl/linuxkm/wolfcrypt/src/coding.o
#20 30.45   CC [M]  /wolfssl/linuxkm/wolfcrypt/src/poly1305.o
#20 30.89   CC [M]  /wolfssl/linuxkm/wolfcrypt/src/pwdbased.o
#20 31.37   CC [M]  /wolfssl/linuxkm/wolfcrypt/src/pkcs12.o
#20 32.17   AS [M]  /wolfssl/linuxkm/wolfcrypt/src/aes_asm.o
#20 32.21   AS [M]  /wolfssl/linuxkm/wolfcrypt/src/aes_gcm_asm.o
#20 32.27   AS [M]  /wolfssl/linuxkm/wolfcrypt/src/aes_xts_asm.o
#20 32.32   CC [M]  /wolfssl/linuxkm/wolfcrypt/src/chacha.o
#20 32.76   CC [M]  /wolfssl/linuxkm/wolfcrypt/src/chacha20_poly1305.o
#20 33.20   CC [M]  /wolfssl/linuxkm/wolfcrypt/src/ecc.o
#20 34.50   CC [M]  /wolfssl/linuxkm/wolfcrypt/test/test.o
#20 34.57   CC [M]  /wolfssl/linuxkm/linuxkm/module_hooks.o
#20 35.21   CC [M]  /wolfssl/linuxkm/linuxkm/module_exports.o
#20 35.83   LD [M]  /wolfssl/linuxkm/libwolfssl.o
#20 35.94   MODPOST /wolfssl/linuxkm/Module.symvers
#20 36.05   CC [M]  /wolfssl/linuxkm/libwolfssl.mod.o
#20 36.37   LD [M]  /wolfssl/linuxkm/libwolfssl.ko
#20 36.40 Skipping BTF generation for /wolfssl/linuxkm/libwolfssl.ko due to unavailability of vmlinux
#20 36.40   BTF [M] /wolfssl/linuxkm/libwolfssl.ko
#20 36.40 make[2]: Leaving directory '/usr/src/kernels/5.14.0-570.58.1.el9_6.x86_64'
#20 36.40 make[1]: Leaving directory '/wolfssl/linuxkm'
...

@iliasotnikov
Copy link
Author

Testing evidence on Rocky Linux 8:

$ cat /etc/os-release
#18 0.188 NAME="Rocky Linux"
#18 0.188 VERSION="8.10 (Green Obsidian)"
#18 0.188 ID="rocky"
#18 0.188 ID_LIKE="rhel centos fedora"
#18 0.188 VERSION_ID="8.10"
#18 0.188 PLATFORM_ID="platform:el8"
#18 0.188 PRETTY_NAME="Rocky Linux 8.10 (Green Obsidian)"
#18 0.188 ANSI_COLOR="0;32"
#18 0.188 LOGO="fedora-logo-icon"
#18 0.188 CPE_NAME="cpe:/o:rocky:rocky:8:GA"
#18 0.188 HOME_URL="https://rockylinux.org/"
#18 0.188 BUG_REPORT_URL="https://bugs.rockylinux.org/"
#18 0.188 SUPPORT_END="2029-05-31"
#18 0.188 ROCKY_SUPPORT_PRODUCT="Rocky-Linux-8"
#18 0.188 ROCKY_SUPPORT_PRODUCT_VERSION="8.10"
#18 0.188 REDHAT_SUPPORT_PRODUCT="Rocky Linux"
#18 0.188 REDHAT_SUPPORT_PRODUCT_VERSION="8.10"

$ bash --version
#19 0.152 GNU bash, version 4.4.20(1)-release (x86_64-redhat-linux-gnu)
...

$ ./autogen.sh
...

$ ./configure         --enable-linuxkm         --enable-cryptonly         --enable-aesni         --enable-fips=disabled         --enable-aesni-with-avx         --enable-aesxts         --with-linux-source=/usr/src/kernels/$(rpm -q --queryformat=%{VERSION}-%{RELEASE}.%{ARCH} kernel-devel)     && make module
...

./configure flags: '--enable-linuxkm' '--enable-cryptonly' '--enable-aesni' '--enable-fips=disabled' '--enable-aesni-with-avx' '--enable-aesxts' '--with-linux-source=/usr/src/kernels/4.18.0-553.81.1.el8_10.x86_64'
#20 16.11 ---
#20 16.11 Note: Make sure your application includes "wolfssl/options.h" before any other wolfSSL headers.
#20 16.11       You can define "WOLFSSL_USE_OPTIONS_H" in your application to include this automatically.
#20 16.20 make -C linuxkm libwolfssl.ko
#20 16.21 make[1]: Entering directory '/wolfssl/linuxkm'
#20 16.27 make[2]: Entering directory '/usr/src/kernels/4.18.0-553.81.1.el8_10.x86_64'
#20 17.88   CC [M]  /wolfssl/linuxkm/wolfcrypt/src/hmac.o
#20 18.38   CC [M]  /wolfssl/linuxkm/wolfcrypt/src/hash.o
#20 18.84   CC [M]  /wolfssl/linuxkm/wolfcrypt/src/cpuid.o
#20 19.17   CC [M]  /wolfssl/linuxkm/wolfcrypt/src/kdf.o
#20 19.57   CC [M]  /wolfssl/linuxkm/wolfcrypt/src/random.o
#20 20.13   CC [M]  /wolfssl/linuxkm/wolfcrypt/src/sha256.o
#20 20.61   CC [M]  /wolfssl/linuxkm/wolfcrypt/src/rsa.o
#20 21.36   CC [M]  /wolfssl/linuxkm/wolfcrypt/src/sp_int.o
#20 22.96   CC [M]  /wolfssl/linuxkm/wolfcrypt/src/aes.o
#20 25.05   CC [M]  /wolfssl/linuxkm/wolfcrypt/src/sha.o
#20 25.77   CC [M]  /wolfssl/linuxkm/wolfcrypt/src/sha512.o
#20 26.41   CC [M]  /wolfssl/linuxkm/wolfcrypt/src/sha3.o
#20 26.97   CC [M]  /wolfssl/linuxkm/wolfcrypt/src/logging.o
#20 27.29   CC [M]  /wolfssl/linuxkm/wolfcrypt/src/wc_port.o
#20 27.68   CC [M]  /wolfssl/linuxkm/wolfcrypt/src/error.o
#20 28.08   CC [M]  /wolfssl/linuxkm/wolfcrypt/src/wc_encrypt.o
#20 28.57   CC [M]  /wolfssl/linuxkm/wolfcrypt/src/signature.o
#20 29.09   CC [M]  /wolfssl/linuxkm/wolfcrypt/src/wolfmath.o
#20 29.51   CC [M]  /wolfssl/linuxkm/wolfcrypt/src/memory.o
#20 29.85   CC [M]  /wolfssl/linuxkm/wolfcrypt/src/dh.o
#20 30.42   CC [M]  /wolfssl/linuxkm/wolfcrypt/src/asn.o
#20 32.44   CC [M]  /wolfssl/linuxkm/wolfcrypt/src/coding.o
#20 33.07   CC [M]  /wolfssl/linuxkm/wolfcrypt/src/poly1305.o
#20 33.55   CC [M]  /wolfssl/linuxkm/wolfcrypt/src/pwdbased.o
#20 34.36   CC [M]  /wolfssl/linuxkm/wolfcrypt/src/pkcs12.o
#20 35.26   AS [M]  /wolfssl/linuxkm/wolfcrypt/src/aes_asm.o
#20 35.31   AS [M]  /wolfssl/linuxkm/wolfcrypt/src/aes_gcm_asm.o
#20 35.38   AS [M]  /wolfssl/linuxkm/wolfcrypt/src/aes_xts_asm.o
#20 35.45   CC [M]  /wolfssl/linuxkm/wolfcrypt/src/chacha.o
#20 36.09   CC [M]  /wolfssl/linuxkm/wolfcrypt/src/chacha20_poly1305.o
#20 36.55   CC [M]  /wolfssl/linuxkm/wolfcrypt/src/ecc.o
#20 37.82   CC [M]  /wolfssl/linuxkm/wolfcrypt/test/test.o
#20 37.95   CC [M]  /wolfssl/linuxkm/linuxkm/module_hooks.o
#20 38.80   CC [M]  /wolfssl/linuxkm/linuxkm/module_exports.o
#20 40.69   LD [M]  /wolfssl/linuxkm/libwolfssl.o
#20 40.77   Building modules, stage 2.
#20 40.83   MODPOST 1 modules
#20 40.96   CC      /wolfssl/linuxkm/libwolfssl.mod.o
#20 41.14   LD [M]  /wolfssl/linuxkm/libwolfssl.ko
#20 41.16 make[2]: Leaving directory '/usr/src/kernels/4.18.0-553.81.1.el8_10.x86_64'
#20 41.16 make[1]: Leaving directory '/wolfssl/linuxkm'

@embhorn embhorn self-assigned this Nov 12, 2025
@embhorn
Copy link
Member

embhorn commented Nov 12, 2025

Hi @iliasotnikov

On the support ticket you opened I asked you to review the contributor agreement. Once that has been approved, this PR can be evaluated.

Thanks,
@embhorn

@embhorn embhorn requested a review from douzzer November 12, 2025 14:04
@iliasotnikov
Copy link
Author

On the support ticket you opened I asked you to review the contributor agreement. Once that has been approved, this PR can be evaluated.

Thanks, Eric - I'll have it reviewed with my management, will post an update then.

@douzzer
Copy link
Contributor

douzzer commented Nov 15, 2025

Hi @iliasotnikov -- this is a good fix, and in fact we had developed a similar solution simultaneously and independently. It's fixed in #9438, which should merge early in the coming week.

It seems to be a bash bug, by the way -- bash 5.x doesn't have a problem with the original syntax -- but we aim for maximum portability.

@douzzer douzzer closed this Nov 15, 2025
@iliasotnikov
Copy link
Author

Thanks much, @douzzer! Either way works here, will await for #9438.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants