[PATCH] libmount: special treatment for auto in fstype pattern

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Quoting from https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=506695 :

according to mount(8), mount tries to guess a filesystem type when given
fstype `auto' and it tries multiple filesystems if a list of fstypes is
given.

A single fstype `auto' works as expected:
	mount -t auto /dev/sde /media/stick
mounts /dev/sde as vfat, which is correct.
However, merging `auto' with other types doesn't work as expected:
	mount -t ext2,auto /dev/sde /media/stick
does not mount /dev/sde but returns:
	mount: unknown filesystem type 'auto'

Trying multiple fstypes before allowing mount to guess makes sense in
different scenarios, for example to prefer specific fstypes (ext2
instead of ext3) or to try fstypes that mount doesn't guess (minix).
I'm not sure if the Debian installer still sets CDROM fstab entries to
`udf,iso9660,auto' but I remember it did once. This wouldn't work then
either.

Reported-by: "Mario 'BitKoenig' Holbe" <Mario.Holbe@xxxxxxxxxxxxx>
Signed-off-by: Andreas Henriksson <andreas@xxxxxxxx>
---
 libmount/src/context_mount.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/libmount/src/context_mount.c b/libmount/src/context_mount.c
index dcfdabf..d07fa02 100644
--- a/libmount/src/context_mount.c
+++ b/libmount/src/context_mount.c
@@ -782,6 +782,8 @@ static int do_mount_by_pattern(struct libmnt_context *cxt, const char *pattern)
 			char *end = strchr(p, ',');
 			if (end)
 				*end = '\0';
+			if (strcmp(p, "auto") == 0)
+				p = NULL;
 			rc = do_mount(cxt, p);
 			p = end ? end + 1 : NULL;
 
-- 
2.0.0

--
To unsubscribe from this list: send the line "unsubscribe util-linux" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Netdev]     [Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux