Karel Zak [Fri, 24 Aug 2012 16:41:50 +0000 (18:41 +0200)]
fsck: use less aggressive method to detect mounted devices
We should not care about mountpoints in fsck if a device name
specified on command line, just check if the device is used somewhere
in /proc/self/mountinfo file.
Crazy people who use
fsck /mountpoint
have to specify the mountpoint by the same format as in their fstab --
symlinks canonicalization is not supported.
Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=850965 Signed-off-by: Karel Zak <kzak@redhat.com>
Karel Zak [Fri, 24 Aug 2012 16:13:06 +0000 (18:13 +0200)]
libmount: rewrite mnt_table_is_fs_mounted() to be less aggressive
The old implementation always canonicalizes target (mountpoint) path.
It's better to postpone this operation until the path is really
necessary (usually it's unnecessary), because readlink() on mountpoint
may trigger automounts.
Karel Zak [Tue, 14 Aug 2012 23:53:40 +0000 (01:53 +0200)]
build-sys: expand paths at make time
autoconf docs about *dir variables (e.g bindir):
... A corollary is that you should not use these variables except in
makefiles...
...you should not rely on AC_CONFIG_FILES to replace bindir and friends
in your shell scripts and other files; instead, let make manage their
replacement.
Looks like a simple case of missing has_arg flag in the "struct
option" initialization for these two options. The patch just adds the
flag. I haven't done thorough testing of the patched code, but it
seems to work OK and it no longer segfaults or tries to dereference a
null pointer.
Samuel Thibault [Wed, 8 Aug 2012 15:19:43 +0000 (17:19 +0200)]
Fix non-Linux build
loopdev.c, test_pager, and get_max_number_of_cpus() are linux-specific.
get_linux_version will only work on Linux, let's introduce
system_supports_ext4_ext2() which assumes that mounting ext2 with ext4
is not supported on non-Linux systems.
[kzak@redhat.com: - use #ifdef SYS_sched_getaffinity rather than __linux__]
Signed-off-by: Samuel Thibault <samuel.thibault@ens-lyon.org> Signed-off-by: Karel Zak <kzak@redhat.com>
Karel Zak [Mon, 13 Aug 2012 12:23:04 +0000 (14:23 +0200)]
lib/tt: always escape '\' to simplify parsing in scripts
The commands echo(1) and printf(1) are usable for escape sequences
decoding, for example
for x in $(findmnt --noheading --raw --output TARGET); do
printf "%b" $x
done
but it's necessary to escape all '\' chars, otherwise for example \b
in foo\bar will be interpreted as backspace. It means that for example
findmnt(8) has to use \x5c for the backslash.
Sami Kerola [Sat, 4 Aug 2012 07:33:40 +0000 (09:33 +0200)]
vipw: make vim writebackup mode work
Some editors, such as Vim with 'writebackup' mode enabled, use "atomic
save" in which the old file is deleted and a new one with the same name
created in its place. The vipw tries to detect if such happen by
looking hard temporary file link count, when it is zero reopen
temporary file by using it's path.
Reported-by: Mantas Mikulėnas <grawity@gmail.com>
References: http://www.spinics.net/lists/util-linux-ng/msg06666.html Signed-off-by: Sami Kerola <kerolasa@iki.fi>
Sami Kerola [Sat, 4 Aug 2012 07:33:38 +0000 (09:33 +0200)]
docs: add sys-utils/umount.8 manual page
The man page is almost exact copy of mount-deprecated/umount.8. This
version mentions long options, and has the options in same order as
they are mentioned in usage() output. Rest of the minor changes make
groff slightly nicer e.g. use .PP instead of empty line for paragraph
marker.
Karel Zak [Fri, 3 Aug 2012 19:24:51 +0000 (21:24 +0200)]
tests: make compatible with autotools
The command 'make check' is called from 'make distcheck' (which is
used to generate official util-linux tarballs).
It means that tests/ stuff has to be compatible with autotools and
differentiate between source and build directories.
* remove run-nonroot.sh (merged into run.sh
* remove commands.sh.in
* all tests and top level run.sh accept --builddir and --srcdir
command line options
* functions.sh modified to use $top_builddir/tests for output files
Karel Zak [Thu, 2 Aug 2012 15:39:14 +0000 (17:39 +0200)]
dmesg: fix kmsg usability detection
On old kernels (<3.5) kernel allows to open read-only /dev/kmsg for
root, but read() returns -EINVAL. It means that open() is not enough
to detect /dev/kmsg usability. We have to call read() (or epoll).
Reported-by: Kay Sievers <kay.sievers@vrfy.org> Signed-off-by: Karel Zak <kzak@redhat.com>
Karel Zak [Wed, 1 Aug 2012 15:52:22 +0000 (17:52 +0200)]
libmount: deduplicate SELinux mount options
We already have a clue about SELinux specific mount options in libmount, so
it makes sense to deduplicate the options as Linux kernel does not
support duplicate SELinux options. (SELinux kernel stuff somehow
ignores standard Linux mount conventions...)
Requested-by: Niels de Vos <ndevos@redhat.com> Signed-off-by: Karel Zak <kzak@redhat.com>
Bernhard Voelker [Tue, 31 Jul 2012 14:36:35 +0000 (16:36 +0200)]
tests: make blkid/md-raid1-part more robust
* tests/expected/blkid/mk-raid1-part: Replace major and minor number
of ID_PART_ENTRY_DISK by a special string. Add ID_FS_UUID and
ID_FS_UUID_ENC again, also with a special string.
* tests/ts/blkid/md-raid1-part: Before comparing the expected output
with the actual output, replace the values of ID_PART_ENTRY_DISK,
ID_FS_UUID and ID_FS_UUID_ENC with the speacial strings mentioned above.
Signed-off-by: Bernhard Voelker <mail@bernhard-voelker.de>
Bernhard Voelker [Fri, 27 Jul 2012 08:35:01 +0000 (10:35 +0200)]
tests: search mount point in canonicalized form in /proc/mounts
* tests/functions.sh (ts_is_mounted): Enhance to resolve symlinks in
given mount point before grep'ing in /proc/mount.
If the test directory is on a symlink, then e.g. tests/ts/cramfs/doubles
failed because the kernel keeps the mount entry in a canonicalized form
in /proc/mounts while this function searched for it with the original
path name.
Signed-off-by: Bernhard Voelker <mail@bernhard-voelker.de>
Commit 79c8a145ddff98d9c5bc70e67c5a861f67c50484 changed the numerical values of
fdisk_labeltype and broke the menu functionality, mixing main and expert menus.
Revert this change along with the label comment regarding it matching labeltype.
This is no longer valid since the original patch that lead to this modification
assumed that __probe_labels() would use these indices when creating a default
DOS/SUN disklabel, see http://www.spinics.net/lists/util-linux-ng/msg06509.html
Reported-by: Petr Uzel <petr.uzel@suse.cz> Signed-off-by: Davidlohr Bueso <dave@gnu.org>