From: Karel Zak Date: Mon, 13 Jan 2025 09:43:26 +0000 (+0100) Subject: Revert "libmount: exec mount helpers with posixly correct argument order" X-Git-Tag: v2.42-start~96 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=fc9c9385b0d1bc06894c99472422c96490cbcfc3;p=thirdparty%2Futil-linux.git Revert "libmount: exec mount helpers with posixly correct argument order" The change is not backwardly compatible, see https://github.com/util-linux/util-linux/issues/3355 This reverts commit 2d680b72ac61644e4ba177e6569d8ca13580c248. --- diff --git a/libmount/src/context_mount.c b/libmount/src/context_mount.c index 76b24cd84..f0b80f0b0 100644 --- a/libmount/src/context_mount.c +++ b/libmount/src/context_mount.c @@ -430,33 +430,31 @@ static int exec_helper(struct libmnt_context *cxt) type = mnt_fs_get_fstype(cxt->fs); args[i++] = cxt->helper; /* 1 */ + args[i++] = mnt_fs_get_srcpath(cxt->fs);/* 2 */ + args[i++] = mnt_fs_get_target(cxt->fs); /* 3 */ if (mnt_context_is_sloppy(cxt)) - args[i++] = "-s"; /* 2 */ + args[i++] = "-s"; /* 4 */ if (mnt_context_is_fake(cxt)) - args[i++] = "-f"; /* 3 */ + args[i++] = "-f"; /* 5 */ if (mnt_context_is_nomtab(cxt)) - args[i++] = "-n"; /* 4 */ + args[i++] = "-n"; /* 6 */ if (mnt_context_is_verbose(cxt)) - args[i++] = "-v"; /* 5 */ + args[i++] = "-v"; /* 7 */ if (o) { - args[i++] = "-o"; /* 6 */ - args[i++] = o; /* 7 */ + args[i++] = "-o"; /* 8 */ + args[i++] = o; /* 9 */ } if (type && strchr(type, '.') && !endswith(cxt->helper, type)) { - args[i++] = "-t"; /* 8 */ - args[i++] = type; /* 9 */ + args[i++] = "-t"; /* 10 */ + args[i++] = type; /* 11 */ } if (namespace) { - args[i++] = "-N"; /* 10 */ - args[i++] = namespace; /* 11 */ + args[i++] = "-N"; /* 12 */ + args[i++] = namespace; /* 13 */ } - - args[i++] = mnt_fs_get_srcpath(cxt->fs);/* 12 */ - args[i++] = mnt_fs_get_target(cxt->fs); /* 13 */ - args[i] = NULL; /* 14 */ for (i = 0; args[i]; i++) DBG(CXT, ul_debugobj(cxt, "argv[%d] = \"%s\"", diff --git a/libmount/src/context_umount.c b/libmount/src/context_umount.c index 3ae77778f..64a1d884b 100644 --- a/libmount/src/context_umount.c +++ b/libmount/src/context_umount.c @@ -711,30 +711,29 @@ static int exec_helper(struct libmnt_context *cxt) type = mnt_fs_get_fstype(cxt->fs); args[i++] = cxt->helper; /* 1 */ + args[i++] = mnt_fs_get_target(cxt->fs); /* 2 */ if (mnt_context_is_nomtab(cxt)) - args[i++] = "-n"; /* 2 */ + args[i++] = "-n"; /* 3 */ if (mnt_context_is_lazy(cxt)) - args[i++] = "-l"; /* 3 */ + args[i++] = "-l"; /* 4 */ if (mnt_context_is_force(cxt)) - args[i++] = "-f"; /* 4 */ + args[i++] = "-f"; /* 5 */ if (mnt_context_is_verbose(cxt)) - args[i++] = "-v"; /* 5 */ + args[i++] = "-v"; /* 6 */ if (mnt_context_is_rdonly_umount(cxt)) - args[i++] = "-r"; /* 6 */ + args[i++] = "-r"; /* 7 */ if (type && strchr(type, '.') && !endswith(cxt->helper, type)) { - args[i++] = "-t"; /* 7 */ - args[i++] = type; /* 8 */ + args[i++] = "-t"; /* 8 */ + args[i++] = type; /* 9 */ } if (namespace) { - args[i++] = "-N"; /* 9 */ - args[i++] = namespace; /* 10 */ + args[i++] = "-N"; /* 10 */ + args[i++] = namespace; /* 11 */ } - args[i++] = mnt_fs_get_target(cxt->fs); /* 11 */ - args[i] = NULL; /* 12 */ for (i = 0; args[i]; i++) DBG(CXT, ul_debugobj(cxt, "argv[%d] = \"%s\"", diff --git a/tests/expected/mount/special-basic b/tests/expected/mount/special-basic index ae1c36858..99997d354 100644 --- a/tests/expected/mount/special-basic +++ b/tests/expected/mount/special-basic @@ -1 +1 @@ -/sbin/mount.mytest called with "-o rw /foo /bar" +/sbin/mount.mytest called with "/foo /bar -o rw" diff --git a/tests/expected/mount/special-multi-types b/tests/expected/mount/special-multi-types index ae1c36858..99997d354 100644 --- a/tests/expected/mount/special-multi-types +++ b/tests/expected/mount/special-multi-types @@ -1 +1 @@ -/sbin/mount.mytest called with "-o rw /foo /bar" +/sbin/mount.mytest called with "/foo /bar -o rw" diff --git a/tests/expected/mount/special-options b/tests/expected/mount/special-options index b7fdad97e..820a74a9f 100644 --- a/tests/expected/mount/special-options +++ b/tests/expected/mount/special-options @@ -1 +1 @@ -/sbin/mount.mytest called with "-o rw,foo /foo /bar" +/sbin/mount.mytest called with "/foo /bar -o rw,foo" diff --git a/tests/expected/mount/special-user b/tests/expected/mount/special-user index 1c79c32ea..02c112e18 100644 --- a/tests/expected/mount/special-user +++ b/tests/expected/mount/special-user @@ -1 +1 @@ -/sbin/mount.mytest called with "-o rw,user,noexec,nosuid,nodev,abc /foo /bar" +/sbin/mount.mytest called with "/foo /bar -o rw,user,noexec,nosuid,nodev,abc" diff --git a/tests/expected/mount/special-username b/tests/expected/mount/special-username index c8b94a727..c19256290 100644 --- a/tests/expected/mount/special-username +++ b/tests/expected/mount/special-username @@ -1 +1 @@ -/sbin/mount.mytest called with "-o rw,user=name,abc /foo /bar" +/sbin/mount.mytest called with "/foo /bar -o rw,user=name,abc"