From 9ddb1de633bde6d3d3e9b8012f822eb447db5195 Mon Sep 17 00:00:00 2001 From: pakrym-oai Date: Fri, 5 Jun 2026 09:38:26 -0700 Subject: [PATCH] [codex] Add /usr/bin/bash shell fallback (#26538) ## Why Some Linux environments expose `bash` at `/usr/bin/bash` instead of `/bin/bash`. The shell detection fallback list should cover both standard locations once PATH/user-shell probing fails. Stacked on #26480. ## What changed - Add `/usr/bin/bash` to the bash fallback path list in `codex-shell-command`. - Extend shell type detection coverage for `/usr/bin/bash`. - Add AGENTS.md testing guidance to avoid tests for statically defined values and negative tests for removed logic. ## Verification - `just test -p codex-shell-command` --- AGENTS.md | 2 ++ codex-rs/shell-command/src/shell_detect.rs | 6 +++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/AGENTS.md b/AGENTS.md index 88d3fc4ee..4666566f9 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -26,6 +26,8 @@ In the codex-rs folder where the rust code lives: - Implementations may still use `async fn foo(&self, ...) -> T` when they satisfy that contract. - Do not use `#[allow(async_fn_in_trait)]` as a shortcut around spelling the future contract explicitly. - When writing tests, prefer comparing the equality of entire objects over fields one by one. +- Do not add tests for values that are statically defined. +- Do not add negative tests for logic that was removed. - Do not add general product or user-facing documentation to the `docs/` folder. The official Codex documentation lives elsewhere. The exception is app-server API documentation, which is covered by the app-server guidance below. - Prefer private modules and explicitly exported public crate API. - If you change `ConfigToml` or nested config types, run `just write-config-schema` to update `codex-rs/core/config.schema.json`. diff --git a/codex-rs/shell-command/src/shell_detect.rs b/codex-rs/shell-command/src/shell_detect.rs index 706846383..69a66f056 100644 --- a/codex-rs/shell-command/src/shell_detect.rs +++ b/codex-rs/shell-command/src/shell_detect.rs @@ -174,7 +174,7 @@ fn get_zsh_shell(path: Option<&PathBuf>) -> Option { }) } -const BASH_FALLBACK_PATHS: &[&str] = &["/bin/bash"]; +const BASH_FALLBACK_PATHS: &[&str] = &["/bin/bash", "/usr/bin/bash"]; fn get_bash_shell(path: Option<&PathBuf>) -> Option { let shell_path = get_shell_path(ShellType::Bash, path, "bash", BASH_FALLBACK_PATHS); @@ -327,6 +327,10 @@ mod tests { detect_shell_type(PathBuf::from("/bin/bash")), Some(ShellType::Bash) ); + assert_eq!( + detect_shell_type(PathBuf::from("/usr/bin/bash")), + Some(ShellType::Bash) + ); assert_eq!( detect_shell_type(PathBuf::from("powershell.exe")), Some(ShellType::PowerShell)