{"thread":{"id":"30966","subject":"Bug: git svn sends password + \"\\n\" on windows","startedAt":"2012-07-06T07:39:08Z","lastAt":"2012-07-06T07:39:08Z","messageCount":1,"participants":["mw-u2@gmx.de"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"194698","messageId":"20120706073908.278660@gmx.net","threadId":"30966","inReplyTo":null,"subject":"Bug: git svn sends password + \"\\n\" on windows","fromName":"","fromEmail":"mw-u2@gmx.de","sentAt":"2012-07-06T07:39:08Z","receivedAt":"2012-07-06T07:39:08Z","isPatch":false,"sender":{"key":"mw-u2@gmx.de","avatar":null},"body":"Hi,\n\nplease go easy on me, this is my first bug report. I hope this is the right\nplace to post.\n\nProblem: When using SshAskPass (from TortoiseGit, on Windows), git svn clone\nfails with \n\n| git.exe svn clone \"http://xxx/svn/Project\"  \"D:\\Project\"\n| \n| Initialized empty Git repository in d:/Project/.git/\n| Authentication realm: <http://xxx:80> Subversion Repository\n| Authentication realm: <http://dew132:80> Subversion Repository\n| Username: Use of uninitialized value in chomp at C:\\Program Files\\Git/libexec/git-core\\git-svn line 4417.\n| 0 [main] perl.exe\" 7200 handle_exceptions: Exception: STATUS_ACCESS_VIOLATION\n| 433 [main] perl.exe\" 7200 open_stackdumpfile: Dumping stack trace to perl.exe.stackdump\n| \n| git did not exit cleanly (exit code -1)\n\nI have verified that the git svn client sends the base64 encoded string\n\"password\" + \"\\n\" as http header:\n| Authorization: Basic dGVzdAo=\n(Which should decode to \"test\\n\". I had to replace my password with a manual\nencoded version to show to you.)\n\nI think there is a bug/issue in perl/Git/SVN/Prompt.pm. On windows only \"\\r\" of\n\"\\r\\n\" gets removed after calling GIT_ASKPASS. I have changed, \n\ndiff --git a/perl/Git/SVN/Prompt.pm b/perl/Git/SVN/Prompt.pm\nindex 3a6f8af..8f49457 100644\n--- a/perl/Git/SVN/Prompt.pm\n+++ b/perl/Git/SVN/Prompt.pm\n@@ -124,7 +124,7 @@ sub _read_password {\n \tif (exists $ENV{GIT_ASKPASS}) {\n \t\topen(PH, \"-|\", $ENV{GIT_ASKPASS}, $prompt);\n \t\t$password = <PH>;\n-\t\t$password =~ s/[\\012\\015]//; # \\n\\r\n+\t\t$password =~ s/[\\012\\015][\\012\\015]?//; # \\n\\r\n \t\tclose(PH);\n \t} else {\n \t\tprint STDERR $prompt;\n\nand the clone worked, but think one should chomp (as sub username does):\n\ndiff --git a/perl/Git/SVN/Prompt.pm b/perl/Git/SVN/Prompt.pm\nindex 3a6f8af..30b6256 100644\n--- a/perl/Git/SVN/Prompt.pm\n+++ b/perl/Git/SVN/Prompt.pm\n@@ -123,8 +123,7 @@ sub _read_password {\n \tmy $password = '';\n \tif (exists $ENV{GIT_ASKPASS}) {\n \t\topen(PH, \"-|\", $ENV{GIT_ASKPASS}, $prompt);\n-\t\t$password = <PH>;\n-\t\t$password =~ s/[\\012\\015]//; # \\n\\r\n+\t\tchomp($password = <PH>);\n \t\tclose(PH);\n \t} else {\n \t\tprint STDERR $prompt;\n\nUnfortunately I could not test the 2nd version, because somehow git saves the\nsuccessful credentials and I have not researched/found out, how to reset that\ninformation yet.\n\nThanks for your consideration\nMicha Wiedenmann\n\nVersions:\nTortoiseGit 1.7.10.0 \ngit version 1.7.10.msysgit.1 \n"}]}