{"thread":{"id":"6392","subject":"git-svn - username/password","startedAt":"2007-01-15T23:25:28Z","lastAt":"2007-01-16T04:20:08Z","messageCount":4,"participants":["Randal L. Schwartz","Eric Wong"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"31783","messageId":"8664b73maf.fsf@blue.stonehenge.com","threadId":"6392","inReplyTo":null,"subject":"git-svn - username/password","fromName":"Randal L. Schwartz","fromEmail":"merlyn@stonehenge.com","sentAt":"2007-01-15T23:25:28Z","receivedAt":"2007-01-15T23:25:28Z","isPatch":false,"sender":{"key":"merlyn@stonehenge.com","avatar":"https://gravatar.com/avatar/dc528d210743ff0333e6213f9ee7b33b23f1b7bc1f3c5a8c2d819074ecd7ab19?d=mp&s=160"},"body":"\nIt's not clear from the docs where I'm supposed to put a subversion\nusername/password in git-svn.  In fact, git-svn makes absolutely no mention of\npassword.  And I see there's some --username=%s kind of stuff in the arg\nparsing, but I'm not able to seem to make it work.  (At one point, git-svn\ninit actually created a subdir named \"http:\"... oops!)\n\nEric?  Or anyone?\n\n-- \nRandal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095\n<merlyn@stonehenge.com> <URL:http://www.stonehenge.com/merlyn/>\nPerl/Unix/security consulting, Technical writing, Comedy, etc. etc.\nSee PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!\n"},{"id":"31786","messageId":"20070116004137.GA10706@localdomain","threadId":"6392","inReplyTo":"8664b73maf.fsf@blue.stonehenge.com","subject":"Re: git-svn - username/password","fromName":"Eric Wong","fromEmail":"normalperson@yhbt.net","sentAt":"2007-01-16T00:41:37Z","receivedAt":"2007-01-16T00:41:37Z","isPatch":false,"sender":{"key":"e@80x24.org","avatar":null},"body":"\"Randal L. Schwartz\" <merlyn@stonehenge.com> wrote:\n> \n> It's not clear from the docs where I'm supposed to put a subversion\n> username/password in git-svn.  In fact, git-svn makes absolutely no mention of\n> password.  And I see there's some --username=%s kind of stuff in the arg\n> parsing, but I'm not able to seem to make it work.  (At one point, git-svn\n> init actually created a subdir named \"http:\"... oops!)\n> \n> Eric?  Or anyone?\n\ngit-svn fetch --username <username> should work with recent-ish git-svn\n(since around Thanksgiving); and eventually prompt you for the password\n(just like svn does).\n\nIf you're using older versions, just run\n   `svn log -rHEAD --username <username> <repository>'\nand have it cache your password.\n\n-- \nEric Wong\n"},{"id":"31787","messageId":"86sleb23vs.fsf@blue.stonehenge.com","threadId":"6392","inReplyTo":"20070116004137.GA10706@localdomain","subject":"Re: git-svn - username/password","fromName":"Randal L. Schwartz","fromEmail":"merlyn@stonehenge.com","sentAt":"2007-01-16T00:48:23Z","receivedAt":"2007-01-16T00:48:23Z","isPatch":false,"sender":{"key":"merlyn@stonehenge.com","avatar":"https://gravatar.com/avatar/dc528d210743ff0333e6213f9ee7b33b23f1b7bc1f3c5a8c2d819074ecd7ab19?d=mp&s=160"},"body":">>>>> \"Eric\" == Eric Wong <normalperson@yhbt.net> writes:\n\nEric> git-svn fetch --username <username> should work with recent-ish git-svn\nEric> (since around Thanksgiving); and eventually prompt you for the password\nEric> (just like svn does).\n\nThe prompts are broken... they're not being flushed properly.\nOnce I knew it was talking to me, and not just stalled, I could\ntype in the password at the right time.\n\n-- \nRandal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095\n<merlyn@stonehenge.com> <URL:http://www.stonehenge.com/merlyn/>\nPerl/Unix/security consulting, Technical writing, Comedy, etc. etc.\nSee PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!\n"},{"id":"31803","messageId":"20070116042008.GA19873@localdomain","threadId":"6392","inReplyTo":"86sleb23vs.fsf@blue.stonehenge.com","subject":"Re: git-svn - username/password","fromName":"Eric Wong","fromEmail":"normalperson@yhbt.net","sentAt":"2007-01-16T04:20:08Z","receivedAt":"2007-01-16T04:20:08Z","isPatch":false,"sender":{"key":"e@80x24.org","avatar":null},"body":"\"Randal L. Schwartz\" <merlyn@stonehenge.com> wrote:\n> >>>>> \"Eric\" == Eric Wong <normalperson@yhbt.net> writes:\n> \n> Eric> git-svn fetch --username <username> should work with recent-ish git-svn\n> Eric> (since around Thanksgiving); and eventually prompt you for the password\n> Eric> (just like svn does).\n> \n> The prompts are broken... they're not being flushed properly.\n> Once I knew it was talking to me, and not just stalled, I could\n> type in the password at the right time.\n\nThat's odd.  I have $| = 1; at the beginning of git-svn.  Maybe\nsome module somewhere is unsetting $|...\n\nAnyways, I think STDERR is more correct for prompts.\n\nFrom: Eric Wong <normalperson@yhbt.net>\nDate: Mon, 15 Jan 2007 20:15:55 -0800\nSubject: [PATCH] git-svn: print and flush authentication prompts to STDERR\n\nPeople that redirect STDOUT output should always see STDERR\nprompts interactively.\n\nSTDERR should always be flushed without buffering, so\nthey should always show up.  If that is unset, we still\nexplicitly flush by calling STDERR->flush.\n\nThe svn command-line client prompts to STDERR, too.\n\nSigned-off-by: Eric Wong <normalperson@yhbt.net>\n\ndiff --git a/git-svn.perl b/git-svn.perl\nindex 9986a0c..b8ede9c 100755\n--- a/git-svn.perl\n+++ b/git-svn.perl\n@@ -1918,7 +1918,8 @@ sub _simple_prompt {\n \t$default_username = $_username if defined $_username;\n \tif (defined $default_username && length $default_username) {\n \t\tif (defined $realm && length $realm) {\n-\t\t\tprint \"Authentication realm: $realm\\n\";\n+\t\t\tprint STDERR \"Authentication realm: $realm\\n\";\n+\t\t\tSTDERR->flush;\n \t\t}\n \t\t$cred->username($default_username);\n \t} else {\n@@ -1933,36 +1934,38 @@ sub _simple_prompt {\n sub _ssl_server_trust_prompt {\n \tmy ($cred, $realm, $failures, $cert_info, $may_save, $pool) = @_;\n \t$may_save = undef if $_no_auth_cache;\n-\tprint \"Error validating server certificate for '$realm':\\n\";\n+\tprint STDERR \"Error validating server certificate for '$realm':\\n\";\n \tif ($failures & $SVN::Auth::SSL::UNKNOWNCA) {\n-\t\tprint \" - The certificate is not issued by a trusted \",\n+\t\tprint STDERR \" - The certificate is not issued by a trusted \",\n \t\t      \"authority. Use the\\n\",\n \t              \"   fingerprint to validate the certificate manually!\\n\";\n \t}\n \tif ($failures & $SVN::Auth::SSL::CNMISMATCH) {\n-\t\tprint \" - The certificate hostname does not match.\\n\";\n+\t\tprint STDERR \" - The certificate hostname does not match.\\n\";\n \t}\n \tif ($failures & $SVN::Auth::SSL::NOTYETVALID) {\n-\t\tprint \" - The certificate is not yet valid.\\n\";\n+\t\tprint STDERR \" - The certificate is not yet valid.\\n\";\n \t}\n \tif ($failures & $SVN::Auth::SSL::EXPIRED) {\n-\t\tprint \" - The certificate has expired.\\n\";\n+\t\tprint STDERR \" - The certificate has expired.\\n\";\n \t}\n \tif ($failures & $SVN::Auth::SSL::OTHER) {\n-\t\tprint \" - The certificate has an unknown error.\\n\";\n+\t\tprint STDERR \" - The certificate has an unknown error.\\n\";\n \t}\n-\tprintf( \"Certificate information:\\n\".\n+\tprintf STDERR\n+\t        \"Certificate information:\\n\".\n \t        \" - Hostname: %s\\n\".\n \t        \" - Valid: from %s until %s\\n\".\n \t        \" - Issuer: %s\\n\".\n \t        \" - Fingerprint: %s\\n\",\n \t        map $cert_info->$_, qw(hostname valid_from valid_until\n-\t                               issuer_dname fingerprint) );\n+\t                               issuer_dname fingerprint);\n \tmy $choice;\n prompt:\n-\tprint $may_save ?\n+\tprint STDERR $may_save ?\n \t      \"(R)eject, accept (t)emporarily or accept (p)ermanently? \" :\n \t      \"(R)eject or accept (t)emporarily? \";\n+\tSTDERR->flush;\n \t$choice = lc(substr(<STDIN> || 'R', 0, 1));\n \tif ($choice =~ /^t$/i) {\n \t\t$cred->may_save(undef);\n@@ -1980,7 +1983,8 @@ prompt:\n sub _ssl_client_cert_prompt {\n \tmy ($cred, $realm, $may_save, $pool) = @_;\n \t$may_save = undef if $_no_auth_cache;\n-\tprint \"Client certificate filename: \";\n+\tprint STDERR \"Client certificate filename: \";\n+\tSTDERR->flush;\n \tchomp(my $filename = <STDIN>);\n \t$cred->cert_file($filename);\n \t$cred->may_save($may_save);\n@@ -1999,13 +2003,14 @@ sub _username_prompt {\n \tmy ($cred, $realm, $may_save, $pool) = @_;\n \t$may_save = undef if $_no_auth_cache;\n \tif (defined $realm && length $realm) {\n-\t\tprint \"Authentication realm: $realm\\n\";\n+\t\tprint STDERR \"Authentication realm: $realm\\n\";\n \t}\n \tmy $username;\n \tif (defined $_username) {\n \t\t$username = $_username;\n \t} else {\n-\t\tprint \"Username: \";\n+\t\tprint STDERR \"Username: \";\n+\t\tSTDERR->flush;\n \t\tchomp($username = <STDIN>);\n \t}\n \t$cred->username($username);\n@@ -2015,7 +2020,8 @@ sub _username_prompt {\n \n sub _read_password {\n \tmy ($prompt, $realm) = @_;\n-\tprint $prompt;\n+\tprint STDERR $prompt;\n+\tSTDERR->flush;\n \trequire Term::ReadKey;\n \tTerm::ReadKey::ReadMode('noecho');\n \tmy $password = '';\n@@ -2024,7 +2030,8 @@ sub _read_password {\n \t\t$password .= $key;\n \t}\n \tTerm::ReadKey::ReadMode('restore');\n-\tprint \"\\n\";\n+\tprint STDERR \"\\n\";\n+\tSTDERR->flush;\n \t$password;\n }\n \n-- \nEric Wong\n"}]}