Subject: pkg/27875: lintpkgsrc(1) generate many `uninitialized value' warnings
To: None <gnats-bugs@gnats.NetBSD.org>
From: None <njoly@pasteur.fr>
List: pkgsrc-bugs
Date: 11/04/2004 13:34:41
>Number:         27875
>Category:       pkg
>Synopsis:       lintpkgsrc(1) generate many `uninitialized value' warnings
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    pkg-manager
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Thu Nov 04 12:35:00 UTC 2004
>Closed-Date:
>Last-Modified:
>Originator:     Nicolas Joly
>Release:        NetBSD 2.99.10
>Organization:
Institut Pasteur
>Environment:
System: NetBSD lanfeust.sis.pasteur.fr 2.99.10 NetBSD 2.99.10 (LANFEUST) #7: Thu Nov 4 11:07:59 CET 2004 njoly@lanfeust.sis.pasteur.fr:/local/src/NetBSD/obj/amd64/sys/arch/amd64/compile/LANFEUST amd64
Architecture: x86_64
Machine: amd64
>Description:

lintpkgsrc(1) generate many warnings on -current pkgsrc:

njoly@lanfeust [~/NetBSD]> lintpkgsrc -i > pkgdepgraph.in
Scanning Makefiles: Use of uninitialized value in pattern match (m//) at /usr/pkg/bin/lintpkgsrc line 747.
Use of uninitialized value in pattern match (m//) at /usr/pkg/bin/lintpkgsrc line 747.
Use of uninitialized value in pattern match (m//) at /usr/pkg/bin/lintpkgsrc line 747.
.......Use of uninitialized value in pattern match (m//) at /usr/pkg/bin/lintpkgsrc line 747.
..Use of uninitialized value in pattern match (m//) at /usr/pkg/bin/lintpkgsrc line 747.
[...]
...Use of uninitialized value in pattern match (m//) at /usr/pkg/bin/lintpkgsrc line 747.
5102 packages                            

>How-To-Repeat:
lintpkgsrc -i > pkgdepgraph.in
>Fix:
Check if `$pkgname' is defined before trying to use it.

Index: pkgtools/pkglint/files/lintpkgsrc.pl
===================================================================
RCS file: /cvsroot/pkgsrc/pkgtools/pkglint/files/lintpkgsrc.pl,v
retrieving revision 1.93
diff -u -r1.93 lintpkgsrc.pl
--- pkgtools/pkglint/files/lintpkgsrc.pl	5 Sep 2004 23:12:37 -0000	1.93
+++ pkgtools/pkglint/files/lintpkgsrc.pl	4 Nov 2004 12:22:10 -0000
@@ -744,7 +744,7 @@
     if (defined $vars->{DISTNAME})
 	{ debug("$file: DISTNAME=$vars->{DISTNAME}\n"); }
 
-    if ($pkgname !~ /(.*)-(\d.*)/)
+    if (! defined $pkgname || $pkgname !~ /(.*)-(\d.*)/)
 	{
 	# invoke make here as a last resort
 	my($pkgsrcdir) = ($file =~ m:(/.*)/:);
>Release-Note:
>Audit-Trail:
>Unformatted: