From 13baf99619985262261754ffea49c87ad91f8996f205d476e69deda285b1c9fe Mon Sep 17 00:00:00 2001 From: OBS User unknown Date: Wed, 20 Dec 2006 21:05:07 +0000 Subject: [PATCH] OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/perl?expand=0&rev=2 --- perl-gracefull-net-ftp.diff | 66 +++++++++++++++++++++++++++++++++++++ perl.changes | 8 +++++ perl.spec | 11 +++++-- 3 files changed, 83 insertions(+), 2 deletions(-) create mode 100644 perl-gracefull-net-ftp.diff diff --git a/perl-gracefull-net-ftp.diff b/perl-gracefull-net-ftp.diff new file mode 100644 index 0000000..40c9b0f --- /dev/null +++ b/perl-gracefull-net-ftp.diff @@ -0,0 +1,66 @@ +This patch avoids several silly warnings, and fills $res->status_line with something useful +in case your FTP server babbles some text message without a leading response code. +Seen from ftp.opensuse.org: +connect(3, {sa_family=AF_INET, sin_port=htons(21), sin_addr=inet_addr("195.135.221.134")}, 16) = 0 +read(3, "This server is busy, please try again later or any of my mirrors: http://download.opensuse.org\n\n", 1024) = 96 +Note the missing "500 " before "This". +Command line ftp clients handle this gracefully, so should we. + +With this patch, LWP clients see a status_line of "500 This server is busy, ..." +2006-12-20, jw@suse.de + +--- perl-5.8.8/lib/Net/FTP.pm.orig 2006-12-20 21:09:01.075906000 +0100 ++++ perl-5.8.8/lib/Net/FTP.pm 2006-12-20 21:09:17.324643000 +0100 +@@ -119,7 +119,7 @@ + unless ($ftp->response() == CMD_OK) + { + $ftp->close(); +- $@ = $ftp->message; ++ $@ = $ftp->message || $@; # keep @$ if no message. Happens, when response did not start with a code. + undef $ftp; + } + +@@ -1107,7 +1107,7 @@ + sub response + { + my $ftp = shift; +- my $code = $ftp->SUPER::response(); ++ my $code = $ftp->SUPER::response() || 5; # assume 500 if undef + + delete ${*$ftp}{'net_ftp_pasv'} + if ($code != CMD_MORE && $code != CMD_INFO); +@@ -1122,9 +1122,11 @@ + + my $ftp = shift; + ++ + # Darn MS FTP server is a load of CRAP !!!! ++ # Expect to see undef here. + return () +- unless ${*$ftp}{'net_cmd_code'} + 0; ++ unless 0 + (${*$ftp}{'net_cmd_code'}||0); + + (${*$ftp}{'net_cmd_code'},1); + } +--- perl-5.8.8/lib/Net/Cmd.pm.orig 2006-12-20 21:09:05.850129000 +0100 ++++ perl-5.8.8/lib/Net/Cmd.pm 2006-12-20 21:09:17.332631000 +0100 +@@ -338,9 +338,11 @@ + if ($cmd->debug); + + ($code,$more) = $cmd->parse_response($str); ++ + unless(defined $code) + { + $cmd->ungetline($str); ++ $@ = $str; # $@ is used as a tunneling hack. + last; + } + +@@ -351,6 +353,7 @@ + last unless($more); + } + ++ return undef unless defined $code; + substr($code,0,1); + } + diff --git a/perl.changes b/perl.changes index 2978dcd..c3b793f 100644 --- a/perl.changes +++ b/perl.changes @@ -1,3 +1,11 @@ +------------------------------------------------------------------- +Wed Dec 20 21:17:03 CET 2006 - jw@suse.de + +- graceful-net-ftp patch added. + Lousy FTP server responses could trigger silly error messages in Net::FTP + and had no usable status_line in LWP. + Now it is 500 + whatever message the server responded. + ------------------------------------------------------------------- Fri Feb 17 15:27:39 CET 2006 - mls@suse.de diff --git a/perl.spec b/perl.spec index 48352d0..dbd8241 100644 --- a/perl.spec +++ b/perl.spec @@ -13,7 +13,7 @@ Name: perl BuildRequires: db-devel -License: GPL, Artistic License +License: Artistic License, GNU General Public License (GPL) Group: Development/Languages/Perl Provides: perl-500 perl-base perl-Digest perl-Digest-MD5 perl-Filter-Simple perl-I18N-LangTags perl-MIME-Base64 perl-Storable perl-Test-Simple perl-Text-Balanced perl-Time-HiRes perl-libnet Obsoletes: perl-Digest perl-Digest-MD5 perl-Filter-Simple perl-I18N-LangTags perl-MIME-Base64 perl-Storable perl-Test-Simple perl-Text-Balanced perl-Time-HiRes perl-libnet @@ -21,10 +21,11 @@ Requires: gzip PreReq: %fillup_prereq Autoreqprov: on Version: 5.8.8 -Release: 4 +Release: 34 Summary: The Perl interpreter Source: perl-%{version}.tar.bz2 Patch: perl-%{version}.dif +Patch1: perl-gracefull-net-ftp.diff BuildRoot: %{_tmppath}/%{name}-%{version}-build %description @@ -48,6 +49,7 @@ Authors: %prep %setup -q -n perl-5.8.8 %patch +%patch1 -p1 %build options="-Doptimize='$RPM_OPT_FLAGS -Wall -pipe'" @@ -118,6 +120,11 @@ touch $cpa/perllocal.pod %ghost %doc /usr/share/man/man3/perllocal.3pm.gz %changelog -n perl +* Wed Dec 20 2006 - jw@suse.de +- graceful-net-ftp patch added. + Lousy FTP server responses could trigger silly error messages in Net::FTP + and had no usable status_line in LWP. + Now it is 500 + whatever message the server responded. * Fri Feb 17 2006 - mls@suse.de - suppress prototype warning in autouse [#151459] * Wed Feb 01 2006 - mls@suse.de