Skip to content

Commit d0a1df5

Browse files
committed
add an eg/ directory; the first eg/ script found several bugs in CPAN.pm and CPAN/Tarzip.pm and problems with distributions that I had overlooked so far; the tar/permission bugs are fixed too -- we still need a test case that proves the basename() fix to be correct
git-svn-id: https://pause.perl.org:5460/svn/cpanpm/trunk@315 81f69c26-07c4-0310-b1c3-f486c8728884
1 parent b76ff3c commit d0a1df5

File tree

6 files changed

+164
-3
lines changed

6 files changed

+164
-3
lines changed

Todo

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
2005-12-30 Andreas J. Koenig <[email protected]>
2+
3+
* DBM::Deep for a hash behind $CPAN::META.
4+
15
2005-12-29 Andreas J. Koenig <[email protected]>
26

37
* Bug suspected in Module::Install: it seems to run CPAN.pm in a

eg/find-module-install-sudo-bugs.pl

Lines changed: 142 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,142 @@
1+
2+
3+
4+
=pod
5+
6+
This script investigates all CPAN distros if they contain
7+
inc/Module/Install/AutoInstall.pm but not
8+
inc/{Module,ExtUtils}/AutoInstall.pm. We wanted to write these authors
9+
hat they should upgrade their distris with a newer release of
10+
Module::Install.
11+
12+
This exercise was amazing as it revealed several unrelated bugs like
13+
broken signatures and distros that could not be untarred for some
14+
reason. And bugs in CPAN.pm that did not react adequatly to certain
15+
error conditions.
16+
17+
=cut
18+
19+
use lib 'lib';
20+
use CPAN 1.81; # 1.80 broken for *.tgz
21+
use Cwd qw(cwd);
22+
use File::Path qw(rmtree);
23+
my $restart_after;
24+
if (-f "$0.out") {
25+
open my $fh, "$0.out" or die;
26+
while (<$fh>) {
27+
chomp;
28+
$restart_after = $_;
29+
}
30+
}
31+
my $cwd = cwd;
32+
my @brokensig = qw(
33+
A/AU/AUTRIJUS/Lingua-ZH-TaBE-0.06.tar.gz
34+
A/AU/AUTRIJUS/Parse-SVNDiff-0.03.tar.gz
35+
B/BM/BMORROW/PerlIO-nline-0.03.tar.gz
36+
B/BO/BOBMATH/Crypt-CAST5_PP-1.03.tar.gz
37+
B/BU/BURAK/CGI-Auth-Basic-1.02.tar.gz
38+
B/BU/BURAK/GD-SecurityImage-1.583.tar.gz
39+
B/BU/BURAK/MP3-M3U-Parser-2.1.tar.gz
40+
C/CR/CRAIHA/Geo-Coordinates-Parser-0.01.tar.gz
41+
D/DA/DARREN/Text-TabularDisplay-1.21.tar.gz
42+
D/DM/DMAKI/Class-Validating-0.02.tar.gz
43+
D/DM/DMAKI/DateTime-Event-Lunar-0.04.tar.gz
44+
D/DM/DMAKI/DateTime-Util-Astro-0.06.tar.gz
45+
D/DM/DMAKI/POE-Component-StackedProcessor-0.05.tar.gz
46+
D/DR/DROLSKY/DateTime-Format-HTTP-0.36.tar.gz
47+
G/GO/GOZER/Scalar-Readonly-0.01.tar.gz
48+
J/JJ/JJORE/B-Lisp-0.01.tar.gz
49+
J/JJ/JJORE/Geo-TigerLine-Abbreviations-0.02.tar.gz
50+
J/JM/JMEHNLE/apache-auth-userdb/Apache-Auth-UserDB-0.11.tar.gz
51+
J/JM/JMEHNLE/clamav-client/ClamAV-Client-0.11.tar.gz
52+
J/JM/JMEHNLE/courier-filter/Courier-Filter-0.17.tar.gz
53+
J/JM/JMEHNLE/net-address-ipv4-local/Net-Address-IPv4-Local-0.12.tar.gz
54+
J/JM/JMEHNLE/www-restaurant-menu/WWW-Restaurant-Menu-0.11.tar.gz
55+
K/KC/KCLARK/SQL-Translator-0.07.tar.gz
56+
K/KM/KMELTZ/SSN-Validate-0.13.tar.gz
57+
K/KU/KUDARASP/PHP-Strings-0.28.tar.gz
58+
L/LO/LORENSEN/Net-BGP-0.08.tar.gz
59+
N/NI/NIKC/SVN-Web-0.42.tar.gz
60+
P/PT/PTANDLER/PBib/Bundle-PBib-2.08.01.tar.gz
61+
P/PT/PTANDLER/PBib/Bundle-PBib-2.08.tar.gz
62+
R/RE/REEDFISH/Term-Menus-1.11.tar.gz
63+
R/RR/RRWO/Acme-AutoColor-0.01.tar.gz
64+
R/RR/RRWO/Acme-Mobile-Therbligs-0.04.tar.gz
65+
R/RR/RRWO/Algorithm-ScheduledPath-0.41.tar.gz
66+
R/RR/RRWO/Algorithm-SkipList-1.02.tar.gz
67+
R/RR/RRWO/CPAN-Mini-Tested-0.22.tar.gz
68+
R/RR/RRWO/CPAN-YACSmoke-0.03.tar.gz
69+
R/RR/RRWO/CPAN-YACSmoke-Plugin-Phalanx100-0.02.tar.gz
70+
R/RR/RRWO/File-HomeDir-Win32-0.03.tar.gz
71+
R/RR/RRWO/Graphics-ColorNames-1.06.tar.gz
72+
R/RR/RRWO/Log-Dispatch-Win32EventLog-0.13.tar.gz
73+
R/RR/RRWO/Logic-Kleene-0.05.tar.gz
74+
R/RR/RRWO/Module-Phalanx100-0.05.tar.gz
75+
R/RR/RRWO/Mozilla-Backup-0.06.tar.gz
76+
R/RR/RRWO/Params-Smart-0.06.tar.gz
77+
R/RR/RRWO/Pod-Readme-0.05.tar.gz
78+
R/RR/RRWO/Text-Truncate-1.03.tar.gz
79+
R/RR/RRWO/Tie-RangeHash-1.03.tar.gz
80+
R/RR/RRWO/Tie-RegexpHash-0.13.tar.gz
81+
R/RR/RRWO/Tree-Node-0.06.tar.gz
82+
R/RR/RRWO/Win32-EventLog-Carp-1.39.tar.gz
83+
S/SA/SAMV/Parse-SVNDiff-0.03.tar.gz
84+
S/SC/SCHUMACK/CircuitLayout-0.07.tar.gz
85+
S/SC/SCHUMACK/
86+
S/SI/SIMON/Lingua-EN-Keywords-2.0.tar.gz
87+
S/SI/SIMON/Mail-Miner-2.7.tar.gz
88+
S/SM/SMUELLER/Acme-Chef-1.00.tar.gz
89+
S/SM/SMUELLER/
90+
);
91+
92+
my @brokendist = qw(
93+
B/BC/BCH/Win32-Filenames-0.01.tar.gz
94+
B/BR/BRUNODIAZ/Finance-Bank-ES-INGDirect-0.02.tar.gz
95+
D/DA/DAOTOAD/Log-WithCallbacks-1.00.tar.gz
96+
D/DE/DENKINGER/Games-Poker-HistoryParser-1.3.tar.gz
97+
E/EC/ECASTILLA/DBIx-PasswordIniFile-1.1.tar.gz
98+
J/JO/JONATHAN/Math-Calculus-TaylorEquivalent-0.1.tar.gz
99+
J/JO/JONATHAN/Math-Calculus-TaylorSeries-0.1.tar.gz
100+
K/KO/KOKOGIKO/Location-GeoTool-Plugin-Locapoint-0.01.tar.gz
101+
M/MA/MARKWIN/CNC-Cog-0.06.tar.gz
102+
N/NI/NILSONSFJ/subs-parallel-0.07.tar.gz
103+
P/PH/PHOENIXL/extensible_report_generator_1.13.zip
104+
R/RV/RVOSA/Bio-Phylo-0.04.tar.gz
105+
);
106+
107+
for my $x (@brokensig,@brokendist) {
108+
if ($restart_after) {
109+
if ($x gt $restart_after) {
110+
$restart_after = $x;
111+
}
112+
} else {
113+
$restart_after = $x;
114+
}
115+
}
116+
117+
DISTRO: for $d (CPAN::Shell->expand("Distribution","/./")){
118+
my $id = $d->id;
119+
next if $restart_after && $id le $restart_after;
120+
print "---->[$id]<----\n";
121+
next DISTRO if grep {$_ eq $id or
122+
( m/\/$/ && substr($id,0,length($_)) eq $_)
123+
} @brokensig, @brokendist;
124+
$d->get;
125+
my $dir = $d->dir or die;
126+
if (-f "$dir/inc/Module/Install/AutoInstall.pm"
127+
&&
128+
! -f "$dir/inc/Module/AutoInstall.pm"
129+
&&
130+
! -f "$dir/inc/ExtUtils/AutoInstall.pm"){
131+
open my $rfh, ">>", "$cwd/$0.out" or die "Cannot open >$cwd/$0.out: $!";
132+
print $rfh $d->id, "\n";
133+
close $rfh;
134+
}
135+
rmtree $dir;
136+
}
137+
138+
__END__
139+
# Local Variables:
140+
# mode: cperl
141+
# cperl-indent-level: 2
142+
# End:

