From: Alexander Popov Date: Mon, 14 Aug 2023 15:56:13 +0000 (+0300) Subject: Test an unexpected line in the sysctl file X-Git-Tag: v0.6.6~90 X-Git-Url: https://jxself.org/git/?a=commitdiff_plain;h=575ae82ab6ca197a5fd502ecddc548f76d20cb4a;p=kconfig-hardened-check.git Test an unexpected line in the sysctl file --- diff --git a/.github/workflows/functional_test.sh b/.github/workflows/functional_test.sh index a4fb085..cbacf87 100644 --- a/.github/workflows/functional_test.sh +++ b/.github/workflows/functional_test.sh @@ -125,4 +125,9 @@ echo 'hey man 1' > cmdline echo 'hey man 2' >> cmdline coverage run -a --branch bin/kconfig-hardened-check -c test.config -l cmdline && exit 1 +echo ">>>>> unexpected line in the sysctl file <<<<<" +cp $SYSCTL_EXAMPLE error_sysctls +echo 'some strange line' >> error_sysctls +coverage run -a --branch bin/kconfig-hardened-check -c test.config -s error_sysctls && exit 1 + echo "The end of the functional tests" diff --git a/kconfig_hardened_check/__init__.py b/kconfig_hardened_check/__init__.py index d7df1bf..3e4db1c 100644 --- a/kconfig_hardened_check/__init__.py +++ b/kconfig_hardened_check/__init__.py @@ -205,7 +205,7 @@ def parse_sysctl_file(mode, parsed_options, fname): for line in f.readlines(): line = line.strip() if not sysctl_pattern.match(line): - sys.exit(f'[!] ERROR: unexpected line in sysctl file: {line}') + sys.exit(f'[!] ERROR: unexpected line in sysctl file: "{line}"') option, value = line.split('=', 1) option = option.strip() value = value.strip()