msys2 / msys2-launcher

Helper for launching MSYS2 shells

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

launcher ignores SHELL

sdhawley opened this issue · comments

commented

Double clicking msys2.exe (or mingw32.exe or mingw64.exe) results in a mintty window running bash, but SHELL is set to /usr/bin/zsh.

Running mintty from the bash prompt opens a mintty window with zsh as expected.

commented

Did you see this? It would be nice if it respected Window's %SHELL% but this will get you to open the right shell:

#3

commented

I've tried setting db_shell: /usr/bin/zsh in nsswitch.conf and I've tried setting the shell in /etc/passwd. Neither changes the behavior.

Running mintty from bash is using the shell set in SHELL, and falls back to nsswitch.conf.

Hmmm, wonder if I have the most recent version of msys2-launcher. Is there someway for me to check the version?

commented

From your shell:

pacman -Ss msys2-launcher

That assumes of course that you installed it from pacman.

From: Steve [mailto:notifications@github.com]
Sent: Monday, 4 April, 2016 16:30
To: elieux/msys2-launcher msys2-launcher@noreply.github.com
Cc: Liam liambowen@gmail.com
Subject: Re: [elieux/msys2-launcher] launcher ignores SHELL (#6)

I've tried setting db_shell: /usr/bin/zsh in nsswitch.conf and I've tried setting the shell in /etc/passwd. Neither changes the behavior.

Running mintty from bash is using the shell set in SHELL, and falls back to nsswitch.conf.

Hmmm, wonder if I have the most recent version of msys2-launcher. Is there someway for me to check the version?


You are receiving this because you commented.
Reply to this email directly or view it on GitHub #6 (comment) https://github.com/notifications/beacon/AAWMyKNu5-pmLgrsbdaOonm_6PQ1qzX3ks5p0XTkgaJpZM4H_dB8.gif

commented

Says msys2-launcher-git 0.3.19.f91905f-1

Not sure how that relates to your git repo

commented

https://github.com/elieux/msys2-launcher/commits/f91905f6bb97182e520ba1aaeba3997afd78b2da

That's an old version (from 2015). I'm not sure what the process is to get a new package built, but in the mean time you should probably build it manually.

commented

Thanks for your help!

Rebuilding the package solved the problem. One little hiccup was the install of the cross compiler, it didn't install the cross crt correctly but after I reinstalled the cross-crt it worked.

Thanks for confirming that the new version works with SHELL as well (assuming you have env in the db_shell line of /etc/nsswitch.conf). I'll try to get a new package uploaded.

commented

I have the following version. And I have the same issue where db_shell setting in nsswitch.conf is not respected.

pacman -Ss msys2-launcher
msys/msys2-launcher-git 0.3.32.56c2ba7-2 (base) [installed]
    Helper for launching MSYS2 shells

I've got the same version and db_shell is respected. What version of msys2-runtime are you running?

$ pacman -Ss msys2-runtime$
msys/msys2-runtime 2.8.2-1 (base) [installed]

What are you setting in /etc/nsswitch.conf and how are you testing it?

commented

My runtime is the same as yours. Below are relative info. How I tested it - I just close the msys2 console and re-open it through the msys2 start menu entry which was installed. And it still gives me bash. Is this not how I suppose to open it?

$ pacman -Ss msys2-runtime$
msys/msys2-runtime 2.8.2-1 (base) [installed]
    Posix emulation engine for Windows

$ which zsh
/usr/bin/zsh

$ cat /etc/nsswitch.conf
# Begin /etc/nsswitch.conf

passwd: files db
group: files db

db_enum: cache builtin

db_home: windows cygwin desc
db_shell: /usr/bin/zsh
db_gecos: cygwin desc

# End /etc/nsswitch.conf

The Start menu shortcut is not msys2-launcher. msys2-launcher consists of msys2.exe, mingw64.exe, and mingw32.exe (and *.ini files). The Start menu shortcut points to msys2_shell.cmd and it only knows bash. If you need to use msys2_shell.cmd, but want it to respect your default shell, you need to file an issue (or +1 an existing one) at https://github.com/msys2/msys2 or https://github.com/alexpux/msys2-packages.

commented

What's the difference between those .exe launchers and the msys_shell.cmd batch file? What's the catch if I launch those launchers directly?

Apart from msys2_shell.cmd not respecting your default shell? It cannot be pinned to the taskbar and it shows a terminal window for a second when it's starting. See its help text below for more.

The .exe launchers only start MinTTY, either with your default shell (no arguments), or with a custom command (passed as arguments). It can pre-set the environment according to its .ini file. It's pinnable and doesn't show any intermediate windows.

> msys2_shell -help
Usage:
    msys2_shell.cmd [options] [bash parameters]

Options:
    -mingw32 | -mingw64 | -msys[2]   Set shell type
    -defterm | -mintty | -conemu     Set terminal type
    -here                            Use current directory as working
                                     directory
    -where DIRECTORY                 Use specified DIRECTORY as working
                                     directory
    -[use-]full-path                 Use full currnent PATH variable
                                     instead of triming to minimal
    -no-start                        Do not use "start" command and
                                     return bash resulting errorcode as
                                     this batch file resulting errorcode
    -help | --help | -? | /?         Display this help and exit

Any parameter that cannot be treated as valid option and all
following parameters are passed as bash command parameters.
commented

Thanks for the explanation!

@elieux Just want to confirm, as this post said, will putting SHELL=/usr/bin/zsh in msys2.ini work?

That depends on if you have db_shell: env in your /etc/nsswitch.conf and if your version of MSYS2 supports it. (I'm not totally sure if it is.)