Merge of xfs-cmds-2.4.18:slinx:111985a by nathans.

getfattr/setfattr fixes
This commit is contained in:
fsgqa
2002-02-25 22:33:42 +00:00
parent 76d13e50a6
commit 54a448db29
8 changed files with 68 additions and 62 deletions
+12 -5
View File
@@ -81,7 +81,7 @@ _attr_list()
file=$1 file=$1
echo " *** print attributes" echo " *** print attributes"
if ! _getfattr -ad $file >$tmp.raw if ! _getfattr -ad $file
then then
echo " !!! error return" echo " !!! error return"
return 1 return 1
@@ -93,6 +93,8 @@ _attr_list()
# real QA test starts here # real QA test starts here
rm -f $seq.full
testfile=$TEST_DIR/attribute_$$ testfile=$TEST_DIR/attribute_$$
echo "*** list non-existant file" echo "*** list non-existant file"
@@ -128,7 +130,7 @@ echo "*** add lots of attributes"
v=0 v=0
while [ $v -lt 1000 ] while [ $v -lt 1000 ]
do do
echo "value_$v" | attr -s "attribute_$v" $testfile >/dev/null echo "value_$v" | attr -s "attribute_$v" $testfile >>$seq.full
if [ $? -ne 0 ] if [ $? -ne 0 ]
then then
echo "!!! failed to add \"attribute_$v\"" echo "!!! failed to add \"attribute_$v\""
@@ -140,14 +142,19 @@ done
echo "*** check" echo "*** check"
# don't print it all out... # don't print it all out...
getfattr $testfile \ getfattr -a $testfile \
| $AWK_PROG '{ l++ } END {print " *** " (l - 1) " attribute(s)" }' | tee -a $seq.full \
| $AWK_PROG '
/^#/ { next }
/^[ ]*$/ { next }
{ l++ }
END {print " *** " (l - 1) " attribute(s)" }'
echo "*** remove lots of attributes" echo "*** remove lots of attributes"
v=0 v=0
while [ $v -lt 1000 ] while [ $v -lt 1000 ]
do do
if ! attr -r "attribute_$v" $testfile >/dev/null if ! attr -r "attribute_$v" $testfile >>$seq.full
then then
echo "!!! failed to remove \"attribute_$v\"" echo "!!! failed to remove \"attribute_$v\""
exit 1 exit 1
+24 -37
View File
@@ -1,17 +1,12 @@
QA output created by 020 QA output created by 020
*** list non-existant file *** list non-existant file
*** print attributes *** print attributes
attr_list: No such file or directory getfattr: <TESTFILE>: No such file or directory
Could not list attributes for <TESTFILE>
!!! error return !!! error return
*** list non-xfs file (in /proc) *** list non-xfs file (in /proc)
*** print attributes *** print attributes
attr_list: Operation not supported
Could not list attributes for <PROCFILE>
!!! error return
*** list empty file *** list empty file
*** print attributes *** print attributes
*** 0 attribute(s)
*** query non-existant attribute *** query non-existant attribute
attr_get: No data available attr_get: No data available
Could not get "nonexistant" for <TESTFILE> Could not get "nonexistant" for <TESTFILE>
@@ -20,62 +15,54 @@ Attribute "fish" set to a 5 byte value for <TESTFILE>:
fish fish
*** print attributes *** print attributes
*** 1 attribute(s) # file: <TESTFILE>
*** field: fish length: 5 user.fish="fish\012"
::: fish
:::
*** replace attribute *** replace attribute
Attribute "fish" set to a 6 byte value for <TESTFILE>: Attribute "fish" set to a 6 byte value for <TESTFILE>:
fish3 fish3
*** print attributes *** print attributes
*** 1 attribute(s) # file: <TESTFILE>
*** field: fish length: 6 user.fish="fish3\012"
::: fish3
:::
*** add attribute *** add attribute
Attribute "snrub" set to a 6 byte value for <TESTFILE>: Attribute "snrub" set to a 6 byte value for <TESTFILE>:
fish2 fish2
*** print attributes *** print attributes
*** 2 attribute(s) # file: <TESTFILE>
*** field: fish length: 6 user.fish="fish3\012"
::: fish3 user.snrub="fish2\012"
:::
*** field: snrub length: 6
::: fish2
:::
*** remove attribute *** remove attribute
*** print attributes *** print attributes
*** 1 attribute(s) # file: <TESTFILE>
*** field: snrub length: 6 user.snrub="fish2\012"
::: fish2
:::
*** add lots of attributes *** add lots of attributes
*** check *** check
*** 1001 attribute(s) *** 1000 attribute(s)
*** remove lots of attributes *** remove lots of attributes
*** print attributes *** print attributes
*** 1 attribute(s) # file: <TESTFILE>
*** field: snrub length: 6 user.snrub="fish2\012"
::: fish2
:::
*** really long value *** really long value
0000000 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0000000 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
* *
0200000 0a 0200000 0a
0200001 0200001
*** set/get/remove really long names (expect failure) *** set/get/remove really long names (expect failure)
attr_set: Bad address attr_set: Invalid argument
Could not set "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX" for <TESTFILE> Could not set "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX" for <TESTFILE>
attr_get: Bad address attr_get: Invalid argument
Could not get "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX" for <TESTFILE> Could not get "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX" for <TESTFILE>
attr_remove: Bad address attr_remove: Invalid argument
Could not remove "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX" for <TESTFILE> Could not remove "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX" for <TESTFILE>
*** check final *** check final
*** print attributes *** print attributes
*** 1 attribute(s) # file: <TESTFILE>
*** field: snrub length: 6 user.snrub="fish2\012"
::: fish2
:::
*** delete *** delete
+10 -3
View File
@@ -111,11 +111,19 @@ echo "*** make test file 2"
touch $testfile.2 touch $testfile.2
echo "value_1" | _attr -s "a1" $testfile.2 >/dev/null echo "value_1" | _attr -s "a1" $testfile.2 >/dev/null
echo "value_2" | _attr -s "a2-----" $testfile.2 >/dev/null echo "value_2" | _attr -s "a2-----" $testfile.2 >/dev/null
(echo start ; dd if=/dev/zero bs=65525 count=1 ; echo end ) \ (echo start ; dd if=/dev/zero bs=65525 count=1 ; echo end ) \
| _attr -s "a3" $testfile.2 >/dev/null | _attr -s "a3" $testfile.2 >/dev/null
_getfattr -a $testfile.2 _getfattr -a $testfile.2
# print name and size from 1st line of output
_attr -g "a3" $testfile.2 | head -1
# print out the rest of the data apart from the header
# the size is +1 for an extra \n at the end
echo -n "size of attr value = "
_attr -g "a3" $testfile.2 | tail -3 | wc -c
echo ""
inum_2=`ls -li $testfile.2 | $AWK_PROG '{ print $1 }'` inum_2=`ls -li $testfile.2 | $AWK_PROG '{ print $1 }'`
echo "*** unmount FS" echo "*** unmount FS"
@@ -131,5 +139,4 @@ echo "*** dump attributes (2)"
xfs_db -r -c "inode $inum_2" -c "a a.bmx[0].startblock" -c "print" $SCRATCH_DEV xfs_db -r -c "inode $inum_2" -c "a a.bmx[0].startblock" -c "print" $SCRATCH_DEV
echo "*** done" echo "*** done"
rm $seq.full
exit exit
+12 -5
View File
@@ -2,14 +2,21 @@ QA output created by 021
*** mkfs *** mkfs
*** mount FS *** mount FS
*** make test file 1 *** make test file 1
Attribute "a1" has a 3 byte value for <TESTFILE>.1 # file: <TESTFILE>.1
Attribute "a2--" has a 5 byte value for <TESTFILE>.1 user.a1
user.a2--
*** make test file 2 *** make test file 2
1+0 records in 1+0 records in
1+0 records out 1+0 records out
Attribute "a1" has a 8 byte value for <TESTFILE>.2 # file: <TESTFILE>.2
Attribute "a3" has a 65535 byte value for <TESTFILE>.2 user.a1
Attribute "a2-----" has a 8 byte value for <TESTFILE>.2 user.a2-----
user.a3
Attribute "a3" had a 65535 byte value for <TESTFILE>.2:
size of attr value = 65536
*** unmount FS *** unmount FS
*** dump attributes (1) *** dump attributes (1)
a.sfattr.hdr.totsize = 24 a.sfattr.hdr.totsize = 24
+4 -4
View File
@@ -7,9 +7,9 @@ $SCRATCH_MNT/test.1 [u::r-x,g::---,o::---]
$SCRATCH_MNT/test.2 [u::---,g::r-x,o::---] $SCRATCH_MNT/test.2 [u::---,g::r-x,o::---]
$SCRATCH_MNT/test.3 [u::---,g::---,o::r-x] $SCRATCH_MNT/test.3 [u::---,g::---,o::r-x]
$SCRATCH_MNT/test.4 [u::---,g::r-x,o::rwx] $SCRATCH_MNT/test.4 [u::---,g::r-x,o::rwx]
$SCRATCH_MNT/test.5 [u::---,g::---,o::---,u:id2:r-x,m::rwx] $SCRATCH_MNT/test.5 [u::---,u:id2:r-x,g::---,m::rwx,o::---]
$SCRATCH_MNT/test.6 [u::rwx,g::r-x,o::r--] $SCRATCH_MNT/test.6 [u::rwx,g::r-x,o::r--]
$SCRATCH_MNT/test.7 [u::---,g::---,o::---,g:id2:r-x,m::-w-] $SCRATCH_MNT/test.7 [u::---,g::---,g:id2:r-x,m::-w-,o::---]
unmount $SCRATCH_DEV... done unmount $SCRATCH_DEV... done
repair filesystem... done repair filesystem... done
mount filesytem... done mount filesytem... done
@@ -19,6 +19,6 @@ $SCRATCH_MNT/test.1 [u::r-x,g::---,o::---]
$SCRATCH_MNT/test.2 [u::---,g::r-x,o::---] $SCRATCH_MNT/test.2 [u::---,g::r-x,o::---]
$SCRATCH_MNT/test.3 [u::---,g::---,o::r-x] $SCRATCH_MNT/test.3 [u::---,g::---,o::r-x]
$SCRATCH_MNT/test.4 [u::---,g::r-x,o::rwx] $SCRATCH_MNT/test.4 [u::---,g::r-x,o::rwx]
$SCRATCH_MNT/test.5 [u::---,g::---,o::---,u:id2:r-x,m::rwx] $SCRATCH_MNT/test.5 [u::---,u:id2:r-x,g::---,m::rwx,o::---]
$SCRATCH_MNT/test.6 [u::rwx,g::r-x,o::r--] $SCRATCH_MNT/test.6 [u::rwx,g::r-x,o::r--]
$SCRATCH_MNT/test.7 [u::---,g::---,o::---,g:id2:r-x,m::-w-] $SCRATCH_MNT/test.7 [u::---,g::---,g:id2:r-x,m::-w-,o::---]
+2
View File
@@ -98,6 +98,8 @@ _acl_on()
} }
# real QA test starts here # real QA test starts here
_notrun "irix get semantics no longer required"
rm -f $seq.full rm -f $seq.full
_need_to_be_root _need_to_be_root
+2 -2
View File
@@ -155,8 +155,8 @@ _extend_test_bed()
mkdir -p $SCRATCH_MNT/descend/down/here mkdir -p $SCRATCH_MNT/descend/down/here
find $SCRATCH_MNT/descend | xargs setfattr -n user.x -v yz find $SCRATCH_MNT/descend | xargs setfattr -n user.x -v yz
find $SCRATCH_MNT/descend | xargs setfattr -n user.1 -v 23 find $SCRATCH_MNT/descend | xargs setfattr -n user.1 -v 23
find $SCRATCH_MNT/here | xargs setfattr -n root.a -v bc find $SCRATCH_MNT/here | xargs setfattr -n xfsroot.a -v bc
find $SCRATCH_MNT/here | xargs setfattr -n root.9 -v 87 find $SCRATCH_MNT/here | xargs setfattr -n xfsroot.9 -v 87
# whack a symlink in the middle, just to be difficult # whack a symlink in the middle, just to be difficult
ln -s $SCRATCH_MNT/here/up $SCRATCH_MNT/descend/and ln -s $SCRATCH_MNT/here/up $SCRATCH_MNT/descend/and
# dump out our new starting point # dump out our new starting point
+2 -6
View File
@@ -587,8 +587,6 @@ SCRATCH_MNT/dev/p: xfsroot.name2: No such attribute
# file: SCRATCH_MNT/dev/p # file: SCRATCH_MNT/dev/p
user.name="\272\276" user.name="\272\276"
user.name3="\336\372\316" user.name3="\336\372\316"
# file: SCRATCH_MNT/dev/p
xfsroot.name="\272\276" xfsroot.name="\272\276"
xfsroot.name3="\336\372\316" xfsroot.name3="\336\372\316"
@@ -735,8 +733,8 @@ user.1=0x3233
user.x=0x797a user.x=0x797a
# file: SCRATCH_MNT/descend/and/ascend # file: SCRATCH_MNT/descend/and/ascend
root.9=0x3837 xfsroot.9=0x3837
root.a=0x6263 xfsroot.a=0x6263
# file: SCRATCH_MNT/descend # file: SCRATCH_MNT/descend
user.1=0x3233 user.1=0x3233
@@ -771,8 +769,6 @@ xfsroot.name3=0xdeface
# file: SCRATCH_MNT/dev/p # file: SCRATCH_MNT/dev/p
user.name=0xbabe user.name=0xbabe
user.name3=0xdeface user.name3=0xdeface
# file: SCRATCH_MNT/dev/p
xfsroot.name=0xbabe xfsroot.name=0xbabe
xfsroot.name3=0xdeface xfsroot.name3=0xdeface