mirror of
https://github.com/linux-apfs/apfstests.git
synced 2026-05-01 15:01:44 -07:00
062: Sort recursive getfattr output
Test 062 was made "generic" a while back, but it fails on any filesystem which returns getfattr -R results (aka readdir results) in something other than inode-order. With a little awk-fu we can sort the records from getfattr -R so that the output is the same for xfs as well as ext4, etc. Also filter out lost+found which extN creates at mkfs time, but some other filesystems do not. Signed-off-by: Eric Sandeen <sandeen@redhat.com> Reviewed-by: Christoph Hellwig <hch@lst.de>
This commit is contained in:
@@ -67,7 +67,7 @@ _create_test_bed()
|
||||
mknod $SCRATCH_MNT/dev/c c 0 0
|
||||
mknod $SCRATCH_MNT/dev/p p
|
||||
# sanity check
|
||||
find $SCRATCH_MNT | LC_COLLATE=POSIX sort | _filter_scratch
|
||||
find $SCRATCH_MNT | LC_COLLATE=POSIX sort | _filter_scratch | grep -v "lost+found"
|
||||
}
|
||||
|
||||
# real QA test starts here
|
||||
@@ -160,18 +160,18 @@ _extend_test_bed()
|
||||
# whack a symlink in the middle, just to be difficult
|
||||
ln -s $SCRATCH_MNT/here/up $SCRATCH_MNT/descend/and
|
||||
# dump out our new starting point
|
||||
find $SCRATCH_MNT | LC_COLLATE=POSIX sort | _filter_scratch
|
||||
find $SCRATCH_MNT | LC_COLLATE=POSIX sort | _filter_scratch | grep -v "lost+found"
|
||||
}
|
||||
|
||||
_extend_test_bed
|
||||
|
||||
echo
|
||||
echo "*** directory descent with us following symlinks"
|
||||
getfattr -h -L -R -m '.' -e hex $SCRATCH_MNT
|
||||
getfattr -h -L -R -m '.' -e hex $SCRATCH_MNT | _sort_getfattr_output
|
||||
|
||||
echo
|
||||
echo "*** directory descent without following symlinks"
|
||||
getfattr -h -P -R -m '.' -e hex $SCRATCH_MNT
|
||||
getfattr -h -P -R -m '.' -e hex $SCRATCH_MNT | _sort_getfattr_output
|
||||
|
||||
|
||||
#
|
||||
|
||||
@@ -508,79 +508,21 @@ SCRATCH_MNT/lnk
|
||||
SCRATCH_MNT/reg
|
||||
|
||||
*** directory descent with us following symlinks
|
||||
# file: SCRATCH_MNT/reg
|
||||
trusted.name=0xbabe
|
||||
trusted.name3=0xdeface
|
||||
user.name=0xbabe
|
||||
user.name3=0xdeface
|
||||
|
||||
# file: SCRATCH_MNT/dir
|
||||
trusted.name=0xbabe
|
||||
trusted.name3=0xdeface
|
||||
user.name=0xbabe
|
||||
user.name3=0xdeface
|
||||
|
||||
# file: SCRATCH_MNT/lnk
|
||||
trusted.name=0xbabe
|
||||
trusted.name3=0xdeface
|
||||
|
||||
# file: SCRATCH_MNT/dev/b
|
||||
trusted.name=0xbabe
|
||||
trusted.name3=0xdeface
|
||||
|
||||
# file: SCRATCH_MNT/dev/c
|
||||
trusted.name=0xbabe
|
||||
trusted.name3=0xdeface
|
||||
|
||||
# file: SCRATCH_MNT/dev/p
|
||||
trusted.name=0xbabe
|
||||
trusted.name3=0xdeface
|
||||
|
||||
# file: SCRATCH_MNT/here
|
||||
trusted.9=0x3837
|
||||
trusted.a=0x6263
|
||||
|
||||
# file: SCRATCH_MNT/here/up
|
||||
trusted.9=0x3837
|
||||
trusted.a=0x6263
|
||||
|
||||
# file: SCRATCH_MNT/here/up/ascend
|
||||
trusted.9=0x3837
|
||||
trusted.a=0x6263
|
||||
|
||||
# file: SCRATCH_MNT/descend
|
||||
user.1=0x3233
|
||||
user.x=0x797a
|
||||
|
||||
# file: SCRATCH_MNT/descend/down
|
||||
user.1=0x3233
|
||||
user.x=0x797a
|
||||
|
||||
# file: SCRATCH_MNT/descend/down/here
|
||||
user.1=0x3233
|
||||
user.x=0x797a
|
||||
|
||||
# file: SCRATCH_MNT/descend/and/ascend
|
||||
trusted.9=0x3837
|
||||
trusted.a=0x6263
|
||||
|
||||
# file: SCRATCH_MNT/descend/down
|
||||
user.1=0x3233
|
||||
user.x=0x797a
|
||||
|
||||
*** directory descent without following symlinks
|
||||
# file: SCRATCH_MNT/reg
|
||||
trusted.name=0xbabe
|
||||
trusted.name3=0xdeface
|
||||
user.name=0xbabe
|
||||
user.name3=0xdeface
|
||||
|
||||
# file: SCRATCH_MNT/dir
|
||||
trusted.name=0xbabe
|
||||
trusted.name3=0xdeface
|
||||
user.name=0xbabe
|
||||
user.name3=0xdeface
|
||||
|
||||
# file: SCRATCH_MNT/lnk
|
||||
trusted.name=0xbabe
|
||||
trusted.name3=0xdeface
|
||||
# file: SCRATCH_MNT/descend/down/here
|
||||
user.1=0x3233
|
||||
user.x=0x797a
|
||||
|
||||
# file: SCRATCH_MNT/dev/b
|
||||
trusted.name=0xbabe
|
||||
@@ -594,6 +536,12 @@ trusted.name3=0xdeface
|
||||
trusted.name=0xbabe
|
||||
trusted.name3=0xdeface
|
||||
|
||||
# file: SCRATCH_MNT/dir
|
||||
trusted.name=0xbabe
|
||||
trusted.name3=0xdeface
|
||||
user.name=0xbabe
|
||||
user.name3=0xdeface
|
||||
|
||||
# file: SCRATCH_MNT/here
|
||||
trusted.9=0x3837
|
||||
trusted.a=0x6263
|
||||
@@ -606,6 +554,18 @@ trusted.a=0x6263
|
||||
trusted.9=0x3837
|
||||
trusted.a=0x6263
|
||||
|
||||
# file: SCRATCH_MNT/lnk
|
||||
trusted.name=0xbabe
|
||||
trusted.name3=0xdeface
|
||||
|
||||
# file: SCRATCH_MNT/reg
|
||||
trusted.name=0xbabe
|
||||
trusted.name3=0xdeface
|
||||
user.name=0xbabe
|
||||
user.name3=0xdeface
|
||||
|
||||
|
||||
*** directory descent without following symlinks
|
||||
# file: SCRATCH_MNT/descend
|
||||
user.1=0x3233
|
||||
user.x=0x797a
|
||||
@@ -618,6 +578,46 @@ user.x=0x797a
|
||||
user.1=0x3233
|
||||
user.x=0x797a
|
||||
|
||||
# file: SCRATCH_MNT/dev/b
|
||||
trusted.name=0xbabe
|
||||
trusted.name3=0xdeface
|
||||
|
||||
# file: SCRATCH_MNT/dev/c
|
||||
trusted.name=0xbabe
|
||||
trusted.name3=0xdeface
|
||||
|
||||
# file: SCRATCH_MNT/dev/p
|
||||
trusted.name=0xbabe
|
||||
trusted.name3=0xdeface
|
||||
|
||||
# file: SCRATCH_MNT/dir
|
||||
trusted.name=0xbabe
|
||||
trusted.name3=0xdeface
|
||||
user.name=0xbabe
|
||||
user.name3=0xdeface
|
||||
|
||||
# file: SCRATCH_MNT/here
|
||||
trusted.9=0x3837
|
||||
trusted.a=0x6263
|
||||
|
||||
# file: SCRATCH_MNT/here/up
|
||||
trusted.9=0x3837
|
||||
trusted.a=0x6263
|
||||
|
||||
# file: SCRATCH_MNT/here/up/ascend
|
||||
trusted.9=0x3837
|
||||
trusted.a=0x6263
|
||||
|
||||
# file: SCRATCH_MNT/lnk
|
||||
trusted.name=0xbabe
|
||||
trusted.name3=0xdeface
|
||||
|
||||
# file: SCRATCH_MNT/reg
|
||||
trusted.name=0xbabe
|
||||
trusted.name3=0xdeface
|
||||
user.name=0xbabe
|
||||
user.name3=0xdeface
|
||||
|
||||
|
||||
|
||||
*** backup everything
|
||||
|
||||
@@ -176,5 +176,12 @@ _require_attrs()
|
||||
rm -f $TEST_DIR/syscalltest.out
|
||||
}
|
||||
|
||||
# getfattr -R returns info in readdir order which varies from fs to fs.
|
||||
# This sorts the output by filename
|
||||
_sort_getfattr_output()
|
||||
{
|
||||
awk '{a[FNR]=$0}END{n = asort(a); for(i=1; i <= n; i++) print a[i]"\n"}' RS=''
|
||||
}
|
||||
|
||||
# make sure this script returns success
|
||||
/bin/true
|
||||
|
||||
Reference in New Issue
Block a user