Strange behaviour in PATH with Cygwin #67
Comments
Okay, further info. The problem exists only if the directory is the last entry in your path, which means it must be a USER path variable. The trick of adding a path-separator onto the end of it works because this is then interpreted as an empty path with a dot I now understand that any paths to cygwin are removed from the PATH environment variable and I believe that the To demonstrate this, add the following to the profile script, immediately after the path has been set: echo PATH length is ${#PATH}:
echo $PATH
echo
# run awk stripping non-existent parts
AWKEDPATH="$(awk -vRS=: -vORS=: '!/xxxxxxx/' <<< "$PATH")"
echo AWKEDPATH, nothing changed in PATH, length is ${#AWKEDPATH}:
echo $AWKEDPATH
echo
# remove trailing separator
AWKEDPATHREM="${AWKEDPATH%:}"
echo AWKEDPATHREM, removed trailing separator, length is ${#AWKEDPATHREM}:
echo $AWKEDPATHREM
echo This essentially tells awk to remove a non-existent value Hope this helps. |
Fixed by the OP himself and the above pull request. |
Using awk to strip any Cygwin path creates a null-byte at the end of the string. This makes the last item in the path unresolvable and causes child processes that are not dependent on msys-1.0.dll to inherit POSIX rather than Windows paths. Fix this by not using awk at all. Reported-by: John Stevenson <john-stevenson@blueyonder.co.uk> Signed-off-by: Sebastian Schuberth <sschuberth@gmail.com>
Discovered on Git For Windows (1.7.11). I have Cygwin installed and it is in my Path. When I append a new folder to my path, Git Bash will not find it unless it is suffixed with a semi-colon.
Cygwin, cmd.exe, and running Git/bin/sh.exe with no login, all find it.
A quick hack is to alter the profile script and append a path separator:
Note that Git Bash shows the newly appended folder from
env
, but would not appear to use it.Is this a general problem, or something to do with my own setup ?
The text was updated successfully, but these errors were encountered: