-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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
Perl: Git.pm cannot handle arguments with spaces #1602
Comments
On a native Windows build of Perl (where $^O equals 'MSWin32'), like Strawberry or ActiveState Perl, the Git.pm module follows a unique code path, one that alters the behavior of piped Git commands. This special path failed to handle spaces contained in an argument to Git. Remove that limitation by improving Windows command line support. On Windows, the command line is part of the operating system; it is not provided by a shell. This system requires certain characters (\, ") to be escaped (in certain cases). The cmd.exe command prompt rests on top of the command line and it has its own, additional escaping mechanism. When creating pipes, an MSWin32 build of Perl will either use the system call, CreateProcess (which takes the command line), or, if interpreted characters are detected, the command prompt, cmd.exe. Add a function to unescape command line arguments, one that will work with CreateProcess or with cmd.exe, as appropriate. This ensures any Git command will have its arguments parsed correctly, regardless of content. Additionally, include tests to verify that Perl's system() behavior remains unchanged -- notably, that the list of interpreted characters (for selecting cmd.exe) does not change. These tests need an MSWin32 build of Perl in the PATH to work; otherwise, they are skipped. This change will improve commands (or batch scripts) run in CMD, where native (MSWin32) builds of Perl are all that is available in the PATH (unless the user opts to install Unix utils in the PATH, which is not recommended in the Git for Windows installer). Commands run in MSYS Perl, which is included with Git for Windows, will not change (as it never had a problem). Closes: git-for-windows#1602 Signed-off-by: Chris Lindee <[email protected]>
On a native Windows build of Perl (where $^O equals 'MSWin32'), like Strawberry or ActiveState Perl, the Git.pm module follows a unique code path, one that alters the behavior of piped Git commands. This special path failed to handle spaces contained in an argument to Git. Remove that limitation by improving Windows command line support. On Windows, the command line is part of the operating system; it is not provided by a shell. This system requires certain characters (\, ") to be escaped (in certain cases). The cmd.exe command prompt rests on top of the command line and it has its own, additional escaping mechanism. When creating pipes, an MSWin32 build of Perl will either use the system call, CreateProcess (which takes the command line), or, if interpreted characters are detected, the command prompt, cmd.exe. Add a function to unescape command line arguments, one that will work with CreateProcess or with cmd.exe, as appropriate. This ensures any Git command will have its arguments parsed correctly, regardless of content. Additionally, include tests to verify that Perl's system() behavior remains unchanged -- notably, that the list of interpreted characters (for selecting cmd.exe) does not change. These tests need an MSWin32 build of Perl in the PATH to work; otherwise, they are skipped. This change will improve commands (or batch scripts) run in CMD, where native (MSWin32) builds of Perl are all that is available in the PATH (unless the user opts to install Unix utils in the PATH, which is not recommended in the Git for Windows installer). Commands run in MSYS Perl, which is included with Git for Windows, will not change (as it never had a problem). Closes: git-for-windows#1602 Signed-off-by: Chris Lindee <[email protected]>
Is this ticket still relevant? |
Please clarify "relevant". The bug still exists and it causes an issue on one of my projects in a very limited setting. Pull request #1604 addresses this issue so it should be an easy win. |
I meant "does this bug still exist, and is the fix being worked on?", and you provided "yes" as an answer to both. Sorry, I had missed the update to #1604, I have left some comments there. |
Setup
Git for Windows v2.10.2 32-bit
Windows 8.1 64-bit
defaults?
IIRC, mostly the defaults, but I selected to add git.exe (but not the commands themselves) to the PATH.
to the issue you're seeing?
None I can think of
Details
CMD
Minimal, Complete, and Verifiable example
this will help us understand the issue.
Directory is created and repository is initialized.
It seems the code never accounted for spaces in the first place, as the FIXME will attest.
URL to that repository to help us with testing?
N/A
Run in git-bash
The text was updated successfully, but these errors were encountered: