]> git.apps.os.sepia.ceph.com Git - xfstests-dev.git/commit
xfs/018: fix attr value setting in this test
authorDarrick J. Wong <djwong@kernel.org>
Tue, 13 Dec 2022 19:45:06 +0000 (11:45 -0800)
committerZorro Lang <zlang@kernel.org>
Wed, 14 Dec 2022 14:54:04 +0000 (22:54 +0800)
commita8a3cd342f9054184bb9faf07fb9b87df112b8b2
tree16e57b4f326d3955dc8f5d5881a322a507d3a70c
parent8a1c35e615fdf34021452f84c8a67ca8b2673256
xfs/018: fix attr value setting in this test

I was testing a patch to strengthen the buffer length validation of attr
log intent items during log recovery, when I noticed that the lengths of
the logged values were (mostly) a single byte larger than the alleged
attribute value.  Upon further investigation, I noticed this code in the
test:

echo "$attr_value" | attr -s <attrname> <testfile>

The 'echo' command generally emits a newline before exiting, which
means that the 16-byte "attr16" value was actually storing 17 bytes.
This affects all the test cases except for the attr64k tests, since the
attr(1) command helpfully/silently truncates the value buffer at 65536
bytes.

Fix the test to store values of exactly the length we want, and add a
couple more test cases to check that everything still works when the
value length is not an exact multiple of sizeof(u32).

Signed-off-by: Darrick J. Wong <djwong@kernel.org>
Reviewed-by: Zorro Lang <zlang@redhat.com>
Signed-off-by: Zorro Lang <zlang@kernel.org>
tests/xfs/018
tests/xfs/018.out