-
Notifications
You must be signed in to change notification settings - Fork 698
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
Use mkdir -p when creating directories #10556
Conversation
Hi @maage. Thanks for your PR. I'm waiting for a ComplianceAsCode member to verify that this patch is reasonable to test. If it is, they should reply with Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
This datastream diff is auto generated by the check Click here to see the full diffbash remediation for rule 'xccdf_org.ssgproject.content_rule_accounts_polyinstantiated_tmp' differs.
--- xccdf_org.ssgproject.content_rule_accounts_polyinstantiated_tmp
+++ xccdf_org.ssgproject.content_rule_accounts_polyinstantiated_tmp
@@ -1,9 +1,10 @@
# Remediation is applicable only in certain platforms
if ! ( [ "${container:-}" == "bwrap-osbuild" ] ); then
-if ! [ -d /tmp/tmp-inst ] ; then
- mkdir --mode 000 /tmp/tmp-inst
-fi
+#!/bin/bash
+
+# shellcheck disable=SC2174
+mkdir -p --mode 000 /tmp/tmp-inst
chmod 000 /tmp/tmp-inst
chcon --reference=/tmp /tmp/tmp-inst
bash remediation for rule 'xccdf_org.ssgproject.content_rule_accounts_polyinstantiated_var_tmp' differs.
--- xccdf_org.ssgproject.content_rule_accounts_polyinstantiated_var_tmp
+++ xccdf_org.ssgproject.content_rule_accounts_polyinstantiated_var_tmp
@@ -1,11 +1,12 @@
# Remediation is applicable only in certain platforms
if ! ( [ "${container:-}" == "bwrap-osbuild" ] ); then
-if ! [ -d /tmp-inst ] ; then
- mkdir --mode 000 /var/tmp/tmp-inst
-fi
+#!/bin/bash
+
+# shellcheck disable=SC2174
+mkdir -p --mode 000 /var/tmp/tmp-inst
chmod 000 /var/tmp/tmp-inst
-chcon --reference=/var/tmp/ /var/tmp/tmp-inst
+chcon --reference=/var/tmp /var/tmp/tmp-inst
if ! grep -Eq '^\s*/var/tmp\s+/var/tmp/tmp-inst/\s+level\s+root,adm$' /etc/security/namespace.conf ; then
if grep -Eq '^\s*/var/tmp\s+' /etc/security/namespace.conf ; then
bash remediation for rule 'xccdf_org.ssgproject.content_rule_sssd_enable_pam_services' differs.
--- xccdf_org.ssgproject.content_rule_sssd_enable_pam_services
+++ xccdf_org.ssgproject.content_rule_sssd_enable_pam_services
@@ -5,7 +5,7 @@
SSSD_CONF_DIR="/etc/sssd/conf.d/*.conf"
if [ ! -f "$SSSD_CONF" ] && [ ! -f "$SSSD_CONF_DIR" ]; then
- mkdir /etc/sssd
+ mkdir -p /etc/sssd
touch "$SSSD_CONF"
fi
|
Failures here is good example why something like my #10387 is needed. Maybe there should be some different test phase / code phrase than "ERROR" to catch these. I think this just means we try to test some rule but it is totally not configured for product. Tests did not fail.
I'll add fix for I'll add fix for
|
Code Climate has analyzed commit 7205a61 and detected 0 issues on this pull request. The test coverage on the diff in this pull request is 100.0% (50% is the threshold). This pull request will bring the total coverage in the repository to 52.4% (0.0% change). View more on Code Climate. |
Well, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for this PR @maage . I see the last commits in this PR are not related to mkdir -p
changes. Please, move these last commits to another PR and keep this only about mkdir
changes.
linux_os/guide/system/permissions/files/dir_perms_world_writable_root_owned/bash/shared.sh
Outdated
Show resolved
Hide resolved
...tem/permissions/partitions/mount_option_nodev_nonroot_local_partitions/tests/correct.pass.sh
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for these improvements and also thanks for the great analysis in #10556 (comment).
I confirm the errors reported in the containers tests (automatus) can be waived in this PR.
Description:
This ensure mkdir does not fail if directory already exists.
Also avoid unnecessary tests.
Added simple style changes.
Rationale:
Simplify code.
Review Hints:
Changes are all over unfortunately.