# mkfs.ext4 /dev/sda1
# mount -t foo,bar /dev/sda1 /mnt
successfully mount the device, this is unexpected as extN is no
between wanted (by -t specified) filesystems.
Summary about -t:
* "mount -t foo" mount(2) with "foo" type
* "mount -t foo,bar" try mount(2) with "foo" or "bar"
* "mount -t foo,auto" try mount(2) with "foo" or ask libblkid for
the type
* "mount -t nofoo,bar" try types from /{etc,proc}/filesystems, but
exclude "foo" and "bar"
Note that more filesystems may be specified in fstab (as comma
delimited list). The stuff from fstab is always interpreted as list
and never as a pattern ("no" prefix makes no sense in fstab).
Reported-by: Benno Schulenberg <bensberg@justemail.net>
Signed-off-by: Karel Zak <kzak@redhat.com>
fstab:
UUID=nonexist /mnt/nonexist1 ext4 nofail 0 1
# mount -av
mount: can't find UUID=nonexist
.. this is bug of course.
Reported-by: Patrick McLean <chutzpah@gentoo.org>
Signed-off-by: Karel Zak <kzak@redhat.com>
Now the "nofail" affects warnings warning messages only. That's wrong
and regression (against original non-libmount version). The nofail has
to control return code too.
Reported-by: Patrick McLean <chutzpah@gentoo.org>
Signed-off-by: Karel Zak <kzak@redhat.com>
The option is unsupported since v2.23, let's cleanup man pages and
code to remove it at all.
Reported-by: "Dale R. Worley" <worley@alum.mit.edu>
Signed-off-by: Karel Zak <kzak@redhat.com>
The libmount does not care if we set source or target, it's able to
swap it, but the mount.c function sanitize_paths() does not work as
expected if we set NAME=value as target. It means that
$ mount LABEL=foo
does not work for non-root users (since 51e3530cdc, v2.24).
This patch also checks if source or target is specified more
than once.
Signed-off-by: Karel Zak <kzak@redhat.com>
libmount ignores "ambivalent probing result" from libblkid and tries
filesystems /etc/filesystems. This is incorrect behavior.
Reported-by: Lukas Czerner <lczerner@redhat.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
Presently, libmount-mount completely prohibits the use of -t by non-root
users. This breaks using -t in listing mode as a user, which represents
a regression against mount-deprecated, macosx and presumably *BSD.
This commit fixes the issue by deferring the mnt_context_is_restricted
check for -t until we know we're not in listing mode.
Signed-off-by: Rich Tollerton <rich.tollerton@ni.com>
$ mount /root/.ssh/../../dev/sda2
mount: only root can mount UUID=17bc65ec-4125-4e7c-8a7d-e2795064c736 on /boot
this is too promiscuous. It seems better to ignore on command line
specified paths which are not resolve-able for non-root users.
Fixed version:
$ mount /root/.ssh/../../dev/sda2
mount: /root/.ssh/../../dev/sda2: Permission denied
$ mount /dev/sda2
mount: only root can mount UUID=17bc65ec-4125-4e7c-8a7d-e2795064c736 on /boot
Note that this bug has no relation to mount(2) permissions evaluation
in suid mode. The way how non-root user specifies paths on command
line is completely irrelevant for comparison with fstab entries.
Signed-off-by: Karel Zak <kzak@redhat.com>
kernel cryptoloop is deprecated since ages and support for cryptoloop
in util-linux is incomplete/broken.
- no password hashing
- last 8 bit of key are always set to zero
- no binary keys possible (stops reading key at \n and \0)
In the past some Distros added the above features with patches. So
remove cryptoloop support from util-linux completely to make sure
people won't try using it.
Signed-off-by: Ludwig Nussel <ludwig.nussel@suse.de>
Signed-off-by: Karel Zak <kzak@redhat.com>
For compatibility with coreutils and to avoid complex solutions in
mount output mount replaces control characters with '?'.
Note that the listing mode in mount(8) is in maintenance mode --
findmnt(8) provides more robust and better solutions.
Signed-off-by: Karel Zak <kzak@redhat.com>
In some cases (for example if only one mount argument is given) may be
mount request ambivalent:
# mount /foo
and fstab:
/dev/sda5 /foo rw 0 0
/foo /bar bind 0 0
the new options allows to be more explicit
# mount --target /foo (mounts /dev/sda5)
# mount --source /foo (binds /foo to /bar)
It's possible to use the options together
# mount --source /dev/sda2 --target /home
Signed-off-by: Karel Zak <kzak@redhat.com>
# mount -R /mnt/test /mnt/test
mount: propagation flags (--make-* or --bind options) are mutually exclusive
Reported-by: Dave Reisner <dreisner@archlinux.org>
Signed-off-by: Karel Zak <kzak@redhat.com>
We have to be careful with "none" or another dummy sources for pseudo
filesystems. These strings should be canonicalized or compared as a
paths.
The function is not exported by library API.
Signed-off-by: Karel Zak <kzak@redhat.com>
Commit ce433404 introduced the change, which causes something like mount -i
<user-mount-path> to break which worked well before util-linux-2.21, now it
gives message 'mount: only root can use "--internal-only" option' when that
shouldn't be the case when it is already in fstab.
Signed-off-by: Raghavendra D Prabhu <rprabhu@wnohang.net>
New return codes:
0 : all mounted (or all ignored)
64 : some mounted, some failed
32 : all failed
Note that already mounted or ignored (filtered out by -t or -O)
filesystems don't affect the final return code.
The original mount(8) returns 0 instead of 64, so the situation
"some mounted, some failed" cannot be detected.
Signed-off-by: Karel Zak <kzak@redhat.com>
well, this is free-before-exit, but let's use mount(8) as test
application for libmount and keep it without leaks.
Signed-off-by: Karel Zak <kzak@redhat.com>