pyinvoke / invoke

Pythonic task management & command execution.
http://pyinvoke.org
BSD 2-Clause "Simplified" License
4.41k stars 369 forks source link

Default run.shell to /bin/sh #957

Open tobim opened 1 year ago

tobim commented 1 year ago

/bin/bash is not availabe on some popular distributions, for example NixOS. Defaulting to the more conservative /bin/sh improves portability.

kuwv commented 1 year ago

This should be the correct default.

hydrocat commented 3 months ago

Based on the CI results, the test cases are strictly requiring the shell to be bash. We could do like windows and use the SHELL environment variable, which would make sense for NixOS but would perhaps crash depending on the user's own configuration (for example, if they use fish, Oil, zsh, csh .. )

Maybe, we could query the system for bash's path.

tobim commented 3 months ago

Well, you could use /usr/bin/env to find bash in $PATH.

kuwv commented 3 months ago

It's not really an issue about locating BASH in the environment.

BASH includes capabilities you don't need with Python/invoke. The fact that it's not included with Alpine or other Busybox-based distros is problematic too.

The default should be '/bin/sh' because it's the right combination of capabilities and compatibility for invoke.

For example if you were to use invoke in a CI you could potentially utilize many different images. Using bash would force you to either bullet proof either incoke or the containers to work instead of just "do the thing".

hydrocat commented 3 months ago

Then, the tests should be updated

On Mon, Aug 5, 2024, 10:59 AM Jesse P. Johnson @.***> wrote:

BASH includes capabilities you don't need with Python/invoke. The fact that it's not included with Alpine or other Busybox-based distros is problematic too.

The default should be '/bin/sh' because it's the right combination of capabilities and compatibility for invoke.

— Reply to this email directly, view it on GitHub https://github.com/pyinvoke/invoke/pull/957#issuecomment-2269149286, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACNH3MKACSOK7D3VXNGGPILZP6ALPAVCNFSM6AAAAABL4RA7NGVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDENRZGE2DSMRYGY . You are receiving this because you commented.Message ID: @.***>