Skip to content
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

[Bug] When Git's path contains a closing parenthesis, "cmd" tasks end early and display '\Git\cmd\git.exe" found." was unexpected at this time.' #2958

Closed
4 tasks done
stanwest opened this issue Jul 27, 2024 · 3 comments · Fixed by #2959
Assignees
Labels
Good first issue New contributors may find this a good place to get involved from 🐛 Type: Bug

Comments

@stanwest
Copy link
Contributor

Version Information

Cmder version: 1.3.24.236
Operating system: Windows 11 21H2

Cmder Edition

Cmder Mini

Description of the issue

Suppose that the path to Git contains a closing parenthesis. When I start Cmder with a cmd task such as {cmd::Cmder}, Cmder displays the following message:

  \Git\cmd\git.exe" found." was unexpected at this time.

This error interrupts the "init.bat" script. For example, it stopped before adding Cmder's "bin" directories to the path:

  λ where cexec
  INFO: Could not find files for the given pattern(s).

How to reproduce

  1. Install/copy/link Git's program directory into a path that contains a ")" character.
  2. Ensure that the above path is in the PATH environment variable.
  3. Launch Cmder such that it runs a cmd task (e..g, with argument /task {cmd::Cmder} if necessary).

Additional context

The cause appears to be simply that the line below contains extra double quotation marks. Perhaps they were intended to delimit the path specified by the git_executable variable, but because they instead end the quotation of "No git at " and begin the quotation of " found.", the value of git_executable is unprotected from interpretation by the shell. When that value contains ")", it interferes with the parentheses in the surrounding if and else statements.

  %print_debug% ":compare_git_versions" "No git at "%git_executable%" found."

Issue #2250 reports a similar symptom, but it is unclear what code was responsible or what commit or PR resolved the issue.

Checklist

  • I have read the documentation.
  • I have searched for similar issues and found none that describe my issue.
  • I have reproduced the issue on the latest version of Cmder.
  • I am certain my issues are not related to ConEmu, Clink, or other third-party tools that Cmder uses.
@DRSDavidSoft
Copy link
Contributor

Thanks for the through investigation, I've merged the PR and hopefully this will indeed fix the issue.

Could you please also test the last CI master build on a Windows Sandbox environment with a path containing the ) character to see that it works properly?

Thank you for the fix!

@DRSDavidSoft DRSDavidSoft added the Good first issue New contributors may find this a good place to get involved from label Jul 27, 2024
@stanwest
Copy link
Contributor Author

stanwest commented Aug 1, 2024

Could you please also test the last CI master build on a Windows Sandbox environment with a path containing the ) character to see that it works properly?

It appears to work. With cmder_mini.zip from the build artifacts unpacked into C:\Users\WDAGUtilityAccount\cmder_mini, PortableGit-2.46.0-64-bit.7z unpacked into C:\Users\WDAGUtilityAccount\Portable)Git, and C:\Users\WDAGUtilityAccount\Portable)Git\bin appended to the path, Cmder launches successfully.

Thank you for the fix!

You're welcome!

@DRSDavidSoft
Copy link
Contributor

@stanwest Thank you for the test and the PR!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Good first issue New contributors may find this a good place to get involved from 🐛 Type: Bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants