xfs
[Top] [All Lists]

Re: [PATCH] xfstests: Also accept "no such attribute" errors for invalid

To: Andreas Gruenbacher <agruen@xxxxxxxxxx>
Subject: Re: [PATCH] xfstests: Also accept "no such attribute" errors for invalid extended attributes
From: Eric Sandeen <sandeen@xxxxxxxxxxx>
Date: Fri, 19 Aug 2011 09:47:32 -0500
Cc: xfs@xxxxxxxxxxx, hch@xxxxxxxxxxxxx
In-reply-to: <1313619249.18763.3.camel@xxxxxxxxxxxxx>
References: <1313619249.18763.3.camel@xxxxxxxxxxxxx>
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.6; rv:6.0) Gecko/20110812 Thunderbird/6.0
On 8/17/11 5:14 PM, Andreas Gruenbacher wrote:
> In older Linux kernels, requesting an extended attribute which cannot exist
> failed with EPERM.  In version 3.0, this was changed to ENODATA so that
> programs can distinguish between missing attributes and permission problems
> independent of the file type.
> 
> For example, lgetxattr("file", "user.name", NULL, 0) will now return ENODATA 
> if
> no such attribute exists even if "file" is a symbolic link.
> 
> In test 062, to make it work on kernels before and after 3.0, accept either of
> the two error results from getfattr.

> Signed-off-by: Andreas Gruenbacher <agruen@xxxxxxxxxx>

Reviewed-by: Eric Sandeen <sandeen@xxxxxxxxxx>

I'll merge it, thanks.

> ---
>  062     |   12 +++++++++---
>  062.out |   40 ++++++++++++++++++++--------------------
>  2 files changed, 29 insertions(+), 23 deletions(-)
> 
> diff --git a/062 b/062
> index a6e4bc8..f666e1b 100755
> --- a/062
> +++ b/062
> @@ -84,6 +84,12 @@ _scratch_mkfs > /dev/null 2>&1 || _fail "mkfs failed"
>  _scratch_mount || _fail "mount failed"
>  _create_test_bed
>  
> +# In kernels before 3.0, getxattr() fails with EPERM for an attribute which
> +# cannot exist.  Later kernels fail with ENODATA.  Accept both results.
> +invalid_attribute_filter() {
> +     sed -e "s:\(No such attribute\|Operation not permitted\):No such 
> attribute or operation not permitted:"
> +}
> +
>  if [ "$USE_ATTR_SECURE" = yes ]; then
>      ATTR_MODES="user security trusted"
>  else
> @@ -119,15 +125,15 @@ for nsp in $ATTR_MODES; do
>               
>               echo "*** set an empty value for second attribute"
>               setfattr -h -n $nsp.name2 $SCRATCH_MNT/$inode
> -             getfattr -m $nsp -n $nsp.name2 $SCRATCH_MNT/$inode
> +             getfattr -m $nsp -n $nsp.name2 $SCRATCH_MNT/$inode 2>&1 | 
> invalid_attribute_filter
>  
>               echo "*** overwrite empty value"
>               setfattr -h -n $nsp.name2 -v 0xcafe $SCRATCH_MNT/$inode
> -             getfattr -m $nsp -e hex -n $nsp.name2 $SCRATCH_MNT/$inode
> +             getfattr -m $nsp -e hex -n $nsp.name2 $SCRATCH_MNT/$inode 2>&1 
> | invalid_attribute_filter
>  
>               echo "*** remove attribute"
>               setfattr -h -x $nsp.name2 $SCRATCH_MNT/$inode
> -             getfattr -m $nsp -e hex -n $nsp.name2 $SCRATCH_MNT/$inode
> +             getfattr -m $nsp -e hex -n $nsp.name2 $SCRATCH_MNT/$inode 2>&1 
> | invalid_attribute_filter
>  
>               echo "*** final list (strings, type=$inode, nsp=$nsp)"
>               getfattr -m '.' -e hex $SCRATCH_MNT/$inode
> diff --git a/062.out b/062.out
> index 1d5a094..699254a 100644
> --- a/062.out
> +++ b/062.out
> @@ -49,7 +49,7 @@ user.name2
>  user.name2=0xcafe
>  
>  *** remove attribute
> -SCRATCH_MNT/reg: user.name2: No such attribute
> +SCRATCH_MNT/reg: user.name2: No such attribute or operation not permitted
>  *** final list (strings, type=reg, nsp=user)
>  # file: SCRATCH_MNT/reg
>  user.name=0xbabe
> @@ -96,7 +96,7 @@ user.name2
>  user.name2=0xcafe
>  
>  *** remove attribute
> -SCRATCH_MNT/dir: user.name2: No such attribute
> +SCRATCH_MNT/dir: user.name2: No such attribute or operation not permitted
>  *** final list (strings, type=dir, nsp=user)
>  # file: SCRATCH_MNT/dir
>  user.name=0xbabe
> @@ -119,13 +119,13 @@ setfattr: SCRATCH_MNT/lnk: Operation not permitted
>  setfattr: SCRATCH_MNT/lnk: Operation not permitted
>  *** set an empty value for second attribute
>  setfattr: SCRATCH_MNT/lnk: Operation not permitted
> -SCRATCH_MNT/lnk: user.name2: Operation not permitted
> +SCRATCH_MNT/lnk: user.name2: No such attribute or operation not permitted
>  *** overwrite empty value
>  setfattr: SCRATCH_MNT/lnk: Operation not permitted
> -SCRATCH_MNT/lnk: user.name2: Operation not permitted
> +SCRATCH_MNT/lnk: user.name2: No such attribute or operation not permitted
>  *** remove attribute
>  setfattr: SCRATCH_MNT/lnk: Operation not permitted
> -SCRATCH_MNT/lnk: user.name2: Operation not permitted
> +SCRATCH_MNT/lnk: user.name2: No such attribute or operation not permitted
>  *** final list (strings, type=lnk, nsp=user)
>  
>  === TYPE dev/b; NAMESPACE user
> @@ -144,13 +144,13 @@ setfattr: SCRATCH_MNT/dev/b: Operation not permitted
>  setfattr: SCRATCH_MNT/dev/b: Operation not permitted
>  *** set an empty value for second attribute
>  setfattr: SCRATCH_MNT/dev/b: Operation not permitted
> -SCRATCH_MNT/dev/b: user.name2: Operation not permitted
> +SCRATCH_MNT/dev/b: user.name2: No such attribute or operation not permitted
>  *** overwrite empty value
>  setfattr: SCRATCH_MNT/dev/b: Operation not permitted
> -SCRATCH_MNT/dev/b: user.name2: Operation not permitted
> +SCRATCH_MNT/dev/b: user.name2: No such attribute or operation not permitted
>  *** remove attribute
>  setfattr: SCRATCH_MNT/dev/b: Operation not permitted
> -SCRATCH_MNT/dev/b: user.name2: Operation not permitted
> +SCRATCH_MNT/dev/b: user.name2: No such attribute or operation not permitted
>  *** final list (strings, type=dev/b, nsp=user)
>  
>  === TYPE dev/c; NAMESPACE user
> @@ -169,13 +169,13 @@ setfattr: SCRATCH_MNT/dev/c: Operation not permitted
>  setfattr: SCRATCH_MNT/dev/c: Operation not permitted
>  *** set an empty value for second attribute
>  setfattr: SCRATCH_MNT/dev/c: Operation not permitted
> -SCRATCH_MNT/dev/c: user.name2: Operation not permitted
> +SCRATCH_MNT/dev/c: user.name2: No such attribute or operation not permitted
>  *** overwrite empty value
>  setfattr: SCRATCH_MNT/dev/c: Operation not permitted
> -SCRATCH_MNT/dev/c: user.name2: Operation not permitted
> +SCRATCH_MNT/dev/c: user.name2: No such attribute or operation not permitted
>  *** remove attribute
>  setfattr: SCRATCH_MNT/dev/c: Operation not permitted
> -SCRATCH_MNT/dev/c: user.name2: Operation not permitted
> +SCRATCH_MNT/dev/c: user.name2: No such attribute or operation not permitted
>  *** final list (strings, type=dev/c, nsp=user)
>  
>  === TYPE dev/p; NAMESPACE user
> @@ -194,13 +194,13 @@ setfattr: SCRATCH_MNT/dev/p: Operation not permitted
>  setfattr: SCRATCH_MNT/dev/p: Operation not permitted
>  *** set an empty value for second attribute
>  setfattr: SCRATCH_MNT/dev/p: Operation not permitted
> -SCRATCH_MNT/dev/p: user.name2: Operation not permitted
> +SCRATCH_MNT/dev/p: user.name2: No such attribute or operation not permitted
>  *** overwrite empty value
>  setfattr: SCRATCH_MNT/dev/p: Operation not permitted
> -SCRATCH_MNT/dev/p: user.name2: Operation not permitted
> +SCRATCH_MNT/dev/p: user.name2: No such attribute or operation not permitted
>  *** remove attribute
>  setfattr: SCRATCH_MNT/dev/p: Operation not permitted
> -SCRATCH_MNT/dev/p: user.name2: Operation not permitted
> +SCRATCH_MNT/dev/p: user.name2: No such attribute or operation not permitted
>  *** final list (strings, type=dev/p, nsp=user)
>  
>  === TYPE reg; NAMESPACE trusted
> @@ -243,7 +243,7 @@ trusted.name2
>  trusted.name2=0xcafe
>  
>  *** remove attribute
> -SCRATCH_MNT/reg: trusted.name2: No such attribute
> +SCRATCH_MNT/reg: trusted.name2: No such attribute or operation not permitted
>  *** final list (strings, type=reg, nsp=trusted)
>  # file: SCRATCH_MNT/reg
>  trusted.name=0xbabe
> @@ -292,7 +292,7 @@ trusted.name2
>  trusted.name2=0xcafe
>  
>  *** remove attribute
> -SCRATCH_MNT/dir: trusted.name2: No such attribute
> +SCRATCH_MNT/dir: trusted.name2: No such attribute or operation not permitted
>  *** final list (strings, type=dir, nsp=trusted)
>  # file: SCRATCH_MNT/dir
>  trusted.name=0xbabe
> @@ -341,7 +341,7 @@ trusted.name2
>  trusted.name2=0xcafe
>  
>  *** remove attribute
> -SCRATCH_MNT/lnk: trusted.name2: No such attribute
> +SCRATCH_MNT/lnk: trusted.name2: No such attribute or operation not permitted
>  *** final list (strings, type=lnk, nsp=trusted)
>  # file: SCRATCH_MNT/lnk
>  trusted.name=0xbabe
> @@ -388,7 +388,7 @@ trusted.name2
>  trusted.name2=0xcafe
>  
>  *** remove attribute
> -SCRATCH_MNT/dev/b: trusted.name2: No such attribute
> +SCRATCH_MNT/dev/b: trusted.name2: No such attribute or operation not 
> permitted
>  *** final list (strings, type=dev/b, nsp=trusted)
>  # file: SCRATCH_MNT/dev/b
>  trusted.name=0xbabe
> @@ -435,7 +435,7 @@ trusted.name2
>  trusted.name2=0xcafe
>  
>  *** remove attribute
> -SCRATCH_MNT/dev/c: trusted.name2: No such attribute
> +SCRATCH_MNT/dev/c: trusted.name2: No such attribute or operation not 
> permitted
>  *** final list (strings, type=dev/c, nsp=trusted)
>  # file: SCRATCH_MNT/dev/c
>  trusted.name=0xbabe
> @@ -482,7 +482,7 @@ trusted.name2
>  trusted.name2=0xcafe
>  
>  *** remove attribute
> -SCRATCH_MNT/dev/p: trusted.name2: No such attribute
> +SCRATCH_MNT/dev/p: trusted.name2: No such attribute or operation not 
> permitted
>  *** final list (strings, type=dev/p, nsp=trusted)
>  # file: SCRATCH_MNT/dev/p
>  trusted.name=0xbabe

<Prev in Thread] Current Thread [Next in Thread>