Hello, I recently came across an issue with _PATH_MOUNTED and different assumptions whether it is at /etc/mtab or /var/run/mtab.
The glibc default is /var/run/mtab but there is also a patch in the debian glibc to change it to /etc/mtab to be consistenst with the linux value. I don't know what the status of the patch is for changing it in glibc itself but in the meantime what do you think of the attached patch to not redefine it in hurd? I also changed the path in the help output in both mount and umount to refer to the value from libc.I can split that into a separate change if needed.
>From 883038c7f5859257ed44a04ddf96a6f761981e70 Mon Sep 17 00:00:00 2001 From: Yelninei <[email protected]> Date: Mon, 13 Oct 2025 19:13:50 +0000 Subject: [PATCH] umount: Use PATH_MOUNTED from libc. * utils/umount.c: Don't redefine _PATH_MOUNTED. (argp_opts): Use _PATH_MOUNTED for help message. * utils/mount.c (argp_opts): Use _PATH_MOUNTED for help message. --- utils/mount.c | 2 +- utils/umount.c | 6 +----- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/utils/mount.c b/utils/mount.c index d63e89b5..283443f5 100644 --- a/utils/mount.c +++ b/utils/mount.c @@ -61,7 +61,7 @@ static const struct argp_option argp_opts[] = {"update", 'u', 0, 0, "Flush any meta-data cached in core"}, {"remount", 0, 0, OPTION_ALIAS}, {"verbose", 'v', 0, 0, "Give more detailed information"}, - {"no-mtab", 'n', 0, 0, "Do not update /etc/mtab"}, + {"no-mtab", 'n', 0, 0, "Do not update " _PATH_MOUNTED}, {"test-opts", 'O', "OPTIONS", 0, "Only mount fstab entries matching the given set of options"}, {"bind", 'B', 0, 0, "Bind mount, firmlink"}, diff --git a/utils/umount.c b/utils/umount.c index 19f79fce..7a8e889a 100644 --- a/utils/umount.c +++ b/utils/umount.c @@ -32,10 +32,6 @@ #include "match-options.h" #include "../sutils/fstab.h" -/* XXX fix libc */ -#undef _PATH_MOUNTED -#define _PATH_MOUNTED "/etc/mtab" - static char *targets; static size_t targets_len; static int readonly; @@ -54,7 +50,7 @@ static const struct argp_option argp_opts[] = {NULL, 'd', 0, 0, "Also ask the source translator to go away"}, {"fake", FAKE_KEY, 0, 0, "Do not actually umount, just pretend"}, {"force", 'f', 0, 0, "Force umount by killing the translator"}, - {"no-mtab", 'n', 0, 0, "Do not update /etc/mtab"}, + {"no-mtab", 'n', 0, 0, "Do not update " _PATH_MOUNTED}, {"read-only", 'r', 0, 0, "If unmounting fails, try to remount read-only"}, {"nosync", 'S', 0, 0, "Don't sync a translator before killing it"}, {"test-opts", 'O', "OPTIONS", 0, -- 2.51.0
