public inbox for util-linux@vger.kernel.org
 help / color / mirror / Atom feed
From: Andreas Henriksson <andreas@fatal.se>
To: util-linux@vger.kernel.org
Cc: Andreas Henriksson <andreas@fatal.se>
Subject: [PATCH] libmount: special treatment for auto in fstype pattern
Date: Sun, 22 Jun 2014 21:44:50 +0200	[thread overview]
Message-ID: <1403466290-12880-1-git-send-email-andreas@fatal.se> (raw)

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@TU-Ilmenau.DE>
Signed-off-by: Andreas Henriksson <andreas@fatal.se>
---
 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


             reply	other threads:[~2014-06-22 19:45 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-06-22 19:44 Andreas Henriksson [this message]
2014-06-23 10:47 ` [PATCH] libmount: special treatment for auto in fstype pattern Karel Zak

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1403466290-12880-1-git-send-email-andreas@fatal.se \
    --to=andreas@fatal.se \
    --cc=util-linux@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox