Re: [PATCH] xfs/227: fix bad variable expansion

"Darrick J. Wong" <[email protected]>
Newsgroups org.kernel.vger.fstests
Message-ID <20260422155751.GF7739@frogsfrogsfrogs>
On Sat, Apr 18, 2026 at 02:08:39AM +0800, Zorro Lang wrote:
> The create_data() set cmd_str to "-c \"resvsp $((off * 4096)) 4096\".
> That cause xfs_io can't split the command line properly, it fails as:
> 
>   command ""resvsp" not found
> 
> Fixes: aaf40fb7 ("fstests: xfs/227 is really slow")
> Signed-off-by: Zorro Lang <[email protected]>

Glomming CLI arguments into a string is quite a bash antipattern.

Reviewed-by: "Darrick J. Wong" <[email protected]>

--D

> ---
>  tests/xfs/227 | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/tests/xfs/227 b/tests/xfs/227
> index 7f8ee2db..ed505b18 100755
> --- a/tests/xfs/227
> +++ b/tests/xfs/227
> @@ -78,13 +78,13 @@ create_attrs()
>  create_data()
>  {
>  	local blocks=$1
> -	local cmd_str
> +	local cmd_args=()
>  
>  	for off in `seq $blocks -1 0`; do
> -		cmd_str="-c \"resvsp $((off * 4096)) 4096\" $cmd_str"
> +		cmd_args+=("-c" "resvsp $((off * 4096)) 4096")
>  	done
>  	$XFS_IO_PROG -f -c "truncate $((($blocks + 1) * 4096))" \
> -			$cmd_str $2 >> seqres.full 2>&1
> +			"${cmd_args[@]}" $2 >> $seqres.full 2>&1
>  }
>  
>  # create the designated file with a certain number of attributes and a certain
> -- 
> 2.52.0
> 
>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.