Skip to content
New issue

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

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

Already on GitHub? # to your account

update shared.sh #3333

Merged
merged 1 commit into from
Sep 19, 2018
Merged

update shared.sh #3333

merged 1 commit into from
Sep 19, 2018

Conversation

Mixer9
Copy link
Contributor

@Mixer9 Mixer9 commented Sep 18, 2018

Removed cut function and returned the last field with awk, this provides better listing since not all values returned will have the same fields. It also removes whitespace at the beginning of the values returned. see comparison below:

[root@soctxadm01:~]# rpm -Va --nofiledigest | grep '^.M' | cut -d ' ' -f4-
/etc/selinux/targeted/active/seusers
 /etc/selinux/targeted/active/users_extra
/var/lib/rpm/__db.001
/var/lib/rpm/__db.002
/var/lib/rpm/__db.003
 /opt/splunkforwarder/etc/auth
/var/lib/systemd/random-seed
 /etc/insights-client/.exp.sed
 /etc/insights-client/.fallback.json
 /etc/insights-client/.fallback.json.asc
 /etc/insights-client/cert-api.access.redhat.com.pem
/etc/insights-client/insights-client.conf
 /etc/insights-client/redhattools.pub.gpg
 /etc/insights-client/rpm.egg
 /etc/insights-client/rpm.egg.asc
/var/lock/iscsi
/var/lock/iscsi/lock
/run/lsm
/run/lsm/ipc
/var/log/dmesg
[root@soctxadm01:~]# rpm -Va --nofiledigest | grep '^.M' | awk '{print $NF}'
/etc/selinux/targeted/active/seusers
/etc/selinux/targeted/active/users_extra
/var/lib/rpm/__db.001
/var/lib/rpm/__db.002
/var/lib/rpm/__db.003
/opt/splunkforwarder/etc/auth
/var/lib/systemd/random-seed
/etc/insights-client/.exp.sed
/etc/insights-client/.fallback.json
/etc/insights-client/.fallback.json.asc
/etc/insights-client/cert-api.access.redhat.com.pem
/etc/insights-client/insights-client.conf
/etc/insights-client/redhattools.pub.gpg
/etc/insights-client/rpm.egg
/etc/insights-client/rpm.egg.asc
/var/lock/iscsi
/var/lock/iscsi/lock
/run/lsm
/run/lsm/ipc
/var/log/dmesg

Description:

Change rpm command to get list of files that permissions changed on.

Rationale:

The original method returns empty fields from values who have less fields.

Removed cut function and returned the last field with awk, this provides better listing since not all values returned will have the same fields. It also removes whitespace at the beginning of the values returned. see comparison below:

<code>
[root@soctxadm01:~]# rpm -Va --nofiledigest | grep '^.M' | cut -d ' ' -f4-
/etc/selinux/targeted/active/seusers
 /etc/selinux/targeted/active/users_extra
/var/lib/rpm/__db.001
/var/lib/rpm/__db.002
/var/lib/rpm/__db.003
 /opt/splunkforwarder/etc/auth
/var/lib/systemd/random-seed
 /etc/insights-client/.exp.sed
 /etc/insights-client/.fallback.json
 /etc/insights-client/.fallback.json.asc
 /etc/insights-client/cert-api.access.redhat.com.pem
/etc/insights-client/insights-client.conf
 /etc/insights-client/redhattools.pub.gpg
 /etc/insights-client/rpm.egg
 /etc/insights-client/rpm.egg.asc
/var/lock/iscsi
/var/lock/iscsi/lock
/run/lsm
/run/lsm/ipc
/var/log/dmesg
[root@soctxadm01:~]# rpm -Va --nofiledigest | grep '^.M' | awk '{print $NF}'
/etc/selinux/targeted/active/seusers
/etc/selinux/targeted/active/users_extra
/var/lib/rpm/__db.001
/var/lib/rpm/__db.002
/var/lib/rpm/__db.003
/opt/splunkforwarder/etc/auth
/var/lib/systemd/random-seed
/etc/insights-client/.exp.sed
/etc/insights-client/.fallback.json
/etc/insights-client/.fallback.json.asc
/etc/insights-client/cert-api.access.redhat.com.pem
/etc/insights-client/insights-client.conf
/etc/insights-client/redhattools.pub.gpg
/etc/insights-client/rpm.egg
/etc/insights-client/rpm.egg.asc
/var/lock/iscsi
/var/lock/iscsi/lock
/run/lsm
/run/lsm/ipc
/var/log/dmesg
</code>
@openscap-ci
Copy link
Collaborator

Can one of the admins verify this patch?

@scrutinizer-notifier
Copy link

The inspection completed: No new issues

@cipherboy
Copy link
Contributor

@openscap-ci test this please.

@jan-cerny jan-cerny added this to the 0.1.41 milestone Sep 19, 2018
@jan-cerny jan-cerny self-assigned this Sep 19, 2018
@jan-cerny
Copy link
Collaborator

@Mixer9 This is great.

But I noticed that it is different form the code in Ansible in #3328. I know it was there before, but I think it should be the same. My opinion is that --nofiledigest should be added to the Ansible code as well. We don't need to verify digests in this rule and it will speed up a little bit (on my machine from 46 seconds to 20 seconds).

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

Successfully merging this pull request may close these issues.

5 participants