From: Karel Zak Date: Mon, 13 Jan 2025 09:36:09 +0000 (+0100) Subject: Revert "libmount: exec mount helpers with posixly correct argument order" X-Git-Tag: v2.40.4~5 X-Git-Url: http://git.ipfire.org/gitweb/gitweb.cgi?a=commitdiff_plain;h=c2a3caaa88d2729c3e5785aad28f89ec299737d3;p=thirdparty%2Futil-linux.git Revert "libmount: exec mount helpers with posixly correct argument order" The change is backwardly incompatible. https://github.com/util-linux/util-linux/issues/3355 This reverts commit 474f2599a3786d4359b8f5abe7416cdf6321c002. --- diff --git a/libmount/src/context_mount.c b/libmount/src/context_mount.c index 22892f3f67..09fa25bc89 100644 --- a/libmount/src/context_mount.c +++ b/libmount/src/context_mount.c @@ -429,33 +429,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 f5de48848a..bf70ed2ee7 100644 --- a/libmount/src/context_umount.c +++ b/libmount/src/context_umount.c @@ -712,30 +712,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 ae1c368583..99997d354f 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 ae1c368583..99997d354f 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 b7fdad97e1..820a74a9fc 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 1c79c32ea4..02c112e18a 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 c8b94a7272..c192562906 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"