generic/062: filter redundant output by getfattr
PATCH 1/1 generic/062: filter redundant output by getfattr
When getfattr dumps values of all extended attributes (-d option), it doesn't print empty extended attributes. e.g: user.name. But from attr-2.4.48 this behavior is changed, new getfattr prints user.name="".
The {=""} will break the golden image, so filter the redundant ="" at the end if it has.
---
Hi,
This's a bad news. Latest attr package attr-2.4.48 changed his behavior as above. And this's different with attr-2.4.47.
With old attr:
# setfattr -h -n user.name testfile # getfattr -d -n user.name testfile # file: testfile user.name
With new attr:
# setfattr -h -n user.name testfile # getfattr -d -n user.name testfile # file: testfile user.name=""
Note: -d option is necessary
This little difference will break golden image. So this's the problem. If you have better idea than this patch, please tell me.
Thanks,
Zorro
tests/generic/062 | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
tests/generic/062 +5 -1
@@ -29,9 +29,13 @@ _cleanup() } trap "_cleanup; exit \$status" 0 1 2 3 15 +# When getfattr dump values of all extended attributes, it print empty attr +# as user.name before, but new getfattr print it as user.name="". For match +# the golden image, filter the redundant ="" at the end. getfattr() { - $GETFATTR_PROG --absolute-names -dh $@ 2>&1 | _filter_scratch + $GETFATTR_PROG --absolute-names -dh $@ 2>&1 | _filter_scratch | \ + sed -e 's/=\"\"//' } setfattr()
Signature · 1 line
2.14.4
Quoted 47 lines · Zorro Lang
When getfattr dumps values of all extended attributes (-d option), it doesn't print empty extended attributes. e.g: user.name. But from attr-2.4.48 this behavior is changed, new getfattr prints user.name="".
The {=""} will break the golden image, so filter the redundant ="" at the end if it has.
Signed-off-by Zorro Lang <[email protected]>---
Hi,
This's a bad news. Latest attr package attr-2.4.48 changed his behavior as above. And this's different with attr-2.4.47.
With old attr:
# setfattr -h -n user.name testfile # getfattr -d -n user.name testfile # file: testfile user.nameWith new attr:
# setfattr -h -n user.name testfile # getfattr -d -n user.name testfile # file: testfile user.name=""Note: -d option is necessary
This little difference will break golden image. So this's the problem. If you have better idea than this patch, please tell me.
Thanks,
Zorrotests/generic/062 | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)tests/generic/062 +0
-0@@ -29,9 +29,13 @@ _cleanup() } trap "_cleanup; exit \$status" 0 1 2 3 15
tests/generic/062 _cleanup() · line 39
Quoted 10 lines
tests/generic/062 +5
-1+# When getfattr dump values of all extended attributes, it print empty attr +# as user.name before, but new getfattr print it as user.name="". For match +# the golden image, filter the redundant ="" at the end. getfattr() { - $GETFATTR_PROG --absolute-names -dh $@ 2>&1 | _filter_scratch + $GETFATTR_PROG --absolute-names -dh $@ 2>&1 | _filter_scratch | \ + sed -e 's/=\"\"//' }
This should really be done by a new helper function that hides all the details, so future tests could just take use of the helper.
Thanks,
Eryu
Quoted 9 lines
tests/generic/062 +0
-0setfattr()Signature · 6 lines
2.14.4 -- To unsubscribe from this list: send the line "unsubscribe fstests" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Quoted 49 lines · Eryu Guan
Quoted 48 lines · Zorro Lang
When getfattr dumps values of all extended attributes (-d option), it doesn't print empty extended attributes. e.g: user.name. But from attr-2.4.48 this behavior is changed, new getfattr prints user.name="".
The {=""} will break the golden image, so filter the redundant ="" at the end if it has.
Signed-off-by Zorro Lang <[email protected]>---
Hi,
This's a bad news. Latest attr package attr-2.4.48 changed his behavior as above. And this's different with attr-2.4.47.
With old attr:
# setfattr -h -n user.name testfile # getfattr -d -n user.name testfile # file: testfile user.nameWith new attr:
# setfattr -h -n user.name testfile # getfattr -d -n user.name testfile # file: testfile user.name=""Note: -d option is necessary
This little difference will break golden image. So this's the problem. If you have better idea than this patch, please tell me.
Thanks,
Zorrotests/generic/062 | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)tests/generic/062 +0
-0@@ -29,9 +29,13 @@ _cleanup() } trap "_cleanup; exit \$status" 0 1 2 3 15
Quoted 12 lines
tests/generic/062 _cleanup() · line 39
Quoted 9 lines
tests/generic/062 +5
-1+# When getfattr dump values of all extended attributes, it print empty attr +# as user.name before, but new getfattr print it as user.name="". For match +# the golden image, filter the redundant ="" at the end. getfattr() { - $GETFATTR_PROG --absolute-names -dh $@ 2>&1 | _filter_scratch + $GETFATTR_PROG --absolute-names -dh $@ 2>&1 | _filter_scratch | \ + sed -e 's/=\"\"//' }This should really be done by a new helper function that hides all the details, so future tests could just take use of the helper.
OK. So how about a common function named _getfattr in common/attr, to instead of all $GETFATTR_PROG (or just g/062).
Or a a common function named _filter_getfattr, to filter some $GETFATTR_PROG output if a case need it.
_getfattr()
{
$GETFATTR_PROG $@ 2>&1 | _filter_testdir_and_scratch | \
sed -e 's/=\"\"//'
}Or
_filter_getfattr()
{
_filter_testdir_and_scratch | sed -e 's/=\"\"//'
}Thanks,
Zorro
Quoted 17 lines
Thanks,
EryuQuoted 9 lines
tests/generic/062 +0
-0setfattr()Signature · 6 lines
2.14.4 -- To unsubscribe from this list: send the line "unsubscribe fstests" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html--
To unsubscribe from this list: send the line "unsubscribe fstests" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Quoted 63 lines · Zorro Lang
Quoted 49 lines · Eryu Guan
Quoted 48 lines · Zorro Lang
When getfattr dumps values of all extended attributes (-d option), it doesn't print empty extended attributes. e.g: user.name. But from attr-2.4.48 this behavior is changed, new getfattr prints user.name="".
The {=""} will break the golden image, so filter the redundant ="" at the end if it has.
Signed-off-by Zorro Lang <[email protected]>---
Hi,
This's a bad news. Latest attr package attr-2.4.48 changed his behavior as above. And this's different with attr-2.4.47.
With old attr:
# setfattr -h -n user.name testfile # getfattr -d -n user.name testfile # file: testfile user.nameWith new attr:
# setfattr -h -n user.name testfile # getfattr -d -n user.name testfile # file: testfile user.name=""Note: -d option is necessary
This little difference will break golden image. So this's the problem. If you have better idea than this patch, please tell me.
Thanks,
Zorrotests/generic/062 | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)tests/generic/062 +0
-0@@ -29,9 +29,13 @@ _cleanup() } trap "_cleanup; exit \$status" 0 1 2 3 15Quoted 12 lines
tests/generic/062 _cleanup() · line 39
Quoted 9 lines
tests/generic/062 +5
-1+# When getfattr dump values of all extended attributes, it print empty attr +# as user.name before, but new getfattr print it as user.name="". For match +# the golden image, filter the redundant ="" at the end. getfattr() { - $GETFATTR_PROG --absolute-names -dh $@ 2>&1 | _filter_scratch + $GETFATTR_PROG --absolute-names -dh $@ 2>&1 | _filter_scratch | \ + sed -e 's/=\"\"//' }This should really be done by a new helper function that hides all the details, so future tests could just take use of the helper.
Quoted 2 lines
OK. So how about a common function named
_getfattrin common/attr, to instead of all $GETFATTR_PROG (or just g/062).
_getfattr() is fine, converting all existing bare getfattr calls would be good.
Thanks!
Eryu
Quoted 37 lines
Or a a common function named
_filter_getfattr, to filter some $GETFATTR_PROG output if a case need it.
_getfattr(){ $GETFATTR_PROG $@ 2>&1 | _filter_testdir_and_scratch | \ sed -e 's/=\"\"//' }Or
_filter_getfattr(){ _filter_testdir_and_scratch | sed -e 's/=\"\"//' }Thanks,
ZorroQuoted 17 lines
Thanks,
EryuQuoted 9 lines
tests/generic/062 +0
-0setfattr()Signature · 6 lines
2.14.4 -- To unsubscribe from this list: send the line "unsubscribe fstests" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html--
To unsubscribe from this list: send the line "unsubscribe fstests" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html