Skip to content

fix os detection on macOS with bash 3.2#28

Merged
pschmitt merged 1 commit intopschmitt:mainfrom
rickydtran:master
Mar 10, 2026
Merged

fix os detection on macOS with bash 3.2#28
pschmitt merged 1 commit intopschmitt:mainfrom
rickydtran:master

Conversation

@rickydtran
Copy link
Contributor

@rickydtran rickydtran commented Mar 4, 2026

macOS ships /bin/bash 3.2.57 which doesn't support ${os,,} (added in bash 4.0). When /usr/bin/env bash resolves to the system bash, is_macos() and is_linux() silently fail with bad substitution, so get_child_cmds never takes the macOS code path and SSH detection breaks — the split just opens a local shell.

Replace ${os,,} with tr '[:upper:]' '[:lower:]' <<< "$os" which works on all bash versions.

@coderabbitai
Copy link

coderabbitai bot commented Mar 4, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: c105c989-ec40-4f73-8504-8d21c8bd35c6

📥 Commits

Reviewing files that changed from the base of the PR and between 5f1c852 and dacb8fd.

📒 Files selected for processing (1)
  • scripts/tmux-ssh-split.sh

📝 Walkthrough

Walkthrough

The pull request replaces Bash parameter expansion-based lowercasing with external tr command invocations in the is_linux and is_macos functions within the tmux SSH split script. The semantic behavior remains unchanged.

Changes

Cohort / File(s) Summary
Lowercasing Method Refactor
scripts/tmux-ssh-split.sh
Replaced bash parameter expansion (${var,,}) with tr command for lowercasing OS names in is_linux and is_macos functions. Functional behavior preserved.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

Poem

🐰 A rabbit hops through shell commands true,
From ${var,,} to tr anew,
The logic stays, just dressed in different clothes,
Where darwin and linux flow!

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main change: replacing Bash-specific parameter expansion with shell-portable lowercasing to fix OS detection in zsh.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Tip

Try Coding Plans. Let us write the prompt for your AI agent so you can ship faster (with fewer bugs).
Share your feedback on Discord.


Comment @coderabbitai help to get the list of available commands and usage tips.

@pschmitt
Copy link
Owner

pschmitt commented Mar 5, 2026

My default shell is set to zsh too. I never encountered the issue you describe.
There's a bash shebang on top of the script.
How can i repro the issue?

@rickydtran
Copy link
Contributor Author

rickydtran commented Mar 9, 2026

My default shell is set to zsh too. I never encountered the issue you describe. There's a bash shebang on top of the script. How can i repro the issue?

I believe it's actually an old bash combat problem. I'm on macOS and had whatever it came shipped with bash 3.2.
I just installed a newer version bash 5.3 through brew without the changes and it worked. Looks like ${os,,} was added in bash 4.0.

Applied the <<< suggestion too, thanks. I'll update the PR and amend the commit

@rickydtran rickydtran changed the title fix os detection when script is run under zsh fix os detection on macOS with bash 3.2 Mar 9, 2026
@pschmitt pschmitt merged commit cf45776 into pschmitt:main Mar 10, 2026
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.

2 participants