Karel Zak [Wed, 29 Aug 2012 15:34:26 +0000 (17:34 +0200)]
runuser: new command (derived from su(1))
This command is based on su(1), the differences:
- based on Fedora runuser su(1) patch
- not installed with suid rights
- allowed for root users only
- don't ask for password
- uses PAM session, for example:
Karel Zak [Tue, 28 Aug 2012 14:32:28 +0000 (16:32 +0200)]
su: add --group and --supp-group options
These options allow to specify alternative groups. The command
su(1) has to be executed by root. The implementation is based on
Fedora runuser(1) command.
For example:
# su --group=kzak --supp-group=uuidd -
# id
uid=0(root) gid=1000(kzak) groups=0(root),985(uuidd),1000(kzak)
non-root user:
$ su --group=kzak -
su: only root can specify alternative groups
disk-utils/fsck.cramfs.c: In function ‘test_crc’:
disk-utils/fsck.cramfs.c:231:32: warning: pointer of type ‘void *’ used in arithmetic [-Wpointer-arith]
disk-utils/fsck.cramfs.c:233:24: warning: pointer of type ‘void *’ used in arithmetic [-Wpointer-arith]
Dave Reisner [Mon, 20 Aug 2012 10:06:17 +0000 (06:06 -0400)]
findmnt: use st.st_bavail for available column
This matches more closely with what 'df -h' reports as space available.
Any remaining discrepancy between these 2 tools is a result of precision
and choices in rounding.
Signed-off-by: Dave Reisner <dreisner@archlinux.org>
Karel Zak [Mon, 27 Aug 2012 17:26:07 +0000 (19:26 +0200)]
libmount: remount does not add entry to mtab file
# mount -n -o ro /dev/sda1 /
# mount -o remount,rw /dev/sda1 /
For the backward compatibility the command mount(8) should to add a
new entry to the file /etc/mtab on remount if the original entry not
found (because previous mount has been called with -n).
Reported-by: <frinnst> on IRC Signed-off-by: Karel Zak <kzak@redhat.com>
Karel Zak [Mon, 27 Aug 2012 15:38:24 +0000 (17:38 +0200)]
libblkid: rewrite ntfs prober
- use regular NTFS bios parameters block
- don't care about mirror cluster location
- remove unnecessary macros
- add more checks (based on Linux kernel code)
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>