From: Junio C Hamano <gitster@pobox.com>
To: Michael Witten <mfwitten@MIT.EDU>
Cc: git@vger.kernel.org
Subject: Re: [PATCH 1/2][Perlers?] git-send-email: ssh/login style password requests
Date: Sat, 02 Feb 2008 13:31:17 -0800 [thread overview]
Message-ID: <7vve5711wa.fsf@gitster.siamese.dyndns.org> (raw)
In-Reply-To: 1201925161-9864-1-git-send-email-mfwitten@mit.edu
Michael Witten <mfwitten@MIT.EDU> writes:
> 2 files changed, 53 insertions(+), 9 deletions(-)
Documentation part looks very clear. Thanks.
> + if (defined $smtp_authuser) {
> +
> + if (!defined $smtp_authpass) {
> +
> + system "stty -echo";
> +
> + do {
> + $_ = $term->readline("Password: ");
> + } while (!defined $_);
> +
> + system "stty echo";
> +
> + $smtp_authpass = $_ if ($_);
> + }
> +
Another example which appears in PerlFAQ #8 uses ReadKey with
its ReadLine, like this:
use Term::ReadKey;
ReadMode('noecho');
$password = ReadLine(0);
which is different from Term::ReadLine's "ReadLine". An earlier
example you cited from perlfunc.pod's crypt() entry does:
system "stty -echo";
print "Password: ";
chomp($word = <STDIN>);
print "\n";
system "stty echo";
In either case, I was worried about the interaction between the
Term::ReadLine backend implementation and "stty".
Actually, I just tried this myself:
#!/usr/bin/perl -w
use Term::ReadLine;
my $term = new Term::ReadLine 'foobar';
my ($user, $password);
while (!defined $user) {
$user = $term->readline("User: ");
}
system 'stty -echo';
while (!defined $password) {
$password = $term->readline("Password: ");
}
system 'stty echo';
print "You said <$user><$password>\n";
print "ReadLine backend used was ", $term->ReadLine, "\n";
In my case, the backend was "Term::ReadLine::Perl". A few
problems:
* After typing "junio <Enter>" to "User:", an extra newline is
left before "Password:" prompt;
* "Password:" prompt still echoed password "abc". There was no
extra newline before "You said <junio><abc>".
* In either case, typing <Enter> returns an empty string from
$term->readline() so the "while (!defined)" loop does not buy
us anything.
next prev parent reply other threads:[~2008-02-02 21:32 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-02-01 4:59 [PATCH] git-send-email: ssh/login style password requests Michael Witten
2008-02-01 10:09 ` Junio C Hamano
2008-02-01 18:38 ` Michael Witten
2008-02-01 22:42 ` Michael Witten
2008-02-01 23:34 ` Junio C Hamano
2008-02-01 23:42 ` Michael Witten
2008-02-02 1:27 ` Junio C Hamano
2008-02-02 4:06 ` [PATCH 1/2][Perlers?] " Michael Witten
2008-02-02 4:06 ` [PATCH 2/2][Perlers?] git-send-email: SIG{TERM,INT} handlers Michael Witten
2008-02-02 21:31 ` Junio C Hamano
2008-02-02 21:31 ` Junio C Hamano [this message]
2008-02-03 17:59 ` [PATCH 1/2][Perlers?] git-send-email: ssh/login style password requests Michael Witten
2008-02-03 20:59 ` Michael Witten
2008-02-04 0:53 ` [PATCH 1/3][V.2] " Michael Witten
2008-02-04 0:53 ` [PATCH 2/3][V.2] git-send-email: SIG{TERM,INT} handlers Michael Witten
2008-02-04 0:53 ` [PATCH 3/3][V.2] git-send-email: Better handling of EOF [^D] Michael Witten
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=7vve5711wa.fsf@gitster.siamese.dyndns.org \
--to=gitster@pobox.com \
--cc=git@vger.kernel.org \
--cc=mfwitten@MIT.EDU \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.