From 8b45fb5ff2725af620f263efaeddec20277d2675 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dag-Erling=20Sm=C3=B8rgrav?= Date: Tue, 15 Oct 2002 01:19:48 +0000 Subject: Prevent infinite loop in master port detection code. --- ports-mgmt/porteasy/Makefile | 2 +- ports-mgmt/porteasy/src/porteasy.pl | 12 +++++++++--- 2 files changed, 10 insertions(+), 4 deletions(-) (limited to 'ports-mgmt') diff --git a/ports-mgmt/porteasy/Makefile b/ports-mgmt/porteasy/Makefile index 8518d8215ea9..c7c9faa3ed8e 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 199f9f5f214b..3ee5793aab2f 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 () { + 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); -- cgit v1.2.3