summaryrefslogtreecommitdiff
path: root/pkgtools/check-portability
diff options
context:
space:
mode:
authorrillig <rillig@pkgsrc.org>2020-04-19 12:05:14 +0000
committerrillig <rillig@pkgsrc.org>2020-04-19 12:05:14 +0000
commit9e2b58fe3743add27efffedd9e4c42016a5805d0 (patch)
tree39c2656061540a2d88244e89b1e382087eeb7285 /pkgtools/check-portability
parentc83ef51b69095d0c87280b84bdb95cc427f19a10 (diff)
downloadpkgsrc-9e2b58fe3743add27efffedd9e4c42016a5805d0.tar.gz
pkgtools/check-portability: update to 20.1.0
Changes since 19.4.3: The variable name RANDOM_FILE is ok since it doesn't have a special meaning to some shell implementations. Seen in www/curl.
Diffstat (limited to 'pkgtools/check-portability')
-rw-r--r--pkgtools/check-portability/Makefile4
-rw-r--r--pkgtools/check-portability/files/check-portability.c12
-rw-r--r--pkgtools/check-portability/files/testdata/random3
3 files changed, 11 insertions, 8 deletions
diff --git a/pkgtools/check-portability/Makefile b/pkgtools/check-portability/Makefile
index d1687809725..1b7069289e3 100644
--- a/pkgtools/check-portability/Makefile
+++ b/pkgtools/check-portability/Makefile
@@ -1,6 +1,6 @@
-# $NetBSD: Makefile,v 1.8 2020/03/21 15:02:20 rillig Exp $
+# $NetBSD: Makefile,v 1.9 2020/04/19 12:05:14 rillig Exp $
-PKGNAME= check-portability-19.4.3
+PKGNAME= check-portability-20.1.0
CATEGORIES= pkgtools
DISTFILES= # none
diff --git a/pkgtools/check-portability/files/check-portability.c b/pkgtools/check-portability/files/check-portability.c
index e9644e6f2d0..4dcc8aa3c83 100644
--- a/pkgtools/check-portability/files/check-portability.c
+++ b/pkgtools/check-portability/files/check-portability.c
@@ -1,4 +1,4 @@
-/* $NetBSD: check-portability.c,v 1.12 2020/03/21 15:02:20 rillig Exp $ */
+/* $NetBSD: check-portability.c,v 1.13 2020/04/19 12:05:14 rillig Exp $ */
/*
Copyright (c) 2020 Roland Illig
@@ -39,9 +39,9 @@
static const size_t npos = -1;
static bool
-is_alnum(char c)
+is_alnumu(char c)
{
- return isalnum((unsigned char) c) != 0;
+ return isalnum((unsigned char) c) != 0 || c == '_';
}
static bool
@@ -160,12 +160,12 @@ cstr_right_of_last(cstr s, cstr delimiter)
}
static bool
-cstr_has_word_boundary(cstr s, size_t idx)
+cstr_has_varname_boundary(cstr s, size_t idx)
{
assert(idx <= s.len);
if (idx == 0 || idx == s.len)
return true;
- return is_alnum(s.data[idx - 1]) != is_alnum(s.data[idx]);
+ return is_alnumu(s.data[idx - 1]) != is_alnumu(s.data[idx]);
}
// str is a modifiable string buffer.
@@ -376,7 +376,7 @@ checkline_sh_dollar_random(cstr filename, size_t lineno, cstr line)
size_t idx = cstr_index(line, CSTR("$RANDOM"));
// Variable names that only start with RANDOM are not special.
- if (idx == npos || !cstr_has_word_boundary(line, idx + 7))
+ if (idx == npos || !cstr_has_varname_boundary(line, idx + 7))
return;
// $RANDOM together with the PID is often found in GNU-style
diff --git a/pkgtools/check-portability/files/testdata/random b/pkgtools/check-portability/files/testdata/random
index 302c34a6af7..c5095524f32 100644
--- a/pkgtools/check-portability/files/testdata/random
+++ b/pkgtools/check-portability/files/testdata/random
@@ -16,3 +16,6 @@ ${RANDOM}
# This is not a special variable.
$RANDOMNESS
+
+# This is not a special variable as well.
+$RANDOM_FILE