CISOfy / lynis

Lynis - Security auditing tool for Linux, macOS, and UNIX-based systems. Assists with compliance testing (HIPAA/ISO27001/PCI DSS) and system hardening. Agentless, and installation optional.
https://cisofy.com/lynis/
GNU General Public License v3.0
13.24k stars 1.48k forks source link

Shellcheck error, tests_boot_services line 150 #1566

Open wileyhy opened 3 days ago

wileyhy commented 3 days ago

It looks like a test option could be incorrect.

Lines 150 of /usr/share/lynis/include/tests_boot_services contains a test for a non-zero length string which will always return true. Perhaps what was intended was a test for whether the string was a directory, as on line 152?

 149             "Solaris")
 150                 if [ -n "${ROOTDIR}usr/bin/svcs" ]; then
 151                     SERVICE_MANAGER="SMF (svcs)"
 152                 elif [ -d "${ROOTDIR}etc/init.d" ]; then
 153                     SERVICE_MANAGER="SysV Init"
 154                 fi

Version

Output # shellcheck -s sh -S error /usr/share/lynis/include/*

In /usr/share/lynis/include/tests_boot_services line 150: if [ -n "${ROOTDIR}usr/bin/svcs" ]; then ^----------^ SC2157 (error): Argument to -n is always true due to literal strings.

nser77 commented 1 day ago

Mmmm, I agree with you.

I checked the repository with a regular expression and this seems to be the only match.

PR #1569 should solve this issue by just fixing the typo.