Hi. I can confirm this bug. It affects only fs'es, options for which are not in fstab.
On laptop fs remounts are frequent (laptop-mode, pm-utils), thus, this bug makes mount output pretty unreadable, when you use mounts not in fstab, eg schroot'ed: ... /home/mirror on /var/lib/schroot/mount/net-8329b905-78ab-4c1f-ac67-430855f5cc47/home/mirror type none (rw,bind,commit=600,commit=600,commit=600,commit=600,commit=600,commit=600,commit=600,commit=600,commit=600,commit=600,commit=600,commit=600,commit=600,commit=600,commit=600,commit=600,commit=600,commit=600,commit=600,commit=600,commit=600,commit=600,commit=600,commit=600,commit=600,commit=600,commit=600,commit=600) /home/isbear/net on /var/lib/schroot/mount/net-8329b905-78ab-4c1f-ac67-430855f5cc47/home/isbear type none (rw,bind,commit=600,commit=600,commit=600,commit=600,commit=600,commit=600,commit=600,commit=600,commit=600,commit=600,commit=600,commit=600,commit=600,commit=600,commit=600,commit=600,commit=600,commit=600,commit=600,commit=600,commit=600,commit=600,commit=600,commit=600,commit=600,commit=600,commit=600,commit=600) /srv/schroot/net on /var/lib/schroot/mount/net-894651f2-91ec-49f8-886b-b32cc4495dd9 type none (rw,bind,commit=600,commit=600,commit=600,commit=600,commit=600,commit=600,commit=600,commit=600,commit=600,commit=600,commit=600,commit=600,commit=600,commit=600,commit=600,commit=600,commit=600,commit=600,commit=600,commit=600,commit=600,commit=600,commit=600,commit=600,commit=600,commit=600,commit=600,commit=600) proc on /var/lib/schroot/mount/net-894651f2-91ec-49f8-886b-b32cc4495dd9/proc type proc (rw) /dev on /var/lib/schroot/mount/net-894651f2-91ec-49f8-886b-b32cc4495dd9/dev type none (rw,bind) /dev/pts on /var/lib/schroot/mount/net-894651f2-91ec-49f8-886b-b32cc4495dd9/dev/pts type none (rw,bind) ... How mount works: it reads initial mount options (from fstab or mtab), then appends options, supplied from cmdline, then removes some special options, and writes that all to mtab. When it reads initial options from fstab, there's no problem, as each time in result it gets the same string. But when it reads them from mtab, it writes them back and keeps increasing options string. Attached patch possibly fixes this behaviour by checking, if option already exists in options line, when appendin something to it. Maybe this should be checked in the other place, maybe it should be done other way, maybe there's some other things, that should be done, eg checking for strstr/strlen presence in configure, but this patch works for me. -- System Information: Debian Release: wheezy/sid APT prefers testing APT policy: (500, 'testing') Architecture: amd64 (x86_64) Kernel: Linux 3.0.0-rc2-wl (SMP w/1 CPU core) Locale: LANG=uk_UA.UTF-8, LC_CTYPE=uk_UA.UTF-8 (charmap=UTF-8) Shell: /bin/sh linked to /bin/dash Versions of packages mount depends on: ii libblkid1 2.17.2-9.1 block device id library ii libc6 2.13-7 Embedded GNU C Library: Shared lib ii libselinux1 2.0.98-1.1 SELinux runtime shared libraries ii libsepol1 2.0.42-1 SELinux library for manipulating b ii libuuid1 2.17.2-9.1 Universally Unique ID library mount recommends no packages. Versions of packages mount suggests: ii nfs-common 1:1.2.3-3 NFS support files common to client -- no debconf information -- Михайло Даниленко ------------------------------- jabber: <[email protected]> icq: 590697790
--- util-linux-2.17.2/mount/mount.c 2011-07-11 23:34:36.000000000 +0300
+++ ul/mount/mount.c 2011-07-11 22:56:44.000000000 +0300
@@ -318,9 +318,23 @@
return xstrconcat3(NULL, opt, val); /* opt=val */
}
- if (!val)
+ const char *popt = strstr (s, opt);
+ if (!val) {
+ if (popt && (popt == s || *(popt - 1) == ',')) {
+ const char *poptend = popt + strlen (opt);
+ if (*poptend == '\0' || *poptend == ',') {
+ return s;
+ }
+ }
return xstrconcat3(s, ",", opt); /* s,opt */
-
+ }
+ if (popt && (popt == s || *(popt - 1) == ',')) {
+ size_t len = strlen (val);
+ const char *poptend = popt + strlen (opt);
+ const char *pvalend = poptend + strlen (val);
+ if (!strncmp (poptend, val, len) && (*pvalend == '\0' || *pvalend == ','))
+ return s;
+ }
return xstrconcat4(s, ",", opt, val); /* s,opt=val */
}
signature.asc
Description: Digital signature

