diff options
author | des <des@FreeBSD.org> | 2002-10-15 09:19:48 +0800 |
---|---|---|
committer | des <des@FreeBSD.org> | 2002-10-15 09:19:48 +0800 |
commit | 04490f00a5fdfdc40e07304495e9c6f62666781d (patch) | |
tree | e464400035eb85cb3ad6262ac3a36784f0f913f2 /misc | |
parent | 03e6e5200f8c758b6b948acbc7adc524f342868c (diff) | |
download | freebsd-ports-gnome-04490f00a5fdfdc40e07304495e9c6f62666781d.tar.gz freebsd-ports-gnome-04490f00a5fdfdc40e07304495e9c6f62666781d.tar.zst freebsd-ports-gnome-04490f00a5fdfdc40e07304495e9c6f62666781d.zip |
Prevent infinite loop in master port detection code.
Diffstat (limited to 'misc')
-rw-r--r-- | misc/porteasy/Makefile | 2 | ||||
-rw-r--r-- | misc/porteasy/src/porteasy.pl | 12 |
2 files changed, 10 insertions, 4 deletions
diff --git a/misc/porteasy/Makefile b/misc/porteasy/Makefile index 8518d8215ea9..c7c9faa3ed8e 100644 --- a/misc/porteasy/Makefile +++ b/misc/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/misc/porteasy/src/porteasy.pl b/misc/porteasy/src/porteasy.pl index 199f9f5f214b..3ee5793aab2f 100644 --- a/misc/porteasy/src/porteasy.pl +++ b/misc/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); |