From 61061471fe2d595d4e6eba0b273af7b544aa5ed6 Mon Sep 17 00:00:00 2001 From: macie Date: Sat, 8 Feb 2025 16:38:52 +0100 Subject: [PATCH] fix: False positive NETW-2400 on OpenWrt To save resources, BusyBox for OpenWrt is compiled without support for character classes in `tr` command (FEATURE_TR_CLASSES). In that case `tr` treats `[:alnum:]` like a group of single characters, so it misses all numbers and most of letters. --- include/tests_networking | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/include/tests_networking b/include/tests_networking index fcf40802..c7c3a180 100644 --- a/include/tests_networking +++ b/include/tests_networking @@ -69,7 +69,8 @@ LogText "Result: hostnamed is defined and not longer than 63 characters" fi # Test valid characters (normally a dot should not be in the name, but we can't be 100% sure we have short name) - FIND=$(echo "${HOSTNAME}" | ${TRBINARY} -d '[:alnum:]\.\-') + # (we are NOT using [:alnum:] to support BusyBox's tr on devices with limited resources) + FIND=$(echo "${HOSTNAME}" | ${TRBINARY} -d '[a-zA-Z0-9]\.\-') if [ -z "${FIND}" ]; then LogText "Result: good, no unexpected characters discovered in hostname" if IsVerbose; then Display --indent 2 --text "- Hostname (allowed characters)" --result "${STATUS_OK}" --color GREEN; fi