From e7dadd09ae156398b68a96de34a9f08d1cc2b666 Mon Sep 17 00:00:00 2001 From: Auke Kok Date: Wed, 5 Jul 2023 14:58:52 -0400 Subject: [PATCH] New versions of getfattr will quote empty attr values. Instead of messing with quotes and using grep for the correct xattr name, directly query the value of the xattr being tested only, and compare that to the input. Side effect is that this is significantly simpler and faster. Signed-off-by: Auke Kok --- tests/tests/simple-xattr-unit.sh | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/tests/tests/simple-xattr-unit.sh b/tests/tests/simple-xattr-unit.sh index 31cc5878..b761f708 100644 --- a/tests/tests/simple-xattr-unit.sh +++ b/tests/tests/simple-xattr-unit.sh @@ -27,15 +27,9 @@ test_xattr_lengths() { echo "key len $name_len val len $val_len" >> "$T_TMP.log" setfattr -n $name -v \"$val\" "$FILE" - # grep has trouble with enormous args? so we dump the - # name=value to a file and compare with a known good file - getfattr -d --absolute-names "$FILE" | grep "$name" > "$T_TMP.got" + getfattr -d --only-values --absolute-names "$FILE" -n "$name" > "$T_TMP.got" + echo -n "$val" > "$T_TMP.good" - if [ $val_len == 0 ]; then - echo "$name" > "$T_TMP.good" - else - echo "$name=\"$val\"" > "$T_TMP.good" - fi cmp "$T_TMP.good" "$T_TMP.got" || \ t_fail "cmp failed name len $name_len val len $val_len"