public inbox for util-linux@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] libmount: special treatment for auto in fstype pattern
@ 2014-06-22 19:44 Andreas Henriksson
  2014-06-23 10:47 ` Karel Zak
  0 siblings, 1 reply; 2+ messages in thread
From: Andreas Henriksson @ 2014-06-22 19:44 UTC (permalink / raw)
  To: util-linux; +Cc: Andreas Henriksson

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


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] libmount: special treatment for auto in fstype pattern
  2014-06-22 19:44 [PATCH] libmount: special treatment for auto in fstype pattern Andreas Henriksson
@ 2014-06-23 10:47 ` Karel Zak
  0 siblings, 0 replies; 2+ messages in thread
From: Karel Zak @ 2014-06-23 10:47 UTC (permalink / raw)
  To: Andreas Henriksson; +Cc: util-linux

On Sun, Jun 22, 2014 at 09:44:50PM +0200, Andreas Henriksson wrote:
> 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'

 Interesting use case.

> 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 hope libblkid is able to detect minix ;-)

> 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);

 This is insufficient solution, the code has to call an FS detection
 code. I have applied a little different solution.

 Thanks!

    Karel

-- 
 Karel Zak  <kzak@redhat.com>
 http://karelzak.blogspot.com

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2014-06-23 10:47 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-06-22 19:44 [PATCH] libmount: special treatment for auto in fstype pattern Andreas Henriksson
2014-06-23 10:47 ` Karel Zak

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox