diff options
author | des <des@FreeBSD.org> | 2002-10-15 01:19:48 +0000 |
---|---|---|
committer | des <des@FreeBSD.org> | 2002-10-15 01:19:48 +0000 |
commit | 04490f00a5fdfdc40e07304495e9c6f62666781d (patch) | |
tree | e464400035eb85cb3ad6262ac3a36784f0f913f2 /ports-mgmt | |
parent | 03e6e5200f8c758b6b948acbc7adc524f342868c (diff) | |
download | FreeBSD-ports-04490f00a5fdfdc40e07304495e9c6f62666781d.zip FreeBSD-ports-04490f00a5fdfdc40e07304495e9c6f62666781d.tar.gz |
Prevent infinite loop in master port detection code.
Diffstat (limited to 'ports-mgmt')
-rw-r--r-- | ports-mgmt/porteasy/Makefile | 2 | ||||
-rw-r--r-- | ports-mgmt/porteasy/src/porteasy.pl | 12 |
2 files changed, 10 insertions, 4 deletions
diff --git a/ports-mgmt/porteasy/Makefile b/ports-mgmt/porteasy/Makefile index 8518d82..c7c9faa 100644 --- a/ports-mgmt/porteasy/Makefile +++ b/ports-mgmt/porteasy/Makefile @@ -8,7 +8,7 @@ # PORTNAME= porteasy -PORTVERSION= 2.7.3 +PORTVERSION= 2.7.4 CATEGORIES= misc MASTER_SITES= # none DISTFILES= # none diff --git a/ports-mgmt/porteasy/src/porteasy.pl b/ports-mgmt/porteasy/src/porteasy.pl index 199f9f5..3ee5793 100644 --- a/ports-mgmt/porteasy/src/porteasy.pl +++ b/ports-mgmt/porteasy/src/porteasy.pl @@ -33,7 +33,7 @@ use strict; use Fcntl; use Getopt::Long; -my $VERSION = "2.7.3"; +my $VERSION = "2.7.4"; my $COPYRIGHT = "Copyright (c) 2000-2002 Dag-Erling Smørgrav. " . "All rights reserved."; @@ -461,7 +461,6 @@ sub find_master($) { my $port = shift; # Port local *FILE; # File handle - my $master; # Master directory if ($masterport{$port}) { return $masterport{$port}; @@ -473,6 +472,8 @@ sub find_master($) { open(FILE, "$portsdir/$port/Makefile") or bsd::err(1, "unable to read Makefile for $port"); while (<FILE>) { + my $master; # Master directory + if (/^(?:MAIN|MASTER)DIR\s*=\s*(\S+)\s*$/) { $master = $1; } elsif (/^\.?include \"([^\"]+)\/Makefile(?:[^\/\"]*)\"\s*$/) { @@ -484,8 +485,13 @@ sub find_master($) { $master =~ s|/+|/|g; 1 while ($master =~ s|/[^\./]*/\.\./|/|); $master =~ s|^/||; + $master =~ s|/$||; + if ($master eq $port) { + bsd::warnx("master port heuristics failed for %s", $port); + next; + } if ($master !~ m|^[^/]+/[^/]+$|) { - bsd::warn("invalid master for %s: %s", $port, $master); + bsd::warnx("invalid master for %s: %s", $port, $master); next; } close(FILE); |