[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Re: [PATCH] Fix Issue 1117: Send prompts to stderr

From: <kfogel_at_newton.ch.collab.net>
Date: 2003-01-28 16:53:45 CET

Peter Davis peter@pdavis.cx writes:
 Fix Issue 1117. This is a simple fix: display all prompt callbacks to
 stderr. Currently, apr_password_get() displays its prompts to stderr, but
 Subversion's own prompt code simply printf's to stdout. This change puts
 both prompts to the same stream.

Actually, apr_password_get() doesn't display its prompts to stderr
except when unavoidable. It tries to use the system's getpassphrase()
or getpass() function. Here is how (for example) Solaris 2.6
describes them:

   The getpass() function opens the process' controlling terminal,
   writes to that device the null-terminated string prompt, disables
   echoing, reads a string of characters up to the next newline
   character or EOF, restores the terminal state and closes the
   terminal.

   The function getpassphrase() is identical to getpass(), except that
   it will read and return a string of up to 256 characters in length.

See my comments in issue #1117. Short summary: we can probably apply
the use-stderr patch right away, because it's an improvement over the
existing situation, but the right fix would be a portable function in
APR to do what getpass()/getpassphrase() do. However, hmmm, it looks
like APR does use stderr when no system getpass()/getpassphrase() is
available -- that is, APR doesn't have any prompt-hiding code of its
own. So the Right Solution might be harder than I thought, oh well.

On to the patch:

 * clients/cmdline/prompt.c (svn_cl__prompt_user):
   Send prompts to stderr instead of stdout.
 
 Index: subversion/clients/cmdline/prompt.c
 ===================================================================
 --- subversion/clients/cmdline/prompt.c (revision 4632)
 +++ subversion/clients/cmdline/prompt.c (working copy)
 @@ -103,8 +103,8 @@
 
    if (! hide)
      {
      printf (prompt_native);
      fflush (stdout);
 + fprintf (stderr, prompt_native);
 + fflush (stderr);
 
        while (1)
          {

Um, are you sure about this? :-) I mean, I can apply it with the
obvious transformation, but shouldn't there also be two removed lines
in this patch, as well as two added lines?

-K

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Sat Oct 14 02:22:10 2006

This is an archived mail posted to the Subversion Dev mailing list.