This is merely a historical archive of years 2008-2021, before the migration to mailman3.
A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.
Neels Hofmeyr gerrit-no-reply at lists.osmocom.org
Review at https://gerrit.osmocom.org/1944
NOT FOR MERGE: jenkins: check whether value_string check works
this one should pass, it includes the array's missing terminator
Change-Id: If16b49af4d2f035004d90fc86f99376ab2f9fbe7
---
M contrib/jenkins.sh
A contrib/verify_value_string_arrays_are_terminated.py
M src/gsm/gsm0808.c
3 files changed, 37 insertions(+), 0 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/44/1944/1
diff --git a/contrib/jenkins.sh b/contrib/jenkins.sh
index 108a73a..656f02f 100755
--- a/contrib/jenkins.sh
+++ b/contrib/jenkins.sh
@@ -2,6 +2,8 @@
set -ex
+./contrib/verify_value_string_arrays_are_terminated.py $(find . -name "*.[hc]")
+
autoreconf --install --force
./configure --enable-static --enable-sanitize
$MAKE $PARALLEL_MAKE check \
diff --git a/contrib/verify_value_string_arrays_are_terminated.py b/contrib/verify_value_string_arrays_are_terminated.py
new file mode 100755
index 0000000..51c0bd4
--- /dev/null
+++ b/contrib/verify_value_string_arrays_are_terminated.py
@@ -0,0 +1,34 @@
+#!/usr/bin/env python
+# vim: expandtab tabstop=2 shiftwidth=2 nocin
+
+'''
+Usage:
+ verify_value_string_arrays_are_terminated.py PATH [PATH [...]]
+
+e.g.
+libosmocore/contrib/verify_value_string_arrays_are_terminated.py $(find . -name "*.[hc]")
+'''
+
+import re
+import sys
+
+ws = r'\s*' + '\n' + r'*\s*'
+
+value_string_array_re = re.compile(
+ r'((\bstruct\s+value_string\b[^{;]*?)' + ws + '=[^{;]*{[^;]*}\s*;)',
+ re.MULTILINE | re.DOTALL)
+
+members = r'(\.(value|str)' + ws + '=' + ws + ')?'
+terminator_re = re.compile('{' + ws + members + '(0|NULL)' + ws + ','
+ + ws + members + '(0|NULL)' + ws + '}')
+errors_found = 0
+
+for f in sys.argv[1:]:
+ arrays = value_string_array_re.findall(open(f).read())
+ for array_def, name in arrays:
+ if not terminator_re.search(array_def):
+ print('ERROR: file contains unterminated value_string %r: %r'
+ % (name, f))
+ errors_found += 1
+
+sys.exit(errors_found)
diff --git a/src/gsm/gsm0808.c b/src/gsm/gsm0808.c
index 4035f46..de80006 100644
--- a/src/gsm/gsm0808.c
+++ b/src/gsm/gsm0808.c
@@ -540,6 +540,7 @@
static const struct value_string gsm0808_bssap_names[] = {
{ BSSAP_MSG_BSS_MANAGEMENT, "MANAGEMENT" },
{ BSSAP_MSG_DTAP, "DTAP" },
+ { 0, NULL }
};
const char *gsm0808_bssap_name(uint8_t msg_type)
--
To view, visit https://gerrit.osmocom.org/1944
To unsubscribe, visit https://gerrit.osmocom.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: If16b49af4d2f035004d90fc86f99376ab2f9fbe7
Gerrit-PatchSet: 1
Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Owner: Neels Hofmeyr <nhofmeyr at sysmocom.de>