fstests: add a filter for the new getcap output

Starting with version 2.41 of libcap, the output of the getcap program
changed and therefore some existing tests fail when the installed version
of libcap is >= 2.41 (the latest version available at the moment is 2.44).

The change was made by the following commit of libcap:

  commit 177cd418031b1acfcf73fe3b1af9f3279828681c
  Author: Andrew G. Morgan <morgan@kernel.org>
  Date:   Tue Jul 21 22:58:05 2020 -0700

      A more compact form for the text representation of capabilities.

      While this does not change anything about the supported range of
      equivalent text specifications for capabilities, as accepted by
      cap_from_text(), this does alter the preferred output format of
      cap_to_text() to be two characters shorter in most cases. That is,
      what used to be summarized as:

         "= cap_foo+..."

      is now converted to the equivalent text:

         "cap_foo=..."

      which is also more intuitive.

So add a filter to change the old format to the new one, an helper that
calls getcap with that filter, make existing tests use the new helper and
update their golden output to match the new output format of getcap.

Signed-off-by: Filipe Manana <fdmanana@suse.com>
Reviewed-by: Eryu Guan <guaneryu@gmail.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
This commit is contained in:
Filipe Manana
2020-10-11 13:38:52 +01:00
committed by Eryu Guan
parent ab3df57e86
commit 2b5cf241ec
10 changed files with 55 additions and 21 deletions
+2 -2
View File
@@ -55,7 +55,7 @@ _scratch_mount "-o metacopy=on"
$XFS_IO_PROG -c "stat" ${SCRATCH_MNT}/file1 >>$seqres.full
# Make sure cap_setuid is still there
$GETCAP_PROG ${SCRATCH_MNT}/file1 | _filter_scratch
_getcap ${SCRATCH_MNT}/file1 | _filter_scratch
# Trigger metadata only copy-up
chmod 000 ${SCRATCH_MNT}/file2
@@ -64,7 +64,7 @@ chmod 000 ${SCRATCH_MNT}/file2
$XFS_IO_PROG -c "stat" ${SCRATCH_MNT}/file2 >>$seqres.full
# Make sure cap_setuid is still there
$GETCAP_PROG ${SCRATCH_MNT}/file2 | _filter_scratch
_getcap ${SCRATCH_MNT}/file2 | _filter_scratch
# success, all done
status=0
+2 -2
View File
@@ -1,3 +1,3 @@
QA output created by 064
SCRATCH_MNT/file1 = cap_setuid+ep
SCRATCH_MNT/file2 = cap_setuid+ep
SCRATCH_MNT/file1 cap_setuid=ep
SCRATCH_MNT/file2 cap_setuid=ep