From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) by finch.gentoo.org (Postfix) with ESMTP id B7971138A1A for ; Wed, 11 Feb 2015 09:03:33 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 66677E0922; Wed, 11 Feb 2015 09:03:30 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 651C9E0930 for ; Wed, 11 Feb 2015 09:03:29 +0000 (UTC) Received: from oystercatcher.gentoo.org (oystercatcher.gentoo.org [148.251.78.52]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 722B03407B7 for ; Wed, 11 Feb 2015 09:03:28 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id 1C55C1183F for ; Wed, 11 Feb 2015 09:03:27 +0000 (UTC) From: "Sven Eden" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Sven Eden" Message-ID: <1423645402.7816796df99454603bd978dc1ea15d7a5b6abd9a.yamakuzure@gentoo> Subject: [gentoo-commits] proj/ufed:master commit in: / X-VCS-Repository: proj/ufed X-VCS-Files: Portage.pm X-VCS-Directories: / X-VCS-Committer: yamakuzure X-VCS-Committer-Name: Sven Eden X-VCS-Revision: 7816796df99454603bd978dc1ea15d7a5b6abd9a X-VCS-Branch: master Date: Wed, 11 Feb 2015 09:03:27 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Archives-Salt: f0a8f8bb-c23d-491a-800f-5c1fe4eefccc X-Archives-Hash: 1d266ac8a28f62e06b15f666b3fb990a commit: 7816796df99454603bd978dc1ea15d7a5b6abd9a Author: Sven Eden havi de> AuthorDate: Wed Feb 11 09:03:22 2015 +0000 Commit: Sven Eden gmx de> CommitDate: Wed Feb 11 09:03:22 2015 +0000 URL: http://sources.gentoo.org/gitweb/?p=proj/ufed.git;a=commit;h=7816796d Portage.pm: Fixed a possible "Use of uninitialized value" if a read file is empty. (Bug #539682) --- Portage.pm | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/Portage.pm b/Portage.pm index 534de52..d90be5e 100644 --- a/Portage.pm +++ b/Portage.pm @@ -418,7 +418,8 @@ sub _determine_profiles @_profiles = -l $mp_path ? _norm_path('/etc', $mp) : $mp; for (my $i = -1; $i >= -@_profiles; $i--) { for(_noncomments("${_profiles[$i]}/parent")) { - splice(@_profiles, $i, 0, _norm_path(${_profiles[$i]}, $_)); + length($_) + and splice(@_profiles, $i, 0, _norm_path(${_profiles[$i]}, $_)); } } return; @@ -723,9 +724,10 @@ sub _noncomments { local $/; if(open my $file, '<', $fname) { binmode( $file, ":encoding(UTF-8)" ); - @result = split /(?:[^\S\n]*(?:#.*)?\n)+/, <$file>."\n"; - shift @result if @result>0 && $result[0] eq ''; + my $content = <$file> || ""; close $file; + @result = split /(?:[^\S\n]*(?:#.*)?\n)+/, "$content\n"; + shift @result while ( (@result > 0) && !length($result[0]) ); } } @@ -766,7 +768,8 @@ sub _read_archs { for my $dir(@_profiles) { next unless (-r "$dir/arch.list"); for my $arch (_noncomments("$dir/arch.list")) { - defined($_use_temp->{$arch}) + length($arch) + and defined($_use_temp->{$arch}) and delete($_use_temp->{$arch}); } }