diff mbox series

generic/020: fix another really long attr test failure for ceph

Message ID 20230319062928.278235-1-xiubli@redhat.com
State New
Headers show
Series generic/020: fix another really long attr test failure for ceph | expand

Commit Message

Xiubo Li March 19, 2023, 6:29 a.m. UTC
From: Xiubo Li <xiubli@redhat.com>

If the CONFIG_CEPH_FS_SECURITY_LABEL is disabled the kernel ceph
the 'selinux_size' will be empty and then:
max_attrval_size=$((65536 - $size - $selinux_size - $max_attrval_namelen))
will be:
max_attrval_size=$((65536 - $size - - $max_attrval_namelen))
which equals to:
max_attrval_size=$((65536 - $size + $max_attrval_namelen))

Signed-off-by: Xiubo Li <xiubli@redhat.com>
---
 tests/generic/020 | 6 ++++++
 1 file changed, 6 insertions(+)

Comments

Zorro Lang March 21, 2023, 2:26 p.m. UTC | #1
On Sun, Mar 19, 2023 at 02:29:27PM +0800, xiubli@redhat.com wrote:
> From: Xiubo Li <xiubli@redhat.com>
> 
> If the CONFIG_CEPH_FS_SECURITY_LABEL is disabled the kernel ceph
> the 'selinux_size' will be empty and then:
> max_attrval_size=$((65536 - $size - $selinux_size - $max_attrval_namelen))
> will be:
> max_attrval_size=$((65536 - $size - - $max_attrval_namelen))
> which equals to:
> max_attrval_size=$((65536 - $size + $max_attrval_namelen))
> 
> Signed-off-by: Xiubo Li <xiubli@redhat.com>
> ---

Makes sense to me,
Reviewed-by: Zorro Lang <zlang@redhat.com>

>  tests/generic/020 | 6 ++++++
>  1 file changed, 6 insertions(+)
> 
> diff --git a/tests/generic/020 b/tests/generic/020
> index 538a24c6..e00365a9 100755
> --- a/tests/generic/020
> +++ b/tests/generic/020
> @@ -154,6 +154,12 @@ _attr_get_maxval_size()
>  			awk -F "=0x" '/^user/ {len += length($1) + length($2) / 2} END {print len}')
>  		local selinux_size=$(getfattr -n 'security.selinux' --dump -e hex $filename 2>/dev/null | \
>  			awk -F "=0x" '/^security/ {len += length($1) + length($2) / 2} END {print len}')
> +		if [ -z $size ]; then
> +			size=0
> +		fi
> +		if [ -z $selinux_size ]; then
> +			selinux_size=0
> +		fi
>  		max_attrval_size=$((65536 - $size - $selinux_size - $max_attrval_namelen))
>  		;;
>  	*)
> -- 
> 2.31.1
>
diff mbox series

Patch

diff --git a/tests/generic/020 b/tests/generic/020
index 538a24c6..e00365a9 100755
--- a/tests/generic/020
+++ b/tests/generic/020
@@ -154,6 +154,12 @@  _attr_get_maxval_size()
 			awk -F "=0x" '/^user/ {len += length($1) + length($2) / 2} END {print len}')
 		local selinux_size=$(getfattr -n 'security.selinux' --dump -e hex $filename 2>/dev/null | \
 			awk -F "=0x" '/^security/ {len += length($1) + length($2) / 2} END {print len}')
+		if [ -z $size ]; then
+			size=0
+		fi
+		if [ -z $selinux_size ]; then
+			selinux_size=0
+		fi
 		max_attrval_size=$((65536 - $size - $selinux_size - $max_attrval_namelen))
 		;;
 	*)