]> git.apps.os.sepia.ceph.com Git - xfstests-dev.git/commitdiff
generic: test that xattrs can have slashes in their names
authorDarrick J. Wong <darrick.wong@oracle.com>
Fri, 4 Jan 2019 23:14:48 +0000 (15:14 -0800)
committerEryu Guan <guaneryu@gmail.com>
Thu, 10 Jan 2019 11:04:45 +0000 (19:04 +0800)
Eric Sandeen recently found a bug in xfs_repair that flagged extended
attribute names containing "/" as corrupt and purged them.  There's
nothing in the IRIX or Linux manuals that say anything about slashes not
being allowed (and Linux certainly allows this) so let's make sure this
continues to work.

[Eryu: use $SETFATTR and _getfattr helper]

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Reviewed-by: Eric Sandeen <sandeen@redhat.com>
Reviewed-by: Carlos Maiolino <cmaiolino@redhat.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
tests/generic/523 [new file with mode: 0755]
tests/generic/523.out [new file with mode: 0644]
tests/generic/group

diff --git a/tests/generic/523 b/tests/generic/523
new file mode 100755 (executable)
index 0000000..ace3bab
--- /dev/null
@@ -0,0 +1,50 @@
+#! /bin/bash
+# SPDX-License-Identifier: GPL-2.0+
+# Copyright (c) 2019 Oracle, Inc.  All Rights Reserved.
+#
+# FS QA Test No. 523
+#
+# Check that xattrs can have slashes in their name.
+#
+seq=`basename $0`
+seqres=$RESULT_DIR/$seq
+echo "QA output created by $seq"
+tmp=/tmp/$$
+status=1       # failure is the default!
+trap "_cleanup; exit \$status" 0 1 2 3 15
+
+_cleanup()
+{
+       cd /
+       rm -f $tmp.*
+}
+
+# get standard environment, filters and checks
+. ./common/rc
+. ./common/attr
+. ./common/filter
+
+# real QA test starts here
+_supported_fs generic
+_supported_os Linux
+_require_scratch
+_require_attrs
+
+rm -f $seqres.full
+
+_scratch_mkfs >> $seqres.full 2>&1
+_scratch_mount
+
+echo "set attr"
+file=$SCRATCH_MNT/moofile
+touch $file
+$SETFATTR_PROG -n "user.boo/hoo" -v "woof" $file
+
+echo "check attr"
+_getfattr -d --absolute-names $file | _filter_scratch
+
+# Now we let the fsck tool check the filesystem, because xfs_repair had a
+# regression where it would flag and erase any xattr with a '/' in it.
+
+status=0
+exit
diff --git a/tests/generic/523.out b/tests/generic/523.out
new file mode 100644 (file)
index 0000000..3f2f738
--- /dev/null
@@ -0,0 +1,6 @@
+QA output created by 523
+set attr
+check attr
+# file: SCRATCH_MNT/moofile
+user.boo/hoo="woof"
+
index ea5aa7aa47af841d1b8428f5292b9805ac621f80..772e6a1d9306788f399246b5e4b7273575591930 100644 (file)
 520 auto quick log
 521 soak long_rw
 522 soak long_rw
+523 auto quick attr