Skip to content

Source ~/.bashrc in bash bootstrap so user aliases are not silently dropped - #16666

Open
CuriousTank wants to merge 1 commit into
warpdotdev:masterfrom
CuriousTank:fix/ssh-alias-bashrc-bootstrap
Open

CuriousTank wants to merge 1 commit into
warpdotdev:masterfrom
CuriousTank:fix/ssh-alias-bashrc-bootstrap

Conversation

@CuriousTank

Copy link
Copy Markdown

Description

Fixes #16631.

The bash bootstrap emulates a login sequence (/etc/profile → ~/.bash_profile | ~/.bash_login | ~/.profile) and never reads ~/.bashrc — but Warp runs bash as an interactive shell, and ~/.bashrc is where interactive bash config (aliases, functions) normally lives. So anything defined only there works in gnome-terminal or kitty but silently doesn't exist inside Warp.

The nastiest version of this: the bootstrap installs its own ssh() function before sourcing user rcfiles. A user with alias ssh="trzsz -d ssh" in ~/.bashrc (a common drag-and-drop upload setup) never gets the alias, and every interactive ssh falls through to the bootstrap's function — the wrapper is bypassed with no warning. That's the case reported in #16631.

The fix mirrors the interactive startup sequence after the login files: source ~/.bashrc for interactive shells, guarded by a sentinel env var so users whose login rcfile already re-sources ~/.bashrc don't get it twice. No changes to the takeover logic itself — since bash resolves aliases before functions, a user alias now simply wins over the ssh() function, and sessions without such an alias behave exactly as before.

zsh (.zshrc is already in its bootstrap sequence) and fish (config.fish is loaded natively) were never affected.

Linked Issue

  • The linked issue is labeled ready-to-spec or ready-to-implement.

#16631 is triaged as bug / area:ssh / repro:high but hasn't received ready-to-implement yet. Happy to wait for the label — mentioning it here so it's visible rather than trying to slip past the gate.

Testing

  • I have manually tested my changes locally with ./script/run

Added test_bash_bootstraps_sources_bashrc_aliases: an alias living solely in ~/.bashrc, a .bash_profile that does not re-source it (the reporter's layout). After bootstrap, running ssh must execute the alias — if the fix regresses, ssh reaches the bootstrap's ssh() function instead and the assertion fails. Also added a ShellRcType::BashRc helper so tests can target ~/.bashrc; write_all_rc_files_for_test skips that variant so existing "sourced once" assertions stay meaningful.

What I ran locally (Linux, bash 5.0):

  • ./script/lint_shellcheck — clean
  • ./script/format --check — clean
  • new integration test, 3 runs — pass
  • test_rc_files_only_sourced_once_during_bootstrapping, test_alias_guards_on_ps1_set, test_bash_bootstraps_with_prompt_command_array, test_custom_ps1_expansion_bash — all pass
  • built and ran the app from source: with alias ssh="trzsz -d ssh" in ~/.bashrc and no re-sourcing in ~/.bash_profile, type ssh inside Warp now shows the alias and ssh user@host goes through trzsz; \ssh user@host still warpifies as before. Also checked the no-~/.bashrc and already-re-sourced layouts — no double-sourcing, no behavior change.

Screenshots / Videos

No visible UI surface — the change only affects which rcfiles the bash bootstrap sources.

CHANGELOG-BUG-FIX: bash bootstrap now sources ~/.bashrc, so aliases and functions defined there (e.g. ssh wrappers like trzsz) are no longer silently dropped in Warp

Agent Mode

  • Warp Agent Mode - This PR was created via Warp's AI Agent Mode

…ropped (warpdotdev#16631)

The bash bootstrap emulates a login sequence (/etc/profile ->
~/.bash_profile | ~/.bash_login | ~/.profile) and never reads
~/.bashrc, even though Warp runs bash as an interactive shell.
Aliases and functions that live only in ~/.bashrc therefore never
exist inside Warp while working fine in other terminals. The most
visible casualty: a user wrapper like alias ssh="trzsz -d ssh" is
silently dropped, and the bootstrap's own ssh() function takes over
interactive ssh invocations, bypassing the wrapper.

Mirror the interactive startup sequence after the login files: source
~/.bashrc for interactive shells, guarded by a sentinel so users whose
login rcfile already re-sources ~/.bashrc don't get it twice. Since
bash resolves aliases before functions, a user ssh alias now wins over
the bootstrap's ssh() function naturally; sessions without such an
alias keep warpifying exactly as before.

Adds an integration test (test_bash_bootstraps_sources_bashrc_aliases)
with an alias living solely in ~/.bashrc, plus a ShellRcType::BashRc
helper variant so tests can target ~/.bashrc. write_all_rc_files_for_test
skips the new variant to keep existing 'sourced once' assertions
meaningful.
@github-actions github-actions Bot added the external-contributor Indicates that a PR has been opened by someone outside the Warp team. label Oct 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

external-contributor Indicates that a PR has been opened by someone outside the Warp team.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

SSH integration takes over ssh shell aliases, silently breaking wrapper tools like trzsz

1 participant