saltstack / saltstack/salt

[BUG] salt-ssh 3007.0 attempts to run commands in default shell, even if default shell is fish

Open
#66,246 4 comments 0 reactions 1 assignee View on GitHub

@Akm0d is already working on this.

Since Mar 26, 2024.

bug needs-triage
Dominant language
Python
Stars
15.7k
Forks
5.6k
Avg merge
2d 44m
Merged PRs (30d)
80

Description

Description

salt-ssh attempts to run commands in the default shell, even if the default shell is fish. For example, { ... } from here is valid in bash, but this causes an error in fish:

fish: Unknown command: '{ brew --prefix }'
fish: '{ ... }' is not supported for grouping commands. Please use 'begin; ...; end'

Setup

  • onedir packaging 3007.0
  • macOS Sonoma 14.4

Steps to Reproduce the behavior

brew install fish
chsh -s /opt/homebrew/bin/fish

Close and re-open Terminal.app

Run any salt-ssh command

Expected behavior

No hang or error.

Versions Report

Cannot run salt --versions-report as it hangs instead.

Additional context

My present workaround is:

chsh -s /bin/bash

And set Terminal > Settings... > Shells open with: to Command (complete path): with /opt/homebrew/bin/fish

This leaves $SHELL set to /bin/bash.

Note that the comment here is both out-of-date and incorrect (su doesn't run sh – it runs the user's login shell, which can be any valid shell)

https://github.com/saltstack/salt/blob/d036b1177efeec175164571e9cc07b52cddf7844/salt/modules/cmdmod.py#L472-L475

The previous line of code it refers to was:

https://github.com/saltstack/salt/commit/ab8b39ce1043c2421e5c750d90bd529be5e32250#diff-700b7d75700c9eafa3ee48d01236e59f37b2ed81d998267136fbcc0224766497R419-R421

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.