]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
Revert "libmount: exec mount helpers with posixly correct argument order"
authorKarel Zak <kzak@redhat.com>
Mon, 13 Jan 2025 09:43:26 +0000 (10:43 +0100)
committerKarel Zak <kzak@redhat.com>
Mon, 13 Jan 2025 09:43:26 +0000 (10:43 +0100)
The change is not backwardly compatible, see https://github.com/util-linux/util-linux/issues/3355

This reverts commit 2d680b72ac61644e4ba177e6569d8ca13580c248.

libmount/src/context_mount.c
libmount/src/context_umount.c
tests/expected/mount/special-basic
tests/expected/mount/special-multi-types
tests/expected/mount/special-options
tests/expected/mount/special-user
tests/expected/mount/special-username

index 76b24cd84b68bad6774cc7de113dff22b4ed7e58..f0b80f0b01ec62f7564419fdda09c9db807462b7 100644 (file)
@@ -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\"",
index 3ae77778f59e82ec1407bdd62da1e3b9e3e5eafd..64a1d884ba0f7400cafa43a7f0ec06f2917e79e6 100644 (file)
@@ -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\"",
index ae1c368583e21652a3bfb3d3fd33462611f5bc42..99997d354fb56e3fd1fd3e80bc656602ad90d59a 100644 (file)
@@ -1 +1 @@
-/sbin/mount.mytest called with "-o rw /foo /bar"
+/sbin/mount.mytest called with "/foo /bar -o rw"
index ae1c368583e21652a3bfb3d3fd33462611f5bc42..99997d354fb56e3fd1fd3e80bc656602ad90d59a 100644 (file)
@@ -1 +1 @@
-/sbin/mount.mytest called with "-o rw /foo /bar"
+/sbin/mount.mytest called with "/foo /bar -o rw"
index b7fdad97e16adad4db7e7723f6fcd6358642a80f..820a74a9fc53f22918d654a9851cf4e6ce8c224a 100644 (file)
@@ -1 +1 @@
-/sbin/mount.mytest called with "-o rw,foo /foo /bar"
+/sbin/mount.mytest called with "/foo /bar -o rw,foo"
index 1c79c32ea43c8aa778c6d806eb52fbf44b556f00..02c112e18a9e34960fd5081d7f410532a0c70519 100644 (file)
@@ -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"
index c8b94a7272e10b22657a9fc816dcedc5dfe319f9..c192562906ca728d722507ce2e53c18e5d01015c 100644 (file)
@@ -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"