New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
leading spaces on cpan configuration causes failure #6994
Comments
From warrend@tek.comCreated by warrend@tek.comWhen I started cpan for the first time on perl-5.8.2 and started the The results were this as the next prompt first line This surprised me as the leading spaces were actually used. Many other areas Perl Info
|
From @schwern
The attached patch makes CPAN::FirstTime consistent in its stripping of In two places I've left the input unstripped, the proxy username and |
From @schwernCPAN_FirstTime.patch--- lib/CPAN/FirstTime.pm 2005/07/12 06:41:25 1.1
+++ lib/CPAN/FirstTime.pm 2005/07/12 06:55:31
@@ -12,7 +12,7 @@
package CPAN::FirstTime;
use strict;
-use ExtUtils::MakeMaker qw(prompt);
+use ExtUtils::MakeMaker ();
use FileHandle ();
use File::Basename ();
use File::Path ();
@@ -68,23 +68,22 @@
];
- my $manual_conf =
- ExtUtils::MakeMaker::prompt("Are you ready for manual configuration?",
- "yes");
+ my $manual_conf = prompt("Are you ready for manual configuration?", "yes");
my $fastread;
{
- local $^W;
- if ($manual_conf =~ /^\s*y/i) {
+ if ($manual_conf =~ /^y/i) {
$fastread = 0;
- *prompt = \&ExtUtils::MakeMaker::prompt;
} else {
$fastread = 1;
$CPAN::Config->{urllist} ||= [];
+
+ local $^W = 0;
# prototype should match that of &MakeMaker::prompt
- *prompt = sub ($;$) {
+ *_real_prompt = sub ($;$) {
my($q,$a) = @_;
my($ret) = defined $a ? $a : "";
printf qq{%s [%s]\n\n}, $q, $ret;
+
$ret;
};
}
@@ -198,8 +197,8 @@
defined($default = $CPAN::Config->{cache_metadata}) or $default = 1;
do {
$ans = prompt("Cache metadata (yes/no)?", ($default ? 'yes' : 'no'));
- } while ($ans !~ /^\s*[yn]/i);
- $CPAN::Config->{cache_metadata} = ($ans =~ /^\s*y/i ? 1 : 0);
+ } while ($ans !~ /^[yn]/i);
+ $CPAN::Config->{cache_metadata} = ($ans =~ /^y/i ? 1 : 0);
#
# term_is_latin
@@ -222,8 +221,8 @@
do {
$ans = prompt("Your terminal expects ISO-8859-1 (yes/no)?",
($default ? 'yes' : 'no'));
- } while ($ans !~ /^\s*[yn]/i);
- $CPAN::Config->{term_is_latin} = ($ans =~ /^\s*y/i ? 1 : 0);
+ } while ($ans !~ /^[yn]/i);
+ $CPAN::Config->{term_is_latin} = ($ans =~ /^y/i ? 1 : 0);
#
# save history in file histfile
@@ -241,8 +240,6 @@
defined($default = $CPAN::Config->{histfile}) or
$default = File::Spec->catfile($CPAN::Config->{cpan_home},"histfile");
$ans = prompt("File to save your history?", $default);
- $ans =~ s/^\s+//;
- $ans =~ s/\s+\z//;
$CPAN::Config->{histfile} = $ans;
if ($CPAN::Config->{histfile}) {
@@ -428,7 +425,7 @@
be asked for your username in every future session.
};
- if ($CPAN::Config->{proxy_user} = prompt("Your proxy user id?",$default)) {
+ if ($CPAN::Config->{proxy_user} = prompt_no_strip("Your proxy user id?",$default)) {
print qq{
Your password for the authenticating proxy can also be stored
@@ -448,7 +445,7 @@
};
}
- $CPAN::Config->{proxy_pass} = prompt("Your proxy password?");
+ $CPAN::Config->{proxy_pass} = prompt_no_strip("Your proxy password?");
if ($CPAN::META->has_inst("Term::ReadKey")) {
Term::ReadKey::ReadMode("restore");
}
@@ -692,8 +689,6 @@
$ans = prompt ($prompt, "");
if ($ans) {
- $ans =~ s/^\s+//; # no leading spaces
- $ans =~ s/\s+\z//; # no trailing spaces
$ans =~ s|/?\z|/|; # has to end with one slash
$ans = "file:$ans" unless $ans =~ /:/; # without a scheme is a file:
if ($ans =~ /^\w+:\/./) {
@@ -715,5 +710,29 @@
print "New set of picks:\n";
map { print " $_\n" } @{$CPAN::Config->{urllist}};
}
+
+
+sub _strip_spaces {
+ $_[0] =~ s/^\s+//; # no leading spaces
+ $_[0] =~ s/\s+\z//; # no trailing spaces
+}
+
+
+sub prompt ($;$) {
+ my $ans = _real_prompt(@_);
+
+ _strip_spaces($ans);
+
+ return $ans;
+}
+
+
+sub prompt_no_strip ($;$) {
+ return _real_prompt(@_);
+}
+
+
+*_real_prompt = \*ExtUtils::MakeMaker::prompt;
+
1;
|
The RT System itself - Status changed from 'new' to 'open' |
From @steve-m-hayMichael G Schwern via RT wrote:
Given the discussions about leading/trailing spaces in Unix paths in the Your patch works on the basis that such paths are unlikely so anyone I would agree with this, even though it does mean that if you actually Before this patch goes in, does anyone disagree? And if we're agreed that leading spaces should be removed from paths on Radan Computational Ltd. The information contained in this message and any files transmitted with it are confidential and intended for the addressee(s) only. If you have received this message in error or there are any problems, please notify the sender immediately. The unauthorized use, disclosure, copying or alteration of this message is strictly forbidden. Note that any views or opinions presented in this email are solely those of the author and do not necessarily represent those of Radan Computational Ltd. The recipient(s) of this message should check it and any attached files for viruses: Radan Computational will accept no liability for any damage caused by any virus transmitted by this email. |
From @schwernOn Wed, Jul 13, 2005 at 09:39:43AM +0100, Steve Hay wrote:
I can see that for the username but not for the password. -- |
From @steve-m-hayMichael G Schwern wrote:
OK - applied as change 25147 with the username stripped of spaces but Radan Computational Ltd. The information contained in this message and any files transmitted with it are confidential and intended for the addressee(s) only. If you have received this message in error or there are any problems, please notify the sender immediately. The unauthorized use, disclosure, copying or alteration of this message is strictly forbidden. Note that any views or opinions presented in this email are solely those of the author and do not necessarily represent those of Radan Computational Ltd. The recipient(s) of this message should check it and any attached files for viruses: Radan Computational will accept no liability for any damage caused by any virus transmitted by this email. |
From @steve-m-hayNow fixed in bleadperl. Should be in 5.8.8 (or otherwise in 5.10), and |
@steve-m-hay - Status changed from 'open' to 'resolved' |
Migrated from rt.perl.org#24691 (status was 'resolved')
Searchable as RT24691$
The text was updated successfully, but these errors were encountered: