bug-wget
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Bug-wget] Use stderr instead of stdout for --ask-password


From: Gilles Carry
Subject: Re: [Bug-wget] Use stderr instead of stdout for --ask-password
Date: Wed, 23 Feb 2011 15:06:25 +0100
User-agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; fr; rv:1.9.2.13) Gecko/20101207 Thunderbird/3.1.7

Sure.
I'm not sure about the right prompting policies.
But your solution would still make the prompt invisible.

Thanks for your quick answer, anyway.

Cheers,
Gilles.

Le 2/23/2011 10:23 AM, Giuseppe Scrivano a écrit :
Hello Gilles,

thanks for your patch.  I am not sure it is a good idea to use stderr
to prompt a message to the user.  I would just inhibit the message when
-O- is used.

Cheers,
Giuseppe



Gilles Carry<address@hidden>  writes:

Hello,

Here is a small patch to change the ask-password behaviour.
You may find the explanation in patch's changelog.
I confess I did not test much this patch.

Best regards,
Thank-you,
Gilles.

diff --git a/src/ChangeLog b/src/ChangeLog
index f37814d..b9bf2d7 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,13 @@
+2011-02-22  Gilles Carry<gilles dot carry at st dot com>
+
+       * main.c (prompt_for_password): Use stderr instead of stdout
+       to prompt password. This allows to use --output-document=- and
+       --ask-password simultaneously. Without this, redirecting stdout
+       makes password prompt invisible and mucks up payload such as in
+       this example:
+       wget --output-document=- --ask-password -user=foo \
+               http://foo.com/tarball.tgz | tar zxf -
+
  2009-09-22  Micah Cowan<address@hidden>

        * openssl.c (ssl_check_certificate): Avoid reusing the same buffer
diff --git a/src/main.c b/src/main.c
index dddc4b2..db1638f 100644
--- a/src/main.c
+++ b/src/main.c
@@ -725,9 +725,9 @@ static char *
  prompt_for_password (void)
  {
    if (opt.user)
-    printf (_("Password for user %s: "), quote (opt.user));
+    fprintf (stderr, _("Password for user %s: "), quote (opt.user));
    else
-    printf (_("Password: "));
+    fprintf (stderr, _("Password: "));
    return getpass("");
  }





reply via email to

[Prev in Thread] Current Thread [Next in Thread]