Repository navigation
fix(mode-switch): use portable case folding for Bash 3.2 compatibility - #7843
Merged
Lightheartdevs merged 2 commits intoOct 22, 2026
Merged
Conversation
ods/scripts/mode-switch.sh lines 79 and 90 previously used Bash 4+ parameter
case expansion ${configured_backend,,} and ${switchboard_mode,,}. Under
macOS default /bin/bash 3.2.57, running mode-switch.sh causes the shell
to abort immediately with a syntax error:
/bin/bash: ${configured_backend,,}: bad substitution (exit 1).
This replaces ${var,,} with printf '%s' "$var" | tr '[:upper:]' '[:lower:]',
restoring portable case-folding compatibility across Bash 3.2 and Bash 5+.
Adds regression assertions in ods/tests/test-mode-switch-status.sh.
Collaborator
|
Thanks for fixing the macOS Bash 3.2 failure while preserving the external-backend and switchboard guards. Advisory status: not ready yet Quickest path to merge:
What I checked:
|
Contributor
Author
|
@Lightheartdevs , updated PR status:
|
Collaborator
|
Thanks for fixing stock Bash compatibility and following through on the earlier review feedback. Advisory status: looks merge-ready What looks good:
What I checked:
|
6 of 24 tasks
Lightheartdevs
added a commit
that referenced
this pull request
Oct 23, 2026
* fix(preflight): run the LLM route check under macOS Bash 3.2
ods-preflight.sh is #!/bin/bash, which is Bash 3.2 on macOS, and sources
lib/preflight-llm-route.sh. Its ${mode,,} is Bash 4 syntax, so on a Mac
the preflight aborted at "[4/8] Checking LLM endpoint" with "bad
substitution" in every mode. Lowercase with tr instead, as #7843 did for
mode-switch.sh, and test the selector under /bin/bash.
* test(macos): exercise preflight selector with stock Bash 3.2
---------
Co-authored-by: Roshan Kumar Gupta <31376345+roshangupta00750@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Under macOS default
/bin/bash(Bash 3.2.57), runningods/scripts/mode-switch.shcrashes immediately with a syntax error:/bin/bash: ${configured_backend,,}: bad substitution(exit code 1).Lines 79 and 90 previously used Bash 4+ case-modification parameter expansion
${configured_backend,,}and${switchboard_mode,,}. This replaces${var,,}withprintf '%s' "$var" | tr '[:upper:]' '[:lower:]', which is fully portable across POSIX, Bash 3.2, and Bash 5+.Behavior differences versus main:
mode-switch.shsucceeds under/bin/bash3.2 on macOS instead of failing with exit code 1.tr '[:upper:]' '[:lower:]'(ASCII transliteration) instead of Bash 4${var,,}(locale-aware). For ASCII configuration tokens (external,enabled), behavior is identical.trfor each variable lookup (once per invocation; negligible execution overhead)../install.sh --no-external-llm) and switchboard environment updates remain identical.Follow-up to prior PR #5880 on
public-beta(byvaibhavsrv), which was closed during the branch retirement sweep on 2026-10-04 with maintainer guidance to rebase ontomain.AI Assistance
AI drafted the fix and tests and ran the checks. The human author reviewed the final diff on 2026-10-21.
Release Lane
release/2.6.xmainStable hotfix reason:
Changed Surface
Risk And Validation
git diff --checkrelease/2.6.xCommands/results:
Operational Change Check
If this PR touches installer phases, bootstrap logic, compose stack generation,
service manifests, dashboard API control flows, Hermes, model routing, GPU or
runtime detection, lifecycle commands, host mutation, or network exposure, it
requires release-grade fleet validation before release unless the PR explains a
narrower equivalent.
Notes For Reviewers
Overlap check:
patil2001,fix(env): preserve final newline during upserts): touchesenv_set()inods/scripts/mode-switch.shat line 37. This PR touchesswitch_mode()at lines 79 and 90. No overlap or semantic collision.vaibhavsrv, closed 2026-10-04 onpublic-betadeprecation): rebased onto currentmainper maintainer instructions in Pull request queue cleanup (2026-10-04): what happened and how to resubmit #7253.Limits:
ods/scripts/mode-switch.shand its regression testods/tests/test-mode-switch-status.sh./bin/bash3.2 execution block runs on macOS; in CI under Linux, compatibility is guarded by the syntax check grep for non-portable case expansion.install-macos.shandods-macos.shrequire Homebrew Bash 4+ (brew install bash), andods-clire-execs Homebrew Bash. This fix specifically protects users or scripts invokingmode-switch.shdirectly under stock macOS/bin/bash.