Repository navigation
fix: run plugin host scripts under sh when the login shell is fish - #1806
Open
ZacharyZcR wants to merge 1 commit into
Open
ZacharyZcR wants to merge 1 commit into
ZacharyZcR wants to merge 1 commit into
Conversation
scriptShell() returned POSIX shell code (if [ ... ]; then exec bash -s; fi) as the SSH command, which the host hands to the user's login shell. fish and csh cannot parse it, so plugins such as Samba and Users failed on those hosts with a syntax error. The command is now that code quoted for sh -c, which any login shell runs as a plain command. passwordSudoScript() uses the same command and is fixed with it. Fixes Termix-SSH#1801
|
AI review | Needs changes Wraps the POSIX shell command returned by scriptShell() in sh -c '...' so it executes correctly on hosts with non-POSIX login shells like fish or csh. Adds tests to verify the command format and runtime behavior.
Reviewed 6a696b5. AI can be wrong, a maintainer still decides. Comment |
This branch has not been deployed
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.
Fixes #1801.
scriptShell()returns the SSH command plugins use to run a script sent on stdin. It was POSIX shell code:SSH hands that string to the user's login shell. On a host where the login shell is fish (or csh), it fails to parse:
fish: Expected end of the statement, but found keyword 'exec'. Every plugin that runs host scripts through it (Samba, Users and others) is affected.The command is now that same code, quoted with the SDK's
shellQuoteforsh -c '…'. Any login shell runs it as a single plain command, and fish accepts the'\''quoting too. Inside the quotes,$PATHand$(id -u)reachshuntouched, so behaviour on bash/zsh hosts is unchanged.passwordSudoScript()usesscriptShell("plain")as its command and is fixed by the same change. The plugin SDK is a host-provided external for plugin backends, so plugins pick this up with the core release without being rebuilt.Validation: new tests check that every mode is a single
sh -c '…'command, which fails before the change, and that the plain shell still runs a script from stdin throughshwith the prelude applied. Full suite: 4639 passed, 1 skipped.tsc -b, eslint, prettier and the SDK guide check pass. Not tested against a real fish host.