You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@subversion.apache.org by Vladimir Prus <gh...@cs.msu.su> on 2002/12/25 12:04:24 UTC

[PATCH] use stderr when prompting for username

This is a trivial patch with a simple purpose:
when redirecting output from a command (e.g. diff)
to a file, the "username:" prompt goes to the file too.

- Volodya

Log message:

* subversion/clients/cmdline/prompt.c (promt_user)
      Send prompts to stderr in all cases, including
      the case of non-hidded input.


Patch:
Index: subversion/clients/cmdline/prompt.c
===================================================================
--- subversion/clients/cmdline/prompt.c	(revision 4192)
+++ subversion/clients/cmdline/prompt.c	(working copy)
@@ -107,8 +107,8 @@
       something. */
    if (! hide)
      {
-      printf (prompt_native);
-      fflush (stdout);
+      fprintf (stderr, prompt_native);
+      fflush (stderr);

        while (1)
          {




---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org

Re: [PATCH] use stderr when prompting for username

Posted by Greg Hudson <gh...@MIT.EDU>.
On Fri, 2002-12-27 at 10:47, Alexis Huxley wrote:
> > Well, we should be consistent with password prompts, which (as I
> > understand it) already go to /dev/tty on Unix.  If this means adding
> > functionality to APR, then we should do so.
> 
> Not on Linux (Debian) anyway:

With our own password prompts, not the prompts from the "passwd"
command.


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org

Re: [PATCH] use stderr when prompting for username

Posted by Alexis Huxley <ah...@gmx.net>.
> Well, we should be consistent with password prompts, which (as I
> understand it) already go to /dev/tty on Unix.  If this means adding
> functionality to APR, then we should do so.

Not on Linux (Debian) anyway:

	leda$ passwd > /dev/null 2>&1
	<no output>

	leda$ passwd > /dev/null     
	(current) UNIX password: 
	<ctrl-c>

They go to stderr.

Alexis

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org

Re: [PATCH] use stderr when prompting for username

Posted by Vladimir Prus <gh...@cs.msu.su>.
Greg Hudson wrote:
> On Fri, 2002-12-27 at 03:08, Vladimir Prus wrote:
> 
>>>I think the prompt should be printed to the terminal (i.e., /dev/tty),
>>>not stderr, when possible.
>>
>>Is it possible to print anything to /dev/tty portably? Where that output would
>>go on windows? And I'm not sure platform dependencies are a good thing.
> 
> 
> Well, we should be consistent with password prompts, which (as I
> understand it) already go to /dev/tty on Unix.  

Looking at apr_password_get implementation, I see that it output to
/dev/tty only if HAVE_GETPASS is enabled, and system getpass uses
/dev/tty. Alternative apr implementations use stderr...

> If this means adding
> functionality to APR, then we should do so.

I'm not sure this should be done.
Futher, I doubt that anybody will place this task high in this priority list.
Therefore, changing stdout to stderr is all I'd like for now. It is certainly
better than the current behaviour.

- Volodya



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org

Re: [PATCH] use stderr when prompting for username

Posted by Greg Hudson <gh...@MIT.EDU>.
On Fri, 2002-12-27 at 03:08, Vladimir Prus wrote:
> > I think the prompt should be printed to the terminal (i.e., /dev/tty),
> > not stderr, when possible.
> 
> Is it possible to print anything to /dev/tty portably? Where that output would
> go on windows? And I'm not sure platform dependencies are a good thing.

Well, we should be consistent with password prompts, which (as I
understand it) already go to /dev/tty on Unix.  If this means adding
functionality to APR, then we should do so.


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org

Re: [PATCH] use stderr when prompting for username

Posted by Vladimir Prus <gh...@cs.msu.su>.
Matt Kraai wrote:
> On Wed, Dec 25, 2002 at 03:04:24PM +0300, Vladimir Prus wrote:
> 
>>This is a trivial patch with a simple purpose:
>>when redirecting output from a command (e.g. diff)
>>to a file, the "username:" prompt goes to the file too.
> 
> 
> I think the prompt should be printed to the terminal (i.e., /dev/tty),
> not stderr, when possible.

Is it possible to print anything to /dev/tty portably? Where that output would
go on windows? And I'm not sure platform dependencies are a good thing.

- Volodya



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org

Re: [PATCH] use stderr when prompting for username

Posted by Matt Kraai <kr...@alumni.cmu.edu>.
On Wed, Dec 25, 2002 at 03:04:24PM +0300, Vladimir Prus wrote:
> 
> This is a trivial patch with a simple purpose:
> when redirecting output from a command (e.g. diff)
> to a file, the "username:" prompt goes to the file too.

I think the prompt should be printed to the terminal (i.e., /dev/tty),
not stderr, when possible.

Matt

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org