MSYS2-packages icon indicating copy to clipboard operation
MSYS2-packages copied to clipboard

filesystem's "shell" script requires bash as user loginshell to switch envs

Open AeliusSaionji opened this issue 2 years ago • 2 comments

Description / Steps to reproduce the issue

The script /usr/bin/shell feature to switch between msys/ucrt64/etc environments relies on the user having bash as their loginshell.

As the help states, Usage: source shell mingw32|mingw64|msys Will not work outside of bash.

A workaround in the meantime: exec bash -c 'source shell ucrt64 && exec fish'

Expected behavior

Elieux  Yeah, default shells are kinda ignored in a lot of places.  You can use `getent passwd $(whoami) | cut -d: -f7` to get your default shell
        and we could use that in msys2_shell.cmd to actually default to the correct shell.
Elieux  Alternately, we could have a simple wrapper built with msys/gcc that can do the equivalent using POSIX C APIs and just exec() into the
        shell.  msys2_shell.cmd would then default to this wrapper.
Elieux  If you use mintty (or any of our .exe launchers), it uses the correct default shell.
Elieux  Of course, you have to set the default shell for your user first somehow.  nsswitch.conf (and its documentation) is the entry point for
        that.
Elieux  If we don't have an issue about this in msys2-packages, it'd be nice to have it (with all this info).

Verification

  • [X] I have verified that my MSYS2 is up-to-date before submitting the report (see https://www.msys2.org/docs/updating/)

Windows Version

MSYS_NT-10.0-22621

Are you willing to submit a PR?

No response

AeliusSaionji avatar Aug 30 '23 07:08 AeliusSaionji

@AeliusSaionji: which additional shells would you like to get support for?

Is that for Bourne-like shells (eg. Dash) or something more complicated (TCSH, KSH, ZSH)?

sskras avatar Aug 30 '23 08:08 sskras

The goal is to be shell agnostic- ideally the script switches environments and then calls the user's default shell.

AeliusSaionji avatar Aug 30 '23 13:08 AeliusSaionji