From d2916decb3d948b7e404ee839d7542692bf18d92 Mon Sep 17 00:00:00 2001 From: "Dylan M. Taylor" Date: Tue, 10 Nov 2026 19:19:40 -0500 Subject: [PATCH] packaging: use [[ for bash tests (SonarCloud S7688) (#6932) Behaviour-preserving: `[[ ]]` in place of `[ ]` for bash tests (SonarCloud shell:S7688). Every script has a bash shebang; no test uses `-a`/`-o`, escaped parentheses or an unquoted pattern on the right of `=`. `bash -n` passes on each script; the rest is left to CI. - `packaging/freebsd/package.sh` --- packaging/freebsd/package.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/packaging/freebsd/package.sh b/packaging/freebsd/package.sh index 0533be9010..b81d33e565 100755 --- a/packaging/freebsd/package.sh +++ b/packaging/freebsd/package.sh @@ -43,7 +43,7 @@ esac # Only binaries for this machine run here (the --version check at the end); a FreeBSD target built # on another OS never does. HOST_ARCH="$(release_arch "$(uname -m)" 2>/dev/null)" || HOST_ARCH="$(uname -m)" -if [ -n "${CARGO_BUILD_TARGET:-}" ] && [ "$(uname -s)" != FreeBSD ]; then +if [[ -n "${CARGO_BUILD_TARGET:-}" ]] && [[ "$(uname -s)" != FreeBSD ]]; then HOST_ARCH="$(uname -s) $HOST_ARCH" fi BASENAME="pdfcraft-$VERSION-freebsd-$ARCH" @@ -74,12 +74,12 @@ copy_docs "$STAGE/share/doc/pdfcraft" # which has to run here: build it for this machine, not for CARGO_BUILD_TARGET. (unset CARGO_BUILD_TARGET; stage_models "$STAGE/share/pdfcraft/models") -if [ -z "${CARGO_BUILD_TARGET:-}" ] && [ "$ARCH" = "$HOST_ARCH" ]; then +if [[ -z "${CARGO_BUILD_TARGET:-}" ]] && [[ "$ARCH" = "$HOST_ARCH" ]]; then "$STAGE/bin/pdfcraft" --version else # They cannot run here, so check what they are instead: executables, not libraries or objects. # An older file(1) calls a PIE a shared object; its interpreter still marks it as a program. - want="$ARCH"; [ "$ARCH" != x86_64 ] || want=x86-64 + want="$ARCH"; [[ "$ARCH" != x86_64 ]] || want=x86-64 for b in "$STAGE"/bin/*; do case "$(file -b "$b")" in ELF*" executable, "*"$want"*FreeBSD* | ELF*"$want"*FreeBSD*interpreter*) ;;