From 4f452514dc13b961ea8f483bf9703992c348b7c7 Mon Sep 17 00:00:00 2001 From: Krystie Date: Thu, 25 Jun 2026 00:35:51 -0700 Subject: [PATCH] build: run configure under bash (autoconf 2.73 backtick quoting breaks dash) Run #472 (post -W no-error fix) got past autoreconf but failed in ./configure: ./configure: line 11244: syntax error near unexpected token `as_ac_var=`printf '%s\n' "ac_cv_func_$ac_func" | sed "$as_sed_sh"`` autoconf 2.73's generated configure uses backtick command substitution inside variable assignments with nested quoting. dash/MSYS2's /bin/sh parses this as a syntax error because the inner backticks don't nest cleanly inside the outer backtick expression. Force CONFIG_SHELL=bash and invoke configure via "$CONFIG_SHELL" so the generated script is parsed by bash regardless of platform (MSYS2 MINGW64 defaults to dash for /bin/sh, which is what bit us). --- src/tor/build-libtor.sh | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/tor/build-libtor.sh b/src/tor/build-libtor.sh index 5be8a28..b8a7f3e 100644 --- a/src/tor/build-libtor.sh +++ b/src/tor/build-libtor.sh @@ -17,7 +17,12 @@ if [[ ! -x "./configure" ]] || [[ "${AUTORECONF_FORCE:-0}" == "1" ]]; then fi echo "Configuring Tor static library build from: $TOR_SRC_DIR" -./configure \ +# autoconf 2.73's generated ./configure uses backtick command substitution +# inside variable assignments (e.g. `as_ac_var=\`printf ... | sed ...\``) +# which dash/MSYS2's /bin/sh rejects with a syntax error. Force bash +# explicitly so the same script works on Windows MSYS2 and macOS/Linux. +export CONFIG_SHELL="${CONFIG_SHELL:-$(command -v bash)}" +"$CONFIG_SHELL" ./configure \ --enable-static-tor \ --disable-module-relay \ --disable-module-dirauth \