Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Missing PATH entries in MSYS2 #1185

Open
mcandre opened this issue Jul 7, 2017 · 3 comments
Open

Missing PATH entries in MSYS2 #1185

mcandre opened this issue Jul 7, 2017 · 3 comments

Comments

@mcandre
Copy link

mcandre commented Jul 7, 2017

When an MSYS2 shell is launched with conemu, the resulting shell has some Windows entries in PATH, but is missing most of them.

$ echo "$PATH"
/usr/local/bin:/usr/bin:/bin:/opt/bin:/c/Windows/System32:/c/Windows:/c/Windows/System32/Wbem:/c/Windows/System32/WindowsPowerShell/v1.0/:/usr/bin/site_perl:/usr/bin/vendor_perl:/usr/bin/core_perl

By contrast, the full Windows user PATH in a Command Prompt shell looks like:

> echo %PATH%
C:\Program Files\ConEmu\ConEmu\Scripts;C:\Program Files\ConEmu;C:\Program Files\ConEmu\ConEmu;C:\Program Files (x86)\Razer Chroma SDK\bin;C:\Program Files\Razer Chroma SDK\bin;C:\Program Files\Docker\Docker\Resources\bin;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Windows\system32\config\systemprofile\AppData\Local\Microsoft\WindowsApps;C:\ProgramData\chocolatey\bin;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\Program Files (x86)\Windows Kits\8.1\Windows Performance Toolkit\;C:\Go\bin;C:\Users\a_pen\go\bin;C:\Ruby24-x64\bin;C:\Users\a_pen\.cargo\bin;C:\Users\a_pen\AppData\Local\Microsoft\WindowsApps;C:\Users\a_pen\AppData\Local\atom\bin;C:\Program Files (x86)\GnuWin\file-5.03-bin\bin;C:\Users\a_pen\AppData\Local\Programs\Python\Python36-32;C:\Users\a_pen\AppData\Local\Programs\Python\Python36-32\Scripts;C:\Program Files\Git\cmd;C:\Program Files\Git\bin

Versions

ConEmu build: 170705 alpha
OS version: Windows 10 Pro x64
Used shell version (Far Manager, git-bash, cmd, powershell, cygwin, whatever): MSYS2

Problem description

MSYS2 cannot find most Windows binaries in %PATH%.

Steps to reproduce

  1. Launch an MSYS2 shell.
  2. Try to run git or other binaries that appear in %PATH% in Command Prompt.

Actual results

MSYS's $PATH is substantially limited compared to the full Windows %PATH%.

Expected results

MSYS includes all Windows entries in its $PATH.

Could this be an issue with the conemu command syntax configured for MSYS shells, or might this be an issue with MSYS itself?

MSYS bash configuration:

https://github.com/mcandre/dotfiles/blob/06abd486b51c7b4ae56bd530a0afa6f4257401be/.bash_profile

https://github.com/mcandre/dotfiles/blob/06abd486b51c7b4ae56bd530a0afa6f4257401be/.bashrc

@Maximus5
Copy link
Owner

Maximus5 commented Jul 7, 2017

It has nothing to fix with ConEmu. You may easily check that using ProcessExplorer to examine PATH in launched process tree.

Report to MSYS. Try to use sh.exe instead of bash.exe and vice versa.

@HugoPresents
Copy link

HugoPresents commented Jun 12, 2018

open {msys2_install_dir}/msys2_shell.cmd file, as this file said, uncomment line will export windows PATH into msys2:

rem To export full current PATH from environment into MSYS2 use '-use-full-path' parameter
rem or uncomment next line
set MSYS2_PATH_TYPE=inherit

or you can add params set MSYS2_PATH_TYPE=inherit into conemu task

@borekb
Copy link

borekb commented Jul 5, 2018

Like @Rabbit52 said, MSYS2_PATH_TYPE=inherit is the key. I prefer not to change the shipped msys2_shell.cmd so here are my two ConEmu tasks for MSYS2:

Bash::Msys2-64

(This is one of the preinstalled tasks, unmodified)

set CHERE_INVOKING=1 & set "PATH=%ConEmuDrive%\msys64\usr\bin;%PATH%" & %ConEmuBaseDirShort%\conemu-msys2-64.exe -new_console:p %ConEmuDrive%\msys64\usr\bin\bash.exe --login -i -new_console:C:"%ConEmuDrive%\msys64\msys2.ico"

Bash::mingw64

set CHERE_INVOKING=1 & set MSYSTEM=MINGW64 & set MSYS2_PATH_TYPE=inherit & set "PATH=%ConEmuDrive%\msys64\mingw64\bin;%ConEmuDrive%\msys64\usr\bin;%PATH%" & %ConEmuBaseDirShort%\conemu-msys2-64.exe -new_console:p %ConEmuDrive%\msys64\usr\bin\bash.exe --login -i -new_console:C:"%ConEmuDrive%\msys64\msys2.ico"

With this setup, I keep the default limited PATH for the msys shell while I use the full path for the mingw64 shell. Here is some great info on the two shells and how PATH is treated.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants