pkgsrc-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[pkgsrc/trunk]: pkgsrc/pkgtools/pkglint/files Fixed two issues reported by wiz:



details:   https://anonhg.NetBSD.org/pkgsrc/rev/d224896763fd
branches:  trunk
changeset: 548448:d224896763fd
user:      rillig <rillig%pkgsrc.org@localhost>
date:      Thu Oct 16 09:08:21 2008 +0000

description:
Fixed two issues reported by wiz:

- Perl 5.10 complains when closedir() is called on an undefined
  directory handle, and is correct to do so. Since directory handles are
  global variables, they must be used carefully in recursive functions.

- The PLIST.* variables still had some warning suspecting a "spelling
  mistake". This has been fixed by marking all PLIST_VARS as being used.

diffstat:

 pkgtools/pkglint/files/pkglint.pl |  8 +++++---
 1 files changed, 5 insertions(+), 3 deletions(-)

diffs (39 lines):

diff -r c2f80d29f4ad -r d224896763fd pkgtools/pkglint/files/pkglint.pl
--- a/pkgtools/pkglint/files/pkglint.pl Wed Oct 15 23:17:29 2008 +0000
+++ b/pkgtools/pkglint/files/pkglint.pl Thu Oct 16 09:08:21 2008 +0000
@@ -1,5 +1,5 @@
 #! @PERL@
-# $NetBSD: pkglint.pl,v 1.774 2008/10/09 16:19:24 rillig Exp $
+# $NetBSD: pkglint.pl,v 1.775 2008/10/16 09:08:21 rillig Exp $
 #
 
 # pkglint - static analyzer and checker for pkgsrc packages
@@ -2752,9 +2752,11 @@
        if (!opendir(DIR, $dir)) {
                return true;
        }
+       my @subdirs = readdir(DIR);
+       closedir(DIR) or die;
 
        $rv = true;
-       foreach my $subdir (readdir(DIR)) {
+       foreach my $subdir (@subdirs) {
                next if $subdir eq "." || $subdir eq ".." || $subdir eq "CVS";
                next if -d "${dir}/${subdir}" && is_emptydir("${dir}/${subdir}");
 
@@ -2762,7 +2764,6 @@
                last;
        }
 
-       closedir(DIR);
        return $rv;
 }
 
@@ -6256,6 +6257,7 @@
                        foreach my $id (split(qr"\s+", $line->get("value"))) {
                                $mkctx_plist_vars->{"PLIST.$id"} = true;
                                $opt_debug_misc and $line->log_debug("PLIST.${id} is added to PLIST_VARS.");
+                               use_var($line, "PLIST.$id");
                        }
 
                } elsif ($varcanon eq "USE_TOOLS") {



Home | Main Index | Thread Index | Old Index