Re: [PATCH] common/rc: fix mount options quoting in _mount

"Darrick J. Wong" <[email protected]> Mon, 29 Jun 2026 08:58:12 -0700
Newsgroups org.kernel.vger.fstests
Message-ID <20260629155812.GW6070@frogsfrogsfrogs>
On Mon, Jun 29, 2026 at 09:29:35PM +0800, [email protected] wrote:
> From: An Long <[email protected]>
> 
> In commit 078f320 ("treewide: convert all $MOUNT_PROG to _mount"),
> direct calls to $MOUNT_PROG were converted to call the helper function
> _mount.
> However, the _mount helper was implemented using `$*` instead of `"$@"`.
> This unquoted argument expansion triggers word splitting on any arguments
> containing spaces (such as the overlay mount options containing spaces in
> tests `overlay/083` and `overlay/086`), causing the mount to fail with
> "mount: bad usage".
> Fix this regression by using `"$@"` in the _mount helper, which correctly
> preserves argument boundaries exactly as they were provided by the caller.
> ---
>  common/rc | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/common/rc b/common/rc
> index 79189e7e..56dbea6f 100644
> --- a/common/rc
> +++ b/common/rc
> @@ -296,10 +296,10 @@ _has_dmesg_since_option()
>  
>  _mount()
>  {
> -	$MOUNT_PROG $*
> +	$MOUNT_PROG "$@"

Yes, "$@" is how you're supposed to convey the current list of arguments
to a subprogram as a list, without alteration...

>  	ret=$?
>  	if [ "$ret" -ne 0 ]; then
> -		echo "\"$MOUNT_PROG $*\" failed at $(date)" >> "$seqres.mountfail?"
> +		echo "\"$MOUNT_PROG $@\" failed at $(date)" >> "$seqres.mountfail?"

...but when embedding those arguments in a string, $* is the correct
usage.

--D

>  		if _has_dmesg_since_option; then
>  			dmesg --since '30s ago' >> "$seqres.mountfail?"
>  		else
> -- 
> 2.51.0
> 
>