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

test 1.5.1 fails if entry is in multiple files #26

Closed
jamesleetong opened this issue Mar 18, 2020 · 3 comments
Closed

test 1.5.1 fails if entry is in multiple files #26

jamesleetong opened this issue Mar 18, 2020 · 3 comments
Assignees
Labels

Comments

@jamesleetong
Copy link

test 1.5.1 fails if the configuration is listed on multiple files

grep "fs.suid_dumpable" /etc/sysctl.conf /etc/sysctl.d/*.conf

/etc/sysctl.conf:fs.suid_dumpable = 0
/etc/sysctl.d/99-sysctl.conf:fs.suid_dumpable = 0

the next comparison will fail, as there are multiple lines output being compared.
sed 's/^.*://')" == "fs.suid_dumpable = 0"

maybe add a pipe to uniq to resolve this?

[ "$(grep "fs.suid_dumpable" /etc/sysctl.conf /etc/sysctl.d/.conf | sed 's/^.://' | uniq)" == "fs.suid_dumpable = 0" ]

@Joseph94m
Copy link

I'm also having this issue. The 99-sysctl.conf file has a reference to the /etc/sysctl.conf file.
This also happens with the 1.5.3 test.

@Joseph94m
Copy link

[ "$(grep "fs.suid_dumpable" /etc/sysctl.conf /etc/sysctl.d/.conf | sed 's/^.://' | uniq)" == "fs.suid_dumpable = 0" ]

There should be a star before ".conf" in that command

@finalduty finalduty self-assigned this Jul 14, 2020
@finalduty finalduty added the bug label Jul 14, 2020
@finalduty
Copy link
Owner

Hey @jamesleetong and @Joseph94m, thanks for your reports and my apologies for not getting on to this sooner.

I have replicated this issue and @jamesleetong I think piping through uniq is a good solution for 1.5.1 and 1.5.3. I have updated the script with your suggestion and will push it shortly. I have also applied this to the functions responsible for tests 3.1.1 through 3.3.2 which use similar logic.

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

No branches or pull requests

3 participants