diff mbox series

[v2,3/3] generic/020: fix unaligned MAX_ATTRVAL_SIZE output filter

Message ID 20220412105001.14325-4-ddiss@suse.de (mailing list archive)
State New, archived
Headers show
Series : generic/020: fix MAX_ATTRVAL_SIZE values | expand

Commit Message

David Disseldorp April 12, 2022, 10:50 a.m. UTC
The current attr -g "$max_attrval_name" output filter is broken if
MAX_ATTRVAL_SIZE isn't 16-byte aligned, due to od's duplicate
suppression behaviour.
Fix it by having od only dump one byte per line.

Signed-off-by: David Disseldorp <ddiss@suse.de>
---
 tests/generic/020     | 2 +-
 tests/generic/020.out | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

Comments

Dave Chinner April 13, 2022, 12:32 a.m. UTC | #1
On Tue, Apr 12, 2022 at 12:50:01PM +0200, David Disseldorp wrote:
> The current attr -g "$max_attrval_name" output filter is broken if
> MAX_ATTRVAL_SIZE isn't 16-byte aligned, due to od's duplicate
> suppression behaviour.
> Fix it by having od only dump one byte per line.
> 
> Signed-off-by: David Disseldorp <ddiss@suse.de>
> ---
>  tests/generic/020     | 2 +-
>  tests/generic/020.out | 2 +-
>  2 files changed, 2 insertions(+), 2 deletions(-)

looks good.

Reviewed-by: Dave Chinner <dchinner@redhat.com>
diff mbox series

Patch

diff --git a/tests/generic/020 b/tests/generic/020
index 34861401..d1913953 100755
--- a/tests/generic/020
+++ b/tests/generic/020
@@ -134,7 +134,7 @@  dd if=/dev/zero bs=1 count=$MAX_ATTRVAL_SIZE 2>/dev/null \
     | _attr -s "$max_attrval_name" $testfile >/dev/null
 
 OCTAL_SIZE=`echo "obase=8; $MAX_ATTRVAL_SIZE" | bc`
-_attr -q -g "$max_attrval_name" $testfile | od -t x1 \
+_attr -q -g "$max_attrval_name" $testfile | od -w1 -t x1 \
     | sed -e "s/^0*$OCTAL_SIZE$/ATTRSIZE/"
 _attr -r "$max_attrval_name" $testfile >/dev/null
 
diff --git a/tests/generic/020.out b/tests/generic/020.out
index 7e3e65bd..0dc5e09f 100644
--- a/tests/generic/020.out
+++ b/tests/generic/020.out
@@ -47,7 +47,7 @@  user.snrub="fish2\012"
 user.snrub="fish2\012"
 
 *** really long value
-0000000 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+0000000 00
 *
 ATTRSIZE
 *** set/get/remove really long names (expect failure)