Menu

Windows paths in PATH?

2015-10-25
2015-12-17
  • DanAaronGoldman

    DanAaronGoldman - 2015-10-25

    I just installed msys2. The PATH has lots of Windows paths. For example, C:\Windows\System32\Wbem

    1) The Windows paths are totally not used or needed by msys2, right? Or maybe I'm missing something.
    2) Maybe /etc/profile should start with an empty PATH, before building PATH?

    Thanks,
    Daniel

     
  • Alexx83

    Alexx83 - 2015-10-26

    Windows system paths need for every program under Windows because in other case program not be able load system libraries like kernel32,user32 and etc.

     
  • DanAaronGoldman

    DanAaronGoldman - 2015-10-26

    So some part of msys2 won't work correctly if certain windows paths are not in msys2 PATH?

    I tried taking out the windows paths, and so far no failure. Admittedly, I'm not doing much. :) Out of curiousity, could you give an example of something that would fail if windows paths are not in PATH? Do some msys2 binaries need the windows paths to load system libraries? Or is it something else?

    I guess the other confusion on my part was I thought I read somewhere that msys2 required /c/ format, so I thought the c:\ windows paths were maybe just clutter.

    BTW, this is a great project. Thanks to you and the others who create and maintain msys2.

    Daniel

     
  • David Macek

    David Macek - 2015-11-17

    For visitors: This was later discussed in the mailing list under the subject "Setting path for shell".

     
  • DanAaronGoldman

    DanAaronGoldman - 2015-12-13

    At this point, some two months later, contrary to previous post, I have used msys2 a lot.

    I continue with the windows paths totally removed from PATH. Still no failure, no problem. The few problems I have run into (eg, curses application does not run in mintty), I switch back to the PATH including the windows paths, and it does not help. So no effect. I looked at the mailing list post as mentioned by David, thanks. There are a few vague suggestions, but nothing concrete.

    The wiki says to limit it to C:\Windows\system32 - maybe the default /etc/profile should do just that. One piece of clutter is tolerable. For me, I'll keep deleting the windows path until I see an example why I shouldn't, or until something fails. If even one windows path really matters, something should fail. I think it's a mistake to be unsure why something is there, but we keep it there "just in case".

    Perhaps for others it doesn't matter. I need it easy to figure out PATH. I don't want a bunch of clutter. Anyway, if someone ever can present a concrete example of what one of those windows path elements does, I'd be inerested to hear.

    Thanks,
    Daniel

     
  • David Macek

    David Macek - 2015-12-17

    Okay, one example:

    me@pc MINGW64 /w/dev/msys2-launcher (master)
    $ mingw32-make
    windres -O COFF -o msys2.res launcher.rc -DMSYSTEM=MSYS -DICONFILE=msys2.ico
    'chcp' is not recognized as an internal or external command,
    operable program or batch file.
    gcc -std=c11 -Wall -Wextra -Werror -static -municode -mwindows -o msys2.exe launcher.c msys2.res
    cp -f launcher.ini msys2.ini
    echo MSYSTEM=MSYS>> msys2.ini
    [...snip...]
    

    mingw32-make uses cmd to run subcommands and my cmd is configured through registry to run some programs on start-up, one of them being chcp. It never occurred to me to use full path to chcp because it's supposed to be in PATH.

    This may seem a bit convoluted, but it's representative of one kind of issues that could occur -- people assuming system32 is always in PATH.