Fix launching remote Bash with shell integration enabled#474
Merged
Conversation
Remote bash with shell integration built the argv as `/bin/bash -i --rcfile FILE`. Bash rejects long options that follow single-character ones, so it failed at launch with "/bin/bash: --: invalid option". Swap the append order so the integration args (bash's --rcfile/--posix, fish's -C) lead the -i/-l defaults. The order is immaterial for zsh (no integration args) and fish, and harmless for local bash (--posix/--login are order-independent). Document the long-before-short requirement for user-supplied bash args in `ghostel-shell' and `ghostel-tramp-shells'.
dakra
force-pushed
the
fix-remote-bash-arg-order
branch
from
June 26, 2026 12:25
e8604b7 to
daccaa2
Compare
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.
Problem
Starting a remote Bash shell over TRAMP with
ghostel-tramp-shell-integrationenabled fails at launch:ghostel assembled the argv as
/bin/bash -i --rcfile FILE. Bash requires all multi-character (long) options to come before any single-character options, so the long--rcfilefollowing the short-iis rejected.This is the same bug as #470; this PR fixes it at the source rather than with a post-hoc argument sort.
Fix
shell-argsis built by appending two groups: the login/interactive defaults (-i/-l) and the integration args (bash's--rcfile/--posix, fish's-C). The fix simply swaps the append order so the integration args lead:For remote Bash this yields
/bin/bash --rcfile FILE -i, which launches cleanly. The reorder is:nil),-Cstays adjacent to its value),--posix/--loginare order-independent).User-supplied bash args are not reordered within their own list, so the long-before-short requirement is now documented in the
ghostel-shellandghostel-tramp-shellsdocstrings.Verification
make -j8 allpasses (build + tests + lint).--: invalid optionfailure without the change, and confirmed a clean interactive prompt with it.