Skip to contentSkip to conversation

common/rc: fix mount options quoting in _mount

PATCH Superseded [email protected] 3 participants 7 messages Jun 29 – Aug 17 1 message not in the archive

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 common/rc: fix mount options quoting in _mount

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(-)
common/rc +2 -2
index 79189e7e..56dbea6f 100644
@@ -296,10 +296,10 @@ _has_dmesg_since_option()
 
 _mount()
 {
-	$MOUNT_PROG $*
+	$MOUNT_PROG "$@"
 	ret=$?
 	if [ "$ret" -ne 0 ]; then
-		echo "\"$MOUNT_PROG $*\" failed at $(date)" >> "$seqres.mountfail?"
+		echo "\"$MOUNT_PROG $@\" failed at $(date)" >> "$seqres.mountfail?"
 		if _has_dmesg_since_option; then
 			dmesg --since '30s ago' >> "$seqres.mountfail?"
 		else
Signature · 1 line
2.51.0
#1 lore raw
Quoted 21 lines · 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(-)
common/rc +0 -0
index 79189e7e..56dbea6f 100644

common/rc _has_dmesg_since_option() · line 299

Quoted 5 lines
common/rc +1 -1
@@ -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...

common/rc _has_dmesg_since_option() · line 302

Quoted 4 lines
common/rc +1 -1
 	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

Quoted 7 lines
common/rc +0 -0
 		if _has_dmesg_since_option; then
 			dmesg --since '30s ago' >> "$seqres.mountfail?"
 		else
Signature · 1 line
2.51.0
#2 lore raw

PATCH v2 1/1 common/rc: fix mount options quoting in _mount

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.

---
v2: Revert the error log to "$*"

 common/rc | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
common/rc +1 -1
index 79189e7e..b9a07324 100644
@@ -296,7 +296,7 @@ _has_dmesg_since_option()
 
 _mount()
 {
-	$MOUNT_PROG $*
+	$MOUNT_PROG "$@"
 	ret=$?
 	if [ "$ret" -ne 0 ]; then
 		echo "\"$MOUNT_PROG $*\" failed at $(date)" >> "$seqres.mountfail?"
Signature · 1 line
2.51.0
Reviewed-by on v2 1/1
#3 lore raw
Quoted 13 lines · On Wed, Jul 01, 2026 at 02:14:07PM +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.

Quoted 3 lines

---
v2: Revert the error log to "$*"

Very good!

--D

Quoted 20 lines
 common/rc | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
common/rc +1 -1
index 79189e7e..b9a07324 100644
@@ -296,7 +296,7 @@ _has_dmesg_since_option()
 
 _mount()
 {
-	$MOUNT_PROG $*
+	$MOUNT_PROG "$@"
 	ret=$?
 	if [ "$ret" -ne 0 ]; then
 		echo "\"$MOUNT_PROG $*\" failed at $(date)" >> "$seqres.mountfail?"
Signature · 1 line
2.51.0

A message that is not in the archive (sent off-list or not yet received): CAHLNDm3bTGowGmp46GMbpJz8_Eew+sGsH173D0PnnFKt=fWB_A@mail.gmail.com

#5 lore raw
Quoted 4 lines · Long An

Hi Darrick,

Thank you for your comments last month. Just following up on this patch. Is there anything else needed from my side?

Please talk to Zorro about that, he's the fstests maintainer.

--D

Quoted 51 lines

Thanks,
An

Quoted 46 lines · Darrick J. Wong
Quoted 12 lines · On Wed, Jul 01, 2026 at 02:14:07PM +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.

Quoted 4 lines

---
v2: Revert the error log to "$*"

Very good!

--D

Quoted 8 lines
 common/rc | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
common/rc +0 -0
index 79189e7e..b9a07324 100644

common/rc _has_dmesg_since_option() · line 302

Quoted 8 lines
common/rc +1 -1
@@ -296,7 +296,7 @@ _has_dmesg_since_option()
 
 _mount()
 {
-     $MOUNT_PROG $*
+     $MOUNT_PROG "$@"
      ret=$?
      if [ "$ret" -ne 0 ]; then
              echo "\"$MOUNT_PROG $*\" failed at $(date)" >>

"$seqres.mountfail?"

Quoted 4 lines

--
2.51.0

author
#6 lore raw

Hello Zorro,

Friendly ping on this patch.
Any feedback would be appreciated.

Thanks,
An

Quoted 62 lines · Darrick J. Wong
Quoted 4 lines · Long An

Hi Darrick,

Thank you for your comments last month. Just following up on this patch. Is there anything else needed from my side?

Please talk to Zorro about that, he's the fstests maintainer.

--D

Quoted 51 lines

Thanks,
An

Quoted 46 lines · Darrick J. Wong
Quoted 12 lines · On Wed, Jul 01, 2026 at 02:14:07PM +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.

Quoted 4 lines

---
v2: Revert the error log to "$*"

Very good!

--D

Quoted 8 lines
 common/rc | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
common/rc +0 -0
index 79189e7e..b9a07324 100644

common/rc _has_dmesg_since_option() · line 302

Quoted 8 lines
common/rc +1 -1
@@ -296,7 +296,7 @@ _has_dmesg_since_option()
 
 _mount()
 {
-     $MOUNT_PROG $*
+     $MOUNT_PROG "$@"
      ret=$?
      if [ "$ret" -ne 0 ]; then
              echo "\"$MOUNT_PROG $*\" failed at $(date)" >>

"$seqres.mountfail?"

Quoted 4 lines

--
2.51.0

#7 lore raw
Quoted 4 lines · Long An

Hello Zorro,

Friendly ping on this patch.
Any feedback would be appreciated.

This patch has been merged in fstests v2026.07.21, as:

b2e97cf3 common/rc: fix mount options quoting in _mount

Thanks,
Zorro

Quoted 68 lines

Thanks,
An

Quoted 62 lines · Darrick J. Wong
Quoted 4 lines · Long An

Hi Darrick,

Thank you for your comments last month. Just following up on this patch. Is there anything else needed from my side?

Please talk to Zorro about that, he's the fstests maintainer.

--D

Quoted 51 lines

Thanks,
An

Quoted 46 lines · Darrick J. Wong
Quoted 12 lines · On Wed, Jul 01, 2026 at 02:14:07PM +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.

Quoted 4 lines

---
v2: Revert the error log to "$*"

Very good!

--D

Quoted 8 lines
 common/rc | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
common/rc +0 -0
index 79189e7e..b9a07324 100644

common/rc _has_dmesg_since_option() · line 302

Quoted 8 lines
common/rc +1 -1
@@ -296,7 +296,7 @@ _has_dmesg_since_option()
 
 _mount()
 {
-     $MOUNT_PROG $*
+     $MOUNT_PROG "$@"
      ret=$?
      if [ "$ret" -ne 0 ]; then
              echo "\"$MOUNT_PROG $*\" failed at $(date)" >>

"$seqres.mountfail?"

Quoted 4 lines

--
2.51.0