Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Shellcheck error, tests_boot_services line 150 #1566

Open
wileyhy opened this issue Oct 22, 2024 · 1 comment
Open

Shellcheck error, tests_boot_services line 150 #1566

wileyhy opened this issue Oct 22, 2024 · 1 comment

Comments

@wileyhy
Copy link

wileyhy commented Oct 22, 2024

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

  • Windows 11 running VMware Workstation 17 Player, version 17.6.1
  • ...running Fedora 40, kernel 6.11.3
  • Lynis version 3.1.2

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.

This was referenced Oct 23, 2024
@nser77
Copy link
Contributor

nser77 commented Oct 23, 2024

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants