From cbb8e431b34711f518a1b94c214b44cb457c51d3 Mon Sep 17 00:00:00 2001 From: Marc Espie Date: Sat, 14 Jul 2001 14:20:12 +0000 Subject: Silly bug in version detection: not having any dewey check does NOT mean check went okay. In fact, if we only have exact versions to match against, we don't want to match... Ouch. --- usr.sbin/pkg/pkg.pl | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'usr.sbin/pkg/pkg.pl') diff --git a/usr.sbin/pkg/pkg.pl b/usr.sbin/pkg/pkg.pl index 8b705b496c2..8afaed25576 100644 --- a/usr.sbin/pkg/pkg.pl +++ b/usr.sbin/pkg/pkg.pl @@ -1,6 +1,6 @@ #!/usr/bin/perl # ex:ts=8 sw=4: -# $OpenBSD: pkg.pl,v 1.3 2001/04/24 22:14:10 espie Exp $ +# $OpenBSD: pkg.pl,v 1.4 2001/07/14 14:20:11 espie Exp $ # # Copyright (c) 2001 Marc Espie. # @@ -113,7 +113,10 @@ sub check_version return 1 if $v =~ /^$_$/; return 1 if $v =~ /^${_}p\d+$/; # allows for recent patches } - for (grep !/^\d/, @specs) { # dewey match, all of them + + # Last chance: dewey specs ? + my @deweys = grep !/^\d/, @specs; + for (@deweys) { if (m/^\<\=|\>\=|\<|\>/) { my ($op, $dewey) = ($&, $'); my $compare = dewey_compare($v, $dewey); @@ -121,9 +124,11 @@ sub check_version return 0 if $op eq '<=' && $compare > 0; return 0 if $op eq '>' && $compare <= 0; return 0 if $op eq '>=' && $compare < 0; + } else { + return 0; # unknown spec type } } - return 1; + return @deweys == 0 ? 0 : 1; } sub check_1flavor -- cgit v1.2.3