lib/CPAN.pm

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6617,7 +6617,7 @@ Forces a reload of all indices.
66176617
66186618
=item CPAN::Index::reload()
66196619
6620-
Reloads all indices if they have been read for more than
6620+
Reloads all indices if they have not been read for more than
66216621
C<$CPAN::Config->{index_expire}> days.
66226622
66236623
=item CPAN::InfoObj::dump()
@@ -7329,3 +7329,8 @@ http://member.nifty.ne.jp/hippo2000/perltips/CPAN.htm
73297329
cpan(1), CPAN::Nox(3pm), CPAN::Version(3pm)
73307330
73317331
=cut
7332+
7333+
# Local Variables:
7334+
# mode: cperl
7335+
# cperl-indent-level: 2
7336+
# End:

lib/CPAN/HandleConfig.pm

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -359,3 +359,9 @@ sub cpl {
359359
}
360360

361361
1;
362+
363+
__END__
364+
# Local Variables:
365+
# mode: cperl
366+
# cperl-indent-level: 2
367+
# End:

lib/CPAN/Tarzip.pm

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ package CPAN::Tarzip;
33
use strict;
44
use vars qw($VERSION @ISA $BUGHUNTING);
55
use CPAN::Debug;
6+
use File::Basename ();
67
$VERSION = sprintf "%.2f", substr(q$Rev$,4)/100;
78
# module is internal to CPAN.pm
89

