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

Error when choosing Launch Diff Tool on Windows #492

Closed
albertdev opened this Issue Aug 24, 2015 · 6 comments

Comments

Projects
None yet
2 participants
@albertdev

I have a file with status modified and right-click it to press Launch Diff Tool in the context menu. I'm then greeted by this error:
failed to launch diff

Tested with git-cola v2.3.


I've been debugging this issue so here's my results.

This is what the args variable looks like before core._win32_find_exe is executed on line 189:

[u'git', u'difftool', u'--no-prompt', u'--', u'censored.java']

Looks fairly normal. This is what argv looks like on line 197 (note that I'm running a copy of git-cola to insert print statements):

['C:\\Users\\bert\\Documents\\Temp\\git-cola-dev\\share\\git-cola\\lib\\cola\\git.PY', 'difftool', '--no-prompt', '--', 'censored.java']

I've checked _win32_find_exe and it seems this issue only occurs if you have .PY in the PATHEXT environment variable. Because git-cola is near the start of the PATH, git.PY is found and taken for the git binary.

Seeing how git-cola starts git just fine in other places, wouldn't it be possible to call git with an absolute path to the git binary for this case as well?

@davvid

This comment has been minimized.

Show comment
Hide comment
@davvid

davvid Aug 26, 2015

Member

Thanks for the report. @living180 do you have any thoughts? Would a reasonable solution be to force PATHEXT to be .exe when git-cola starts up?

@albertdev can you verify whether it's well-behaved when you unset PATHEXT, remove .PY from it, or set it to .EXE?

Member

davvid commented Aug 26, 2015

Thanks for the report. @living180 do you have any thoughts? Would a reasonable solution be to force PATHEXT to be .exe when git-cola starts up?

@albertdev can you verify whether it's well-behaved when you unset PATHEXT, remove .PY from it, or set it to .EXE?

@albertdev

This comment has been minimized.

Show comment
Hide comment
@albertdev

albertdev Aug 27, 2015

Opening the difftool works when I remove .PY from PATHEXT.

I'd prefer not to do this as it means I cannot use shortened Python scripts on the command line, but I guess it's a workaround...

Opening the difftool works when I remove .PY from PATHEXT.

I'd prefer not to do this as it means I cannot use shortened Python scripts on the command line, but I guess it's a workaround...

@davvid

This comment has been minimized.

Show comment
Hide comment
@davvid

davvid Aug 27, 2015

Member

Thanks for checking. That tells me that we should probably ignore PATHEXT, or resst it back to its default value internally. What is the default value for PATHEXT? Is it .EXE?

Member

davvid commented Aug 27, 2015

Thanks for checking. That tells me that we should probably ignore PATHEXT, or resst it back to its default value internally. What is the default value for PATHEXT? Is it .EXE?

@davvid

This comment has been minimized.

Show comment
Hide comment
@davvid

davvid Aug 27, 2015

Member

Can you also please list what your PATHEXT looks like? echo %PATHEXT% or echo $PATHEXT (Git bash) should show you what it's set to. Did you append to the default, or full-on replace it?

Reading the code, I'm curious how it ever gets to the point where it tries to execute git.PY. Do you happen to have a git.py file in that directory? The code does an existence check before running the command, so it's peculiar that os.path.exists() would return True if that path doesn't actually exist.

Ahhh.. I think I see what's going on. Do you have git-cola's share/git-cola/lib directory in your $PATH? How else would that git.py file be selected, if not? Please also list the contents of your PATH variable.

I think your PATHEXT might be fine. The PATH might actually be the true culprit. If git-cola's share/git-cola/lib directory is in your path, try removing it.

Member

davvid commented Aug 27, 2015

Can you also please list what your PATHEXT looks like? echo %PATHEXT% or echo $PATHEXT (Git bash) should show you what it's set to. Did you append to the default, or full-on replace it?

Reading the code, I'm curious how it ever gets to the point where it tries to execute git.PY. Do you happen to have a git.py file in that directory? The code does an existence check before running the command, so it's peculiar that os.path.exists() would return True if that path doesn't actually exist.

Ahhh.. I think I see what's going on. Do you have git-cola's share/git-cola/lib directory in your $PATH? How else would that git.py file be selected, if not? Please also list the contents of your PATH variable.

I think your PATHEXT might be fine. The PATH might actually be the true culprit. If git-cola's share/git-cola/lib directory is in your path, try removing it.

@davvid davvid added waiting not-a-bug and removed not-a-bug labels Aug 27, 2015

@davvid davvid closed this in 9d0a90a Aug 27, 2015

@davvid

This comment has been minimized.

Show comment
Hide comment
@davvid

davvid Aug 27, 2015

Member

I now see what's up. I think the latest code should fix it ~ the problem was we had a lingering bug from a while back that was tickled by your custom PATHEXT. We didn't need to override any variables or anything -- and it was cola that was inserting the wrong entry to PATH -- that was the bug. Thanks for the heads-up.

Member

davvid commented Aug 27, 2015

I now see what's up. I think the latest code should fix it ~ the problem was we had a lingering bug from a while back that was tickled by your custom PATHEXT. We didn't need to override any variables or anything -- and it was cola that was inserting the wrong entry to PATH -- that was the bug. Thanks for the heads-up.

@albertdev

This comment has been minimized.

Show comment
Hide comment
@albertdev

albertdev Aug 27, 2015

Thanks for the quick turnaround! I can confirm that this works after patching app.py.

For the record, here's how my PATHEXT looks in case you ever wonder about it again:

.COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC;.PY

Thanks for the quick turnaround! I can confirm that this works after patching app.py.

For the record, here's how my PATHEXT looks in case you ever wonder about it again:

.COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC;.PY
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment