From 0cd1529008f6cdb4ea741bb0347a9ff02570715c Mon Sep 17 00:00:00 2001 From: Classic298 <27028174+Classic298@users.noreply.github.com> Date: Fri, 15 May 2026 02:29:25 +0200 Subject: [PATCH] fix: default optional env vars used with bash `,,` in start.sh (#24683) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit start.sh runs with `set -euo pipefail`, but three call sites added in 070ab2650 (refac: reorganize scripts and ci workflows) reference optional env vars via bash's `,,` lowercase expansion without any default. Containers that don't set these vars — the default for every deployment that isn't explicitly opting into Playwright / bundled Ollama / CUDA — crash on startup with: start.sh: line 15: WEB_LOADER_ENGINE: unbound variable (and the same for USE_OLLAMA_DOCKER, USE_CUDA_DOCKER once the first were set in turn.) Reported in open-webui#24560 by urbenlegend. The same refactor correctly defaulted every other optional env var with `${VAR:-…}`. The three `,,` references slipped through because bash can't combine `:-default` with `,,` in a single substitution — `${VAR:-default,,}` makes the default literal `,,`, not what's wanted. Fix: normalise the three vars in a one-line preamble with `${VAR:=}`, which assigns an empty default if unset. The downstream `${VAR,,}` expressions stay exactly as Tim wrote them, preserving the file's visual style and matching the existing `${VAR:-…}` idiom for "this variable is optional". --- backend/start.sh | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/backend/start.sh b/backend/start.sh index fd283d31fd..9e65465095 100755 --- a/backend/start.sh +++ b/backend/start.sh @@ -7,6 +7,12 @@ set -euo pipefail # HuggingFace Space deployment, and launches the uvicorn server. # --------------------------------------------------------------------------- +# Default optional env vars that we test below with bash's `,,` lowercase +# expansion. The two can't be combined inline (`${VAR:-default,,}` makes +# the default literal `,,`), so we normalise once up front and the simple +# `${VAR,,}` form stays safe under `set -u` everywhere else. +: "${WEB_LOADER_ENGINE:=}" "${USE_OLLAMA_DOCKER:=}" "${USE_CUDA_DOCKER:=}" + SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd) cd "$SCRIPT_DIR" || exit 1