From f0c84e3d0190b43c08ec5d04eaa4f1ebf05bd39e Mon Sep 17 00:00:00 2001 From: Michael Boelen Date: Mon, 17 Sep 2018 11:46:36 +0200 Subject: [PATCH] [KRNL-5788] ignore exception when no vmlinuz file was discovered --- include/tests_kernel | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/include/tests_kernel b/include/tests_kernel index 2b3b7dc3..c735d65e 100644 --- a/include/tests_kernel +++ b/include/tests_kernel @@ -370,11 +370,13 @@ if [ "${LINUX_VERSION}" = "Debian" -o "${LINUX_VERSION}" = "Ubuntu" ]; then PREQS_MET="YES"; else PREQS_MET="NO"; fi Register --test-no KRNL-5788 --os Linux --preqs-met ${PREQS_MET} --weight L --network NO --category security --description "Checking availability new Linux kernel" if [ ${SKIPTEST} -eq 0 ]; then + HAS_VMLINUZ=0 LogText "Test: Searching apt-cache, to determine if a newer kernel is available" if [ -x ${ROOTDIR}usr/bin/apt-cache ]; then LogText "Result: found ${ROOTDIR}usr/bin/apt-cache" LogText "Test: checking readlink location of ${ROOTDIR}vmlinuz" if [ -f ${ROOTDIR}vmlinuz ]; then + HAS_VMLINUZ=1 FINDKERNFILE=$(readlink -f ${ROOTDIR}vmlinuz) LogText "Output: readlink reported file ${FINDKERNFILE}" LogText "Test: checking package from dpkg -S" @@ -395,9 +397,11 @@ if IsEmpty "${FINDINST}"; then Display --indent 2 --text "- Checking for available kernel update" --result "${STATUS_UNKNOWN}" --color YELLOW LogText "Result: Exception occurred, no output from apt-cache policy" - ReportException "${TEST_NO}:01" - LogText "Exception: apt-cache policy did not return an installed kernel version" - ReportSuggestion ${TEST_NO} "Check the output of apt-cache policy manually to determine why output is empty" + if [ ${HAS_VMLINUZ} -eq 1 ]; then + ReportException "${TEST_NO}:01" + ReportSuggestion ${TEST_NO} "Check the output of apt-cache policy to determine why its output is empty" + fi + LogText "Result: apt-cache policy did not return an installed kernel version" else if [ "${FINDINST}" = "${FINDCAND}" ]; then if [ -e /dev/grsec ]; then