msys2 / msys2-launcher

Helper for launching MSYS2 shells

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Difference in PATH between msys.exe and mingw{32,64}.exe

FSund opened this issue · comments

If I start msys.exe my PATH has /mingw64/bin last

/c/Program Files/Sublime Text 3/
/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
/home/filip.sund/qmk_utils
/home/filip.sund/qmk_utils/dfu-programmer
/home/filip.sund/qmk_utils/dfu-util-0.9-win64
/home/filip.sund/qmk_utils/bootloadHID.2012-12-08/commandline
/home/filip.sund/qmk_utils/flip/bin
/home/filip.sund/qmk_utils/avr8-gnu-toolchain/bin
/home/filip.sund/qmk_utils/gcc-arm-none-eabi/bin
/mingw64/bin

but mingw{32,64}.exe has /mingw64/bin both first and last.

/c/Program Files/Sublime Text 3/
/mingw64/bin
/usr/local/bin
/usr/bin
/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
/home/filip.sund/qmk_utils
/home/filip.sund/qmk_utils/dfu-programmer
/home/filip.sund/qmk_utils/dfu-util-0.9-win64
/home/filip.sund/qmk_utils/bootloadHID.2012-12-08/commandline
/home/filip.sund/qmk_utils/flip/bin
/home/filip.sund/qmk_utils/avr8-gnu-toolchain/bin
/home/filip.sund/qmk_utils/gcc-arm-none-eabi/bin
/mingw64/bin

This makes calling executables that exist in both /c/Windows/System32 and /mingw64/bin a bit inconsistent. For example convert.exe which I've been using a lot lately, which only results in the ImageMagick variant (in /mingw64/bin) in mingw terminals, not msys.

Is this on purpose? And is there any way to change this behaviour?

That last /mingw64/bin shouldn't be there at all. Did you add it manually by any chance (where is qmk_utils being set?)?

Yeah, this looks like the last /mingw64/bin comes from outside.

Sorry to bring up this again, but I'm having some other issues with my MSYS2 installation, and I think it might be related to this.

Just to confirm -- the last /mingw64/bin should not be there in either the msys2 or the mingw64/32 environments? Where are these variables set?

EDIT: I found out that it's being added by the following line in the bottom of ´.bashrc´

source ~/qmk_utils/activate_msys2.sh

Which calls

#!/bin/bash

function export_variables {
    local util_dir=~/qmk_utils
    export PATH=$PATH:$util_dir
    export PATH=$PATH:$util_dir/dfu-programmer
    export PATH=$PATH:$util_dir/dfu-util-0.9-win64
    export PATH=$PATH:$util_dir/bootloadHID.2012-12-08/commandline
    export PATH=$PATH:$util_dir/flip/bin
    export PATH=$PATH:$util_dir/avr8-gnu-toolchain/bin
    export PATH=$PATH:$util_dir/gcc-arm-none-eabi/bin
    export PATH=$PATH:/mingw64/bin
}

export_variables

activate_msys2.sh has since been updated to not include /mingw64/bin, so I think I can safely remove that line.