Skip to content

test: adapt to the new capsh format - #14768

Merged
keszybz merged 1 commit into
systemd:masterfrom
mrc0mmand:fix-test-execute-on-newer-libcap
Feb 5, 2020
Merged

keszybz merged 1 commit into
systemd:masterfrom
mrc0mmand:fix-test-execute-on-newer-libcap

Conversation

@mrc0mmand

@mrc0mmand mrc0mmand commented Feb 4, 2020 •

Copy link
Copy Markdown
Member

Since libcap v2.29 the format of cap_to_text() has been changed which
makes certain test-execute subtests fail. Let's remove the offending
part of the output (dropped capabilities) to make it compatible with
both the old and the new libcap.


Fixes: #14548

I'm not really fan of this change, but it makes it compatible with both cap_to_text() formats, by simply dropping any (space separated) capability groups marked as dropped (suffixed by -[eip]) from the output.

Alternative approaches would be either parsing output of pscap (from libcap-ng-utils), as getpcaps uses cap_to_text() as well, or parsing and AND/OR-ing capabilities directly from /proc/$$/stat. Nothing else comes to my mind right now.

I gave it a try in systemd/systemd-centos-ci#220 with libcap-2.30 and it seems to work as expected.

/cc @keszybz

Since libcap v2.29 the format of cap_to_text() has been changed which
makes certain `test-execute` subtest fail. Let's remove the offending
part of the output (dropped capabilities) to make it compatible with
both the old and the new libcap.

@anitazha anitazha left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

CentOS CI affected by #14764.

LGTM; It's a simple enough fix considering the other options. I don't think it needs to get more complicated than this.

@keszybz
keszybz merged commit 9569e38 into systemd:master Feb 5, 2020
@mrc0mmand
mrc0mmand deleted the fix-test-execute-on-newer-libcap branch February 5, 2020 09:14
mrc0mmand added a commit to mrc0mmand/systemd-centos-ci that referenced this pull request Feb 5, 2020
mrc0mmand added a commit to systemd/systemd-centos-ci that referenced this pull request Feb 5, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Development

Successfully merging this pull request may close these issues.

libcap >= 2.29 breaks test-execute

3 participants