Skip to content

Comments

tests: Rework 'find' calls with multiple file type filters#1405

Merged
travier merged 2 commits intocoreos:testing-develfrom
travier:findtypes
Feb 17, 2022
Merged

tests: Rework 'find' calls with multiple file type filters#1405
travier merged 2 commits intocoreos:testing-develfrom
travier:findtypes

Conversation

@travier
Copy link
Member

@travier travier commented Jan 5, 2022

Fedora has a recent enough find command to be able to use the -type f,d option but that is not yet supported by find on RHEL.

We can not use -type f -type d instead as this filters on entries
being both a file and a directory which never happens.

Thus rework tests using that option to be compatible on both FCOS and
RHCOS. We can drop this change once RHCOS moves to RHEL 9.

Fixes: dac1f68

@bgilbert
Copy link
Contributor

bgilbert commented Jan 5, 2022

We can not use -type f -type d instead as this filters on entries being both a file and a directory which never happens.

We could use -type f -o -type d.

@miabbott
Copy link
Member

miabbott commented Jan 5, 2022

Good catch on the use of -type f -type d; the changed behavior looks correct now.

@travier
Copy link
Member Author

travier commented Jan 5, 2022

We can not use -type f -type d instead as this filters on entries being both a file and a directory which never happens.

We could use -type f -o -type d.

Could idea. Made a new try.

@travier travier force-pushed the findtypes branch 2 times, most recently from 0616be6 to 3ae0ee6 Compare January 5, 2022 20:49
@travier
Copy link
Member Author

travier commented Jan 17, 2022

This one is green but missing RHCOS testing.

Fedora has a recent enough `find` command to be able to use the `-type
f,d` option but that is not yet supported by `find` on RHEL.

We can not use `-type f -type d` instead as this filters on entries
being both a file and a directory which never happens. Thus we must
explicitely duplicate the entire filters and actions and use `-o` to OR
them.

This reworks the tests using that option to be compatible on both FCOS
and RHCOS. We can drop this change once RHCOS moves to RHEL 9.

This also includes `/usr` in the file-directory-permissions test and
tries to figure out which package the offending files/dires come from.

Fixes: coreos@dac1f68
@travier
Copy link
Member Author

travier commented Jan 27, 2022

Updated with RHCOS support. Not pretty. Open to suggestions.

Copy link
Member

@cgwalters cgwalters left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Didn't review the find incantations in depth, but looks sane to me!


# List of known files and directories with group write permission (RHCOS only)
list_known_rhcos=(
'/usr/share/licenses/publicsuffix-list-dafsa/COPYING'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tempting to just canonicalize this in our ostree builds too.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But indeed, we can directly fix it in openshift/os too and drop this case from the test.

'/usr/sbin/unix_chkpwd'
)

# List of known files and directories with SetUID bit set (RHCOS only)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is another case where we're saying "rhcos" but we really mean "rhel8".

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

Successfully merging this pull request may close these issues.

4 participants