pkgsrc-Changes-HG archive

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

[pkgsrc/trunk]: pkgsrc/mk/check Fix "illegal reference to local variable word...



details:   https://anonhg.NetBSD.org/pkgsrc/rev/518d69b420c4
branches:  trunk
changeset: 631635:518d69b420c4
user:      ryoon <ryoon%pkgsrc.org@localhost>
date:      Tue Mar 11 21:32:11 2014 +0000

description:
Fix "illegal reference to local variable word" error with lang/nawk
under Debian GNU/Linux 7.4.
lang/nawk's length(array) does not work as expected. So length(array) make
array as usual variable.

diffstat:

 mk/check/check-portability.awk |  13 +++++++++++--
 1 files changed, 11 insertions(+), 2 deletions(-)

diffs (34 lines):

diff -r b17a763e2f32 -r 518d69b420c4 mk/check/check-portability.awk
--- a/mk/check/check-portability.awk    Tue Mar 11 20:17:03 2014 +0000
+++ b/mk/check/check-portability.awk    Tue Mar 11 21:32:11 2014 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: check-portability.awk,v 1.5 2014/03/01 17:57:01 jklos Exp $
+# $NetBSD: check-portability.awk,v 1.6 2014/03/11 21:32:11 ryoon Exp $
 #
 # Checks a shell file for possible portability problems.
 #
@@ -11,6 +11,15 @@
        found_test_eqeq = no;
 }
 
+# length(array) of lang/nawk does not work as expected.
+function pkgsrc_length(arg, len) {
+       len = 0;
+       for (i in arg) {
+               len++
+       }
+       return len;
+}
+
 # Check for $RANDOM, which is specific to ksh and bash.
 function check_random(line) {
 
@@ -31,7 +40,7 @@
 
 function check_test_eqeq(line,  n, word, i) {
 
-       if (length(line) == 0 || length(word) == 0)
+       if (length(line) == 0 || pkgsrc_length(word) == 0)
                return;
        n = split(line, word);
        for (i = 3; i < n; i++) {



Home | Main Index | Thread Index | Old Index