@@ -13,7 +14,7 @@ $BUGHUNTING = 0; # released code must have turned off
1314
sub new {
1415
my($class,$file) = @_;
1516
die "new called without arg" unless defined $file;
16-
die "file[$file] doesn't match /\\.(bz2|gz|zip)\$/" unless $file =~ /\.(bz2|gz|zip)$/i;
17+
die "file[$file] doesn't match /\\.(bz2|gz|zip|tgz)\$/" unless $file =~ /\.(bz2|gz|zip|tgz)$/i;
1718
my $me = { FILE => $file };
1819
if (0) {
1920
} elsif ($file =~ /\.bz2$/i) {
@@ -217,7 +218,9 @@ installed. Can't continue.
217218
# pipes
218219
if ($is_compressed) {
219220
(my $ungzf = $file) =~ s/\.gz(?!\n)\Z//;
220-
if (CPAN::Tarzip->gunzip($file, $ungzf)) {
221+
$ungzf = File::Basename::basename($ungzf);
222+
my $ct = CPAN::Tarzip->new($file);
223+
if ($ct->gunzip($ungzf)) {
221224
$CPAN::Frontend->myprint(qq{Uncompressed $file successfully\n});
222225
} else {
223226
$CPAN::Frontend->mydie(qq{Couldn\'t uncompress $file\n});

t/mirroredby.t

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ is( $cmb->continent(), 'continent',
2222
is( $cmb->country(), 'country', 'country() should return country entry' );
2323
is( $cmb->url(), 'url', 'url() should return url entry' );
2424

25+
__END__
2526
# Local Variables:
2627
# mode: cperl
2728
# cperl-indent-level: 2

0 commit comments

Comments
 (0)