httpd-apreq-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From j...@apache.org
Subject svn commit: r219214 - /httpd/apreq/trunk/build/version_check.pl
Date Fri, 15 Jul 2005 16:32:46 GMT
Author: joes
Date: Fri Jul 15 09:32:41 2005
New Revision: 219214

URL: http://svn.apache.org/viewcvs?rev=219214&view=rev
Log:

Fix bug in version_check: reports false negatives.
Excerpt from David Robins' article: 
==================================================
httpd-apreq-2 # perl Makefile.PL
perl: 5.8.6 ok
mod_perl: 2.000000 ok
Apache::Test: 1.25 ok
ExtUtils::MakeMaker: 6.17 ok
ExtUtils::XSBuilder: 0.27 ok
build/version_check.pl failed: Test::More version 0.6 unsupported (0.47 or 
greater is required).
# Looks like your test died before it could output anything.
Please upgrade Test::More first.
./configure --enable-perl-glue --with-perl="/usr/bin/perl"
sh: ./configure: No such file or directory

Doesn't seem to realize that 0.6 > 0.47.  The splitting code in 
build/version_check.pl looks very suspicious; perhaps use regular numeric 
comparison if there's < 2 dots (see attached diff)?
==================================================

Submitted by: David Robins
Message-ID: <200506272049.10980.dbrobins@davidrobins.net>
Reviewed by: joes

Modified:
    httpd/apreq/trunk/build/version_check.pl

Modified: httpd/apreq/trunk/build/version_check.pl
URL: http://svn.apache.org/viewcvs/httpd/apreq/trunk/build/version_check.pl?rev=219214&r1=219213&r2=219214&view=diff
==============================================================================
--- httpd/apreq/trunk/build/version_check.pl (original)
+++ httpd/apreq/trunk/build/version_check.pl Fri Jul 15 09:32:41 2005
@@ -212,17 +212,28 @@
 my %prereq = (%svn, %build, %perl_glue, %test);
 die "$0 failed: unknown tool '$tool'.\n" unless $prereq{$tool};
 my $version = $prereq{$tool}->{version};
-my @version = split /\./, $version;
 
 $_ = $prereq{$tool}->{test}->();
 die "$0 failed: no version_string found in '$_' for '$tool'.\n" unless /(\d[.\d]+)/;
 my $saw = $1;
-my @saw = split /\./, $saw;
-$_ = 0 for @saw[@saw .. $#version]; # ensure @saw has enough entries
-for (0.. $#version) {
-    last if $version[$_] < $saw[$_];
-    die <<EOM if $version[$_] > $saw[$_];
+my $fail;
+
+if ($saw =~ /^(\d+)(\.(\d+))$/) {
+    $fail = $saw < $version;
+} else {
+    my @version = split /\./, $version;
+    my @saw = split /\./, $saw;
+    $_ = 0 for @saw[@saw .. $#version]; # ensure @saw has enough entries
+    for (0.. $#version) {
+        last if $version[$_] < $saw[$_];
+        $fail = 1, last if $version[$_] > $saw[$_];
+    }
+}
+
+if ($fail) {
+    die <<EOM
 $0 failed: $tool version $saw unsupported ($version or greater is required).
 EOM
 }
+
 print "$tool: $saw ok\n";



Mime
View raw message