git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: Windows git bash - child processes see system PATH environment variable instead of user...

From
EMEdward Marshall <marshallx7a@gmail.com>
Date
Feb 19, 2016, 11:15 UTC
Message-ID
<CAN2vHUHhqVn8uXaUTdeU5mKuRLQ1084wJu27k4nMJgywOjdOdA@mail.gmail.com>
In-Reply-To
<alpine.DEB.1.00.1602191154190.20796@bonsai2>

Hey, thanks for getting back to me. I subseuqently found the git-for-windows issues tracker on github so have posted an updated version of this there - not sure where is the best place for issues.

I have also found that the cause was having %VPROJECT%..\bin inside my user PATH but no VPROJECT environment variable. Removing the path or adding the missing env var fixes the problem. This suggests that something is failing to concatenate user PATH to system PATH when it can't expand the non-existent environment variable.

fwiw, I don't have a .profile file either.

Hopefully you can replicate the problem with the above info, but please let me know if you still want me to run anything or if there is anything else I can do to help.

Kind regards,
Edward Marshall

On 19 February 2016 at 11:08, Johannes Schindelin <Johannes.Schindelin@gmx.de> wrote:

Show 67 quoted lines
> Hi Edward,
>
> On Wed, 17 Feb 2016, Edward Marshall wrote:
>
>> Edward@Edward-PC MINGW64 /f/Work
>> $ echo $PATH
>> ...(USER PATH)...
>
> I presume this is Git for Windows 2.7.1(2), installed via the default
> installer?
>
> And I also assume that you run this in Git Bash?
>
> Can you test whether this also happens in the PortableGit from
> https://github.com/git-for-windows/git/releases/latest? (These are
> self-extracting .7z archives, just install them somewhere else than your
> current installation, it won't touch your Start Menu or desktop icons.)
>
> The Git Bash is available in the portable installation as git-bash.exe in
> the top-leve directory.
>
>> Edward@Edward-PC MINGW64 /f/Work
>> $ cmd
>> Microsoft Windows [Version 6.1.7601]
>> Copyright (c) 2009 Microsoft Corporation. All rights reserved.
>>
>> F:\Work>echo %PATH%
>> echo %PATH%
>> ...(SYSTEM PATH)...
>>
>> The same is true of any child process (e.g. node.js) - they all see
>> SYSTEM PATH now instead of USER PATH.
>
> Are you sure that it is "instead of"? AFAICT both Git CMD and Git Bash
> should have the full PATH, i.e. both system and user PATH concatenated.
>
>> Running bash -l from a cmd window, has the problem.
>
> Now, this is interesting. Maybe something funky does happen in some
> strange place in the Bash profile.
>
> If you can reproduce this with the portable Git, it would be good to
> insert the line "set -x" at the top of %PORTABLEGIT%\etc\profile
> (that is the correct file name IIRC, it could also be bash.bash_profile,
> but I think the latter is included by the former). Then start bash -l
> again, and see whether you can find the place where it sets the PATH.
>
> To be certain, I would also recommend outputting the PATH with which Bash
> starts, either by inserting a line "echo $PATH" at the top of the profile
> file, or by starting bash without -l option.
>
>> I have no .bashrc or .bash_profile files on either system (no idea
>> what these are for but a colleague was trying to help diagnose the
>> problem - they ultimately came up empty).
>
> Could be a .profile, too, maybe.
>
>> Unfortunately I don't know what version of git I had before, and older
>> versions aren't offered for download so I can't trial and error.
>
> Older versions are still available (we did not remove any) from
> https://github.com/git-for-windows/git/releases (and if you look for the
> 1.x series that was using a completely different Bash/MSYS:
> https://github.com/msysgit/msysgit/releases).
>
> Ciao,
> Johannes
Previous: Johannes SchindelinNext: Johannes Schindelin
Message 3 of 4 in “Windows git bash - child processes see system PATH environment variable instead of user...”
  1. Edward MarshallFeb 17, 2016
  2. Johannes SchindelinFeb 19, 2016
  3. Edward MarshallFeb 19, 2016
  4. Johannes SchindelinFeb 19, 2016

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.