Karel Zak [Mon, 27 Apr 2015 08:51:33 +0000 (10:51 +0200)]
fsck: use PATH or fallback to /sbin
It's overkill to support all the obscure paths like /sbin/fs.d. We
have PATH for customization, that's enough.
It still seems like a good idea to keep fsck robust, because it's used
by boot scripts/systemd. For this reason fsck fallbacks to "/sbin" if
PATH is undefined or empty.
Mike Frysinger [Sun, 12 Apr 2015 09:06:52 +0000 (05:06 -0400)]
swapon: search for mkswap via PATH
Rather than hardcode /sbin/mkswap all the time, use a normal PATH search.
This matches the normal behavior of other tools, and makes local testing
easier.
Mike Frysinger [Sun, 12 Apr 2015 09:06:51 +0000 (05:06 -0400)]
mkfs: drop hardcoded search path
Rather than maintain a hardcoded search path for looking up tools and
override the user's PATH env setting, respect whatever the user has.
This matches the convention of just about every other tool out there.
It might break on systems that don't have /sbin in their PATH and they
try to run /sbin/mkfs directly, but so be it.
commit d53f8ecfbf036eddb2aef737dc0973a613d80ced
introduced the TZUTC environment variable to
facilitate use of the zoneinfo 'right' database.
This was incorrect. Either the TZDIR environment
variable should be used or a system-wide
configuration for the 'right' database should be
used.
See hwclock(8) POSIX vs 'RIGHT' for more details.
TZUTC was undocumented and should be safe to remove.
The commit also caused a regression when using
musl libc, because when TZUTC is unset getenv()
returns a NULL pointer. Reported-by: Isaac Dunham <ibid.ag@gmail.com> Signed-off-by: J William Piggott <elseifthen@gmx.com>
Karel Zak [Wed, 22 Apr 2015 09:08:05 +0000 (11:08 +0200)]
lib/strutils: fix string_add_to_idarray() int vs. size_t
The function uses "int" as argument, but for array size (and index) is better
to use unsigned type (size_t). If we mix "size_t" in util (e.g. fdisk)
and "int" in lib/strutils.c then result is unexpected behavior on
ppc64.
Commit ab8f402952301106ad0bd5c5a51dc8646d1bff64 regression
where synchronize_to_clock_tick_rtc() only returns the correct
value for a select() time out if using debug mode. This caused
hwclock to have invalid output when select() timed out in
normal mode.
Signed-off-by: J William Piggott <elseifthen@gmx.com>
It was hard to find out that pipefail was the reason why our
test-suite could have random failures for aribtrary tests,
for example the ones which are using ts_device_has_uuid() or
ts_mount().
Bash's pipefall option is evil! It may return error for such a
simple line like this one
$ echo -e "xxx\nyyy" | grep -q "xxx"
because the left echo command will get SIGPIPE when grep exits after
the first match. So the command line above could return an error
eventhough it does exactly what we want.
This patch removes any pipefail from our tests. The funny thing is
that I couldn't find any case where we relied on this feature anyway.
Ruediger Meier [Tue, 31 Mar 2015 12:19:40 +0000 (14:19 +0200)]
tests: introduce TS_LOOP_DEVS for cleanup
We are maintaining an array TS_LOOP_DEVS to de-initialize devices
always on exit. Until now there was no cleanup in ts_skip().
The downside is that we can't execute ts_device_init() in a subshell
anymore. The device is returned via global variable TS_LODEV, similar
like we do already in ts_scsi_debug_init().
Tests which don't use ts_device_init() to create loop devices may use
ts_register_loop_device() to get them cleaned up later.
Karel Zak [Tue, 14 Apr 2015 09:52:06 +0000 (11:52 +0200)]
Merge branch 'tests-logger' of https://github.com/rudimeier/util-linux
* 'tests-logger' of https://github.com/rudimeier/util-linux:
travis: install socat >= 1.7.2
tests: add subtests for invalid logger devive
tests: logger/errors does not use --no-act
tests: logger, validate written socket data
tests: logger with socat device
tests: simplify common logger options
logger: --stderr and --no-act turn "auto-errors" on
Karel Zak [Thu, 9 Apr 2015 09:48:07 +0000 (11:48 +0200)]
unshare: allow persisting mount namespaces
We can create a reference (bind mount) to the new namespace after
unshare(2), but it does not make sense to do it within unshared
namespace. (And if I read kernel fs/namespace.c: do_loopback()
correctly than copy mount bind mounts of /proc/<pid>/ns/mnt between
namespaces is unsupported.)
This patch bypass this problem by fork() where parent continue as
usually (call unshare(2), setup another things, etc.), but child
waits for /proc/[ppid]/ns/mnt inode number change (the ino is
changed after parent's unshare(2)) and then it bind mounts the new
namespaces and exit.
Max Klinger [Tue, 7 Apr 2015 11:05:39 +0000 (13:05 +0200)]
cal: add -Y and -n <num>
[kzak@redhat.com: - add month_in_row to avoid extra meaning of num_month=-3,
- add header_year
- add long option for -Y
- define conflicts between -Y, -y and -n
- remove ctl.yflag]
Co-Author: Karel Zak <kzak@redhat.com> Signed-off-by: Karel Zak <kzak@redhat.com>
Karel Zak [Tue, 7 Apr 2015 10:42:56 +0000 (12:42 +0200)]
Merge branch 'test-fixes' of https://github.com/rudimeier/util-linux
* 'test-fixes' of https://github.com/rudimeier/util-linux:
tests: mount/rlimit tries to restore mtab
tests: fix, don't call ts_die from subshell
tests: ts_scsi_debug_init() sleeps a bit earlier
tests: fix cramfs/mkfs for BE and different pagesizes
If the ctl->hdr is just checked not to be NULL syslog message will not
have valid header, so generating such is not optional when reading
message from stdin and writing it to remote destination.
Reviewed-by: Bernhard Voelker <mail@bernhard-voelker.de> Signed-off-by: Patrick Plagwitz <patrick.plagwitz@fau.de> Signed-off-by: Sami Kerola <kerolasa@iki.fi>
Karel Zak [Fri, 3 Apr 2015 09:44:24 +0000 (11:44 +0200)]
wall: do not use a temporary file.
The issue with using a temporary file in wall is that wall runs as setgid.
This means that an unprivileged user who runs wall can modify wall's
temporary files, even if those are mode 0600, so the unprivileged user can
edit and effectively suppress the banner. The fix is to simply not use
temporary files.
Ondrej Oprala [Fri, 20 Feb 2015 08:41:19 +0000 (09:41 +0100)]
cfdisk: provide extra partinfo with "x"
The new 'extra' info provides:
* filesystem information from libblkid (TYPE, UUID, LABEL)
This feature is based on libblkid ability to probe specified area
on the device. It allows to probe for filesystems although the
partition devices (e.g. /dev/sda2) does not exist. For example from
disk image:
# cfdisk /home/archive/fs-images/disk.img
* additional information from libfdisk (partition UUID, Name, ...)
* mount information from libmount (from fstab or mountinfo)
Signed-off-by: Ondrej Oprala <ooprala@redhat.com> Signed-off-by: Karel Zak <kzak@redhat.com>
Co-Author: Karel Zak <kzak@redhat.com>