Subject: pkglint and variable with number (was Re: CVS commit: wip/XFree86-docs)
To: None <tech-pkg@netbsd.org>
From: Jeremy C. Reed <reed@reedmedia.net>
List: tech-pkg
Date: 07/23/2003 22:12:09
(Previously mentioned on pkgsrc-wip-discuss where this message is also
bcc'd.)

Is this fix okay?

--- /usr/pkg/bin/pkglint	Sat Apr  5 17:54:31 2003
+++ /home/reed/netbsd/pkglint	Wed Jul 23 22:07:18 2003
@@ -1084,7 +1084,7 @@
 				(($pkgname eq '') ? "DISTNAME." : "PKGNAME."));
 		}
 		# Be very smart. Kids, don't do this at home.
-		if ($k =~ /\$(\(|\{)([A-Z_-]+)(\)|\})/) {
+		if ($k =~ /\$(\(|\{)([A-Z][A-Z0-9_-]*)(\)|\})/) {
 			$k1 = $2;
 			$k = $1 if ($rawwhole =~ /\n$k1[ \t]*?=[ \t]*([^\n]+)\n/);
 		}

By the way, make(1) says: "Variables in make are much like variables in
the shell, and, by tradition, consist of all upper-case letters."

But that "all upper-case letters" means that X11BASE, MOTIF12BASE,
EMACS_USE_XAW3D, P4ROOT, MPG123_ARM_FIXED64, and various other variables
are illegal. So make(1) appears to be wrong.

And we know and sh(1) says "Variables set by the user must have a name
consisting solely of alphabetics, numerics, and underscores - the first of
which must not be numeric."

My patch above has it start with uppercase letter and then followed by
optional letter, number, dash and/or underscore. (I don't care if it ends
with a dash or underscore, but maybe it should check for that too?)

   Jeremy C. Reed
   http://bsd.reedmedia.net/