]> git.ipfire.org Git - thirdparty/util-linux.git/log
thirdparty/util-linux.git
9 years agofsck: use PATH or fallback to /sbin
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.

Signed-off-by: Karel Zak <kzak@redhat.com>
9 years agoswapon: search for mkswap via PATH
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.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
9 years agomkfs: drop hardcoded search path
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.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
9 years agohwclock: flush stdout in hwclock -c
Alexey Galakhov [Thu, 16 Apr 2015 15:26:27 +0000 (17:26 +0200)] 
hwclock: flush stdout in hwclock -c

This allows using hwclock -c in automated test scripts that parse
its output line-by-line. The standard output is flushed before
each 10 second delay.

Signed-off-by: Alexey Galakhov <agalakhov@gmail.com>
9 years agohwclock: Remove TZUTC
J William Piggott [Thu, 23 Apr 2015 23:53:58 +0000 (19:53 -0400)] 
hwclock: Remove TZUTC

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>
9 years agotest_uuidd: add comment
Karel Zak [Fri, 24 Apr 2015 15:09:17 +0000 (17:09 +0200)] 
test_uuidd: add comment

Signed-off-by: Karel Zak <kzak@redhat.com>
9 years agotest_uuidd: add pid, tid and idx back to object
Karel Zak [Fri, 24 Apr 2015 13:53:28 +0000 (15:53 +0200)] 
test_uuidd: add pid, tid and idx back to object

Signed-off-by: Karel Zak <kzak@redhat.com>
9 years agotest_uuidd: make objdump more robust
Karel Zak [Fri, 24 Apr 2015 13:01:23 +0000 (15:01 +0200)] 
test_uuidd: make objdump more robust

Signed-off-by: Karel Zak <kzak@redhat.com>
9 years agotest_uuidd: fix include
Karel Zak [Fri, 24 Apr 2015 12:54:09 +0000 (14:54 +0200)] 
test_uuidd: fix include

Signed-off-by: Karel Zak <kzak@redhat.com>
9 years agotest_uuidd: don't exit on failed pthread_create()
Karel Zak [Fri, 24 Apr 2015 12:47:49 +0000 (14:47 +0200)] 
test_uuidd: don't exit on failed pthread_create()

Signed-off-by: Karel Zak <kzak@redhat.com>
9 years agotest_uuidd: don't exit on failed pthread_create()
Karel Zak [Fri, 24 Apr 2015 12:47:09 +0000 (14:47 +0200)] 
test_uuidd: don't exit on failed pthread_create()

Signed-off-by: Karel Zak <kzak@redhat.com>
9 years agotest_uuidd: improve readability
Karel Zak [Fri, 24 Apr 2015 12:25:30 +0000 (14:25 +0200)] 
test_uuidd: improve readability

Signed-off-by: Karel Zak <kzak@redhat.com>
9 years agotest_uuidd: cleanup counters names
Karel Zak [Fri, 24 Apr 2015 11:39:17 +0000 (13:39 +0200)] 
test_uuidd: cleanup counters names

Signed-off-by: Karel Zak <kzak@redhat.com>
9 years agotest_uuidd: cleanup pid usage
Karel Zak [Fri, 24 Apr 2015 11:35:54 +0000 (13:35 +0200)] 
test_uuidd: cleanup pid usage

Signed-off-by: Karel Zak <kzak@redhat.com>
9 years agotest_uuidd: cleanup used types
Karel Zak [Fri, 24 Apr 2015 11:28:12 +0000 (13:28 +0200)] 
test_uuidd: cleanup used types

Signed-off-by: Karel Zak <kzak@redhat.com>
9 years agotest_uuidd: err messages, argv[] parsing and another cleanups
Karel Zak [Fri, 24 Apr 2015 10:40:51 +0000 (12:40 +0200)] 
test_uuidd: err messages, argv[] parsing and another cleanups

Signed-off-by: Karel Zak <kzak@redhat.com>
9 years agotests: add uuidd test program
Huschaam Hussain [Fri, 24 Apr 2015 09:28:47 +0000 (11:28 +0200)] 
tests: add uuidd test program

References: https://bugzilla.redhat.com/show_bug.cgi?id=678306
Signed-off-by: Karel Zak <kzak@redhat.com>
9 years agotests: fix sfdisk GPT test
Karel Zak [Thu, 23 Apr 2015 13:08:26 +0000 (15:08 +0200)] 
tests: fix sfdisk GPT test

The test uses too large last partition, libfdisk checks this problem
now.

Signed-off-by: Karel Zak <kzak@redhat.com>
9 years agolibfdisk: (gpt) add extra check for First/Last LBA
Karel Zak [Thu, 23 Apr 2015 10:32:36 +0000 (12:32 +0200)] 
libfdisk: (gpt) add extra check for First/Last LBA

Signed-off-by: Karel Zak <kzak@redhat.com>
9 years agotests: add sfdisk resize tests for GPT
Karel Zak [Thu, 23 Apr 2015 09:37:00 +0000 (11:37 +0200)] 
tests: add sfdisk resize tests for GPT

Signed-off-by: Karel Zak <kzak@redhat.com>
9 years agolibfdisk: (gpt) fix end sector calculation on resize
Karel Zak [Thu, 23 Apr 2015 09:34:05 +0000 (11:34 +0200)] 
libfdisk: (gpt) fix end sector calculation on resize

Signed-off-by: Karel Zak <kzak@redhat.com>
9 years agotests: add sfdisk resize regression tests for MBR
Karel Zak [Wed, 22 Apr 2015 15:15:39 +0000 (17:15 +0200)] 
tests: add sfdisk resize regression tests for MBR

Signed-off-by: Karel Zak <kzak@redhat.com>
9 years agolibfdisk: fix scriptk parser to support alone signs
Karel Zak [Wed, 22 Apr 2015 15:14:28 +0000 (17:14 +0200)] 
libfdisk: fix scriptk parser to support alone signs

for example echo "- - - *" | sfdisk /dev/sda1 -N1

Signed-off-by: Karel Zak <kzak@redhat.com>
9 years agolibfdisk: allow to move start to first usable LBA
Karel Zak [Wed, 22 Apr 2015 15:13:48 +0000 (17:13 +0200)] 
libfdisk: allow to move start to first usable LBA

Signed-off-by: Karel Zak <kzak@redhat.com>
9 years agolibfdisk: add warning to resize function
Karel Zak [Tue, 21 Apr 2015 13:51:45 +0000 (15:51 +0200)] 
libfdisk: add warning to resize function

Signed-off-by: Karel Zak <kzak@redhat.com>
9 years agolibfdisk: support resize operation in fdisk_set_partition()
Karel Zak [Tue, 21 Apr 2015 12:36:24 +0000 (14:36 +0200)] 
libfdisk: support resize operation in fdisk_set_partition()

Note that the resize is not exported by API yet, the only way to use
it is sfdisk-like scripts.

Signed-off-by: Karel Zak <kzak@redhat.com>
9 years agolibfdisk: add fdisk_table_get_partition_by_partno()
Karel Zak [Tue, 21 Apr 2015 12:35:18 +0000 (14:35 +0200)] 
libfdisk: add fdisk_table_get_partition_by_partno()

Signed-off-by: Karel Zak <kzak@redhat.com>
9 years agolibfdisk: fix script parser to support resize operations
Karel Zak [Tue, 21 Apr 2015 12:32:31 +0000 (14:32 +0200)] 
libfdisk: fix script parser to support resize operations

Signed-off-by: Karel Zak <kzak@redhat.com>
9 years agolibfdisk: don't resize in label drivers
Karel Zak [Tue, 21 Apr 2015 12:30:11 +0000 (14:30 +0200)] 
libfdisk: don't resize in label drivers

The resize operation has to be implemented on upper layer.

Signed-off-by: Karel Zak <kzak@redhat.com>
9 years agolibfdisk: (gpt) fix LE usage
Karel Zak [Wed, 22 Apr 2015 09:52:24 +0000 (11:52 +0200)] 
libfdisk: (gpt) fix LE usage

Signed-off-by: Karel Zak <kzak@redhat.com>
9 years agolib/strutils: fix string_add_to_idarray() int vs. size_t
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.

# sfdisk --list -o DEVICE,START,SIZE /dev/sdb
Disk /dev/sdb: 50 MiB, 52428800 bytes, 102400 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 32768 bytes
Disklabel type: gpt
Disk identifier: 3B8559DB-33AF-43E9-BEFC-C331D829B539
lt-sfdisk: libfdisk/src/label.c:178: fdisk_label_get_field: Assertion `id > 0' failed.

The patch cleanup all code to use size_t everywhere.

Signed-off-by: Karel Zak <kzak@redhat.com>
9 years agofdisk, sfdisk: fix -o <list> backend
Karel Zak [Wed, 22 Apr 2015 08:20:31 +0000 (10:20 +0200)] 
fdisk, sfdisk: fix -o <list> backend

Signed-off-by: Karel Zak <kzak@redhat.com>
9 years agoMerge branch 'tests-refactor-loop-cleanup' of https://github.com/rudimeier/util-linux
Karel Zak [Wed, 22 Apr 2015 08:03:12 +0000 (10:03 +0200)] 
Merge branch 'tests-refactor-loop-cleanup' of https://github.com/rudimeier/util-linux

* 'tests-refactor-loop-cleanup' of https://github.com/rudimeier/util-linux:
  tests: never use -o pipefail
  tests: loop tests, don't call ts_die() with DEVICE parameter
  tests: scsi_debug tests, don't call ts_die() with DEVICE parameter
  tests: introduce TS_LOOP_DEVS for cleanup
  tests: introduce ts_cleanup_on_exit()

9 years agoMerge branch 'test-fix' of https://github.com/rudimeier/util-linux
Karel Zak [Wed, 22 Apr 2015 07:56:47 +0000 (09:56 +0200)] 
Merge branch 'test-fix' of https://github.com/rudimeier/util-linux

9 years agotests: config.h lives in build directory
Ruediger Meier [Wed, 22 Apr 2015 06:05:47 +0000 (08:05 +0200)] 
tests: config.h lives in build directory

Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
9 years agohwclock: remove dead code
J William Piggott [Tue, 21 Apr 2015 20:46:23 +0000 (16:46 -0400)] 
hwclock: remove dead code

Removes never used #ifdef dead code.

Reported-by: Karel Zak <kzak@redhat.com>
Signed-off-by: J William Piggott <elseifthen@gmx.com>
9 years agohwclock: regression fix
J William Piggott [Tue, 21 Apr 2015 20:43:41 +0000 (16:43 -0400)] 
hwclock: regression fix

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>
9 years agotests: never use -o pipefail
Ruediger Meier [Tue, 21 Apr 2015 08:41:01 +0000 (10:41 +0200)] 
tests: never use -o pipefail

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.

Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
9 years agosfdisk: don't use BLKRRPART to check loopdev usage
Karel Zak [Fri, 17 Apr 2015 08:32:48 +0000 (10:32 +0200)] 
sfdisk: don't use BLKRRPART to check loopdev usage

It seesm that kernel always returns EINVAL for BLKRRPART on loop
devices, we call the ioctl to check if nobody else uses the device.

Signed-off-by: Karel Zak <kzak@redhat.com>
9 years agotests: add old dump for sfdisk
Karel Zak [Thu, 16 Apr 2015 16:01:32 +0000 (18:01 +0200)] 
tests: add old dump for sfdisk

Signed-off-by: Karel Zak <kzak@redhat.com>
9 years agosfdisk: accept empty partitions from dump
Karel Zak [Thu, 16 Apr 2015 15:40:28 +0000 (17:40 +0200)] 
sfdisk: accept empty partitions from dump

Old sfdisk uses:
  dev/sdc2 : start=        0, size=        0, Id= 0

for undefined MBR partitions. Let's follow this behaviour.

Reported-by: Ruediger Meier <sweet_f_a@gmx.de>
Signed-off-by: Karel Zak <kzak@redhat.com>
9 years agotests: fix logger device pathname too long
Ruediger Meier [Tue, 14 Apr 2015 12:54:52 +0000 (14:54 +0200)] 
tests: fix logger device pathname too long

$TS_OUTDIR may be too long for sockaddr_un.sun_path. Noticed on travis
in distcheck.

Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
9 years agotests: loop tests, don't call ts_die() with DEVICE parameter
Ruediger Meier [Tue, 31 Mar 2015 12:35:07 +0000 (14:35 +0200)] 
tests: loop tests, don't call ts_die() with DEVICE parameter

Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
9 years agotests: scsi_debug tests, don't call ts_die() with DEVICE parameter
Ruediger Meier [Tue, 31 Mar 2015 12:23:30 +0000 (14:23 +0200)] 
tests: scsi_debug tests, don't call ts_die() with DEVICE parameter

This was almost useless anyway.

Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
9 years agotests: introduce TS_LOOP_DEVS for cleanup
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.

Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
9 years agotests: introduce ts_cleanup_on_exit()
Ruediger Meier [Tue, 31 Mar 2015 08:54:56 +0000 (10:54 +0200)] 
tests: introduce ts_cleanup_on_exit()

ts_cleanup_on_exit() is always called on exit, e.g. after ts_skip,
ts_die, ts_finalize ...

A first usage example is the cleanup of TS_SUID_PROGS which is now also done
on ts_skip. Later we want to fix some left loop devices.

Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
9 years agoMerge branch 'tests-logger' of https://github.com/rudimeier/util-linux
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

9 years agounshare: allow persisting mount namespaces
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.

Signed-off-by: Karel Zak <kzak@redhat.com>
9 years agounshare: allow persisting namespaces
Karel Zak [Thu, 9 Apr 2015 09:34:02 +0000 (11:34 +0200)] 
unshare: allow persisting namespaces

For nsenter(1) we already support namespace specification by file
(e.g. bind mount to namespace /proc/[pid]/ns/[type] file). For
example:

  # nsenter --uts=/some/path

This patch extends unshare(1) to setup the bind mount for specified
namespace, for example

  # touch /some/path
  # unshare --uts=/some/path hostname FOO
  # nsenter --uts=/some/path hostname
  FOO

Note that the problem is mount namespace, because create bind mount
to ns/mount file within unshared namespace does not make sense.

Based on patch from Lubomir Rintel <lkundrak@v3.sk>.

Signed-off-by: Karel Zak <kzak@redhat.com>
9 years agolib/sysfs.c: use fcntl(..F_DUPFD_CLOEXEC) instead of dup(2)
Cristian Rodríguez [Fri, 10 Apr 2015 18:57:58 +0000 (15:57 -0300)] 
lib/sysfs.c: use fcntl(..F_DUPFD_CLOEXEC) instead of dup(2)

"The two descriptors do not share file descriptor flags (the
close-on-exec flag).  The close-on-exec flag  for the duplicate descriptor is off"

9 years agotests: make libmount python context tests sensitive to USE_LIBMOUNT_FORCE_MOUNTINFO
Karel Zak [Tue, 14 Apr 2015 09:26:54 +0000 (11:26 +0200)] 
tests: make libmount python context tests sensitive to USE_LIBMOUNT_FORCE_MOUNTINFO

Signed-off-by: Karel Zak <kzak@redhat.com>
9 years agotests: make libmount context tests sensitive to USE_LIBMOUNT_FORCE_MOUNTINFO
Karel Zak [Tue, 14 Apr 2015 09:26:54 +0000 (11:26 +0200)] 
tests: make libmount context tests sensitive to USE_LIBMOUNT_FORCE_MOUNTINFO

Signed-off-by: Karel Zak <kzak@redhat.com>
9 years agofdisk: fix typo
Karel Zak [Mon, 13 Apr 2015 16:11:38 +0000 (18:11 +0200)] 
fdisk: fix typo

Signed-off-by: Karel Zak <kzak@redhat.com>
9 years agofdisk: add --protect-boot
Karel Zak [Mon, 13 Apr 2015 15:24:45 +0000 (17:24 +0200)] 
fdisk: add --protect-boot

Now fdisk erases the begin of the device when create a new disk label, it seems
like disadvantage for some use-cases.

Reported-by: Jean-Loup 'clippix' Bogalho <clippix@lse.epita.fr>
Signed-off-by: Karel Zak <kzak@redhat.com>
9 years agotravis: install socat >= 1.7.2
Ruediger Meier [Mon, 13 Apr 2015 11:29:26 +0000 (13:29 +0200)] 
travis: install socat >= 1.7.2

Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
9 years agotests: add subtests for invalid logger devive
Ruediger Meier [Fri, 10 Apr 2015 06:28:26 +0000 (08:28 +0200)] 
tests: add subtests for invalid logger devive

Note --journald should not complain about invalid sockets.

Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
9 years agotests: logger/errors does not use --no-act
Ruediger Meier [Thu, 9 Apr 2015 18:14:51 +0000 (20:14 +0200)] 
tests: logger/errors does not use --no-act

Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
9 years agosfdisk: enable bootbits protection
Karel Zak [Mon, 13 Apr 2015 11:41:10 +0000 (13:41 +0200)] 
sfdisk: enable bootbits protection

Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=1210428
Signed-off-by: Karel Zak <kzak@redhat.com>
9 years agolibfdisk: support bootbits protection from (p)MBR
Karel Zak [Mon, 13 Apr 2015 11:40:25 +0000 (13:40 +0200)] 
libfdisk: support bootbits protection from (p)MBR

Signed-off-by: Karel Zak <kzak@redhat.com>
9 years agotests: logger, validate written socket data
Ruediger Meier [Thu, 9 Apr 2015 18:14:50 +0000 (20:14 +0200)] 
tests: logger, validate written socket data

Actually there should be no data written to the socket because
we are always using --no-act.

Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
9 years agotests: logger with socat device
Ruediger Meier [Thu, 9 Apr 2015 15:12:34 +0000 (17:12 +0200)] 
tests: logger with socat device

Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
9 years agosfdisk: improve -N warnings
Karel Zak [Mon, 13 Apr 2015 10:08:50 +0000 (12:08 +0200)] 
sfdisk: improve -N warnings

Signed-off-by: Karel Zak <kzak@redhat.com>
9 years agotests: add sfdisk resize tests
Karel Zak [Mon, 13 Apr 2015 08:56:03 +0000 (10:56 +0200)] 
tests: add sfdisk resize tests

Signed-off-by: Karel Zak <kzak@redhat.com>
9 years agotests: require wipefs for sfdisk/gpt
Karel Zak [Mon, 13 Apr 2015 08:35:51 +0000 (10:35 +0200)] 
tests: require wipefs for sfdisk/gpt

Signed-off-by: Karel Zak <kzak@redhat.com>
9 years agolibfdisk: (dos) retain existing boot flag when resizing a partition
Karel Zak [Mon, 13 Apr 2015 08:29:00 +0000 (10:29 +0200)] 
libfdisk: (dos)  retain existing boot flag when resizing a partition

Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=1210912
Signed-off-by: Karel Zak <kzak@redhat.com>
Co-Author:  awilliam@redhat.com

9 years agotests: simplify common logger options
Ruediger Meier [Thu, 9 Apr 2015 15:00:26 +0000 (17:00 +0200)] 
tests: simplify common logger options

Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
9 years agologger: --stderr and --no-act turn "auto-errors" on
Ruediger Meier [Thu, 26 Mar 2015 13:20:29 +0000 (14:20 +0100)] 
logger: --stderr and --no-act turn "auto-errors" on

Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
9 years agolibfdisk: recognize FAT32 partitions hidden by Acronis software
Jörg Jenderek [Wed, 8 Apr 2015 08:24:26 +0000 (10:24 +0200)] 
libfdisk: recognize FAT32 partitions hidden by Acronis software

References: http://www.acronis.de/products/trueimage
Signed-off-by: Karel Zak <kzak@redhat.com>
Signed-off-by: Jörg Jenderek <joerg.jen.der.ek@gmx.net>
9 years agoMerge branch 'fix-last' of https://github.com/rudimeier/util-linux
Karel Zak [Tue, 7 Apr 2015 13:22:22 +0000 (15:22 +0200)] 
Merge branch 'fix-last' of https://github.com/rudimeier/util-linux

* 'fix-last' of https://github.com/rudimeier/util-linux:
  last, fix race when comparing time stamps
  last: fix first (current) runlevel line

9 years agocal: add -Y and -n <num>
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>
9 years agoMerge branch 'test-fixes' of https://github.com/rudimeier/util-linux
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

9 years agoMerge branch 'fix-tinfo-typo' of https://github.com/rudimeier/util-linux
Karel Zak [Tue, 7 Apr 2015 10:31:55 +0000 (12:31 +0200)] 
Merge branch 'fix-tinfo-typo' of https://github.com/rudimeier/util-linux

* 'fix-tinfo-typo' of https://github.com/rudimeier/util-linux:
  build-sys: typo -ltinfo

9 years agowhereis: trivial spelling and grammar fix
Mike Place [Tue, 7 Apr 2015 08:44:50 +0000 (10:44 +0200)] 
whereis: trivial spelling and grammar fix

Signed-off-by: Karel Zak <kzak@redhat.com>
9 years agologger: fix memory leaks
Sami Kerola [Tue, 7 Apr 2015 07:58:19 +0000 (08:58 +0100)] 
logger: fix memory leaks

Reported-by: Patrick Plagwitz <patrick.plagwitz@fau.de>
Signed-off-by: Sami Kerola <sami.kerola@lastminute.com>
9 years agologger: generate header when reading message from stdin
Patrick Plagwitz [Mon, 6 Apr 2015 21:50:46 +0000 (22:50 +0100)] 
logger: generate header when reading message from stdin

This change fixes crashing error, that ought not to be simply avoided.

$ echo foo | logger -n localhost
Segmentation fault (core dumped)

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>
9 years agowall: do not use a temporary file.
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.

[kzak@redhat.com: - rewrite growing string functions
                  - use struct buffer
                  - add buf_print() function]

Signed-off-by: Karel Zak <kzak@redhat.com>
Co-Author: Jann Horn <jann@thejh.net>

9 years agolibmount: add note about flock() to docs
Karel Zak [Thu, 2 Apr 2015 10:30:26 +0000 (12:30 +0200)] 
libmount: add note about flock() to docs

Signed-off-by: Karel Zak <kzak@redhat.com>
9 years agotests: mount/rlimit tries to restore mtab
Ruediger Meier [Thu, 2 Apr 2015 09:35:29 +0000 (11:35 +0200)] 
tests: mount/rlimit tries to restore mtab

Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
9 years agotests: fix, don't call ts_die from subshell
Ruediger Meier [Tue, 31 Mar 2015 14:07:37 +0000 (16:07 +0200)] 
tests: fix, don't call ts_die from subshell

Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
9 years agotests: ts_scsi_debug_init() sleeps a bit earlier
Ruediger Meier [Sat, 28 Mar 2015 14:32:30 +0000 (15:32 +0100)] 
tests: ts_scsi_debug_init() sleeps a bit earlier

Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
9 years agotests: fix cramfs/mkfs for BE and different pagesizes
Ruediger Meier [Sat, 28 Mar 2015 11:34:43 +0000 (12:34 +0100)] 
tests: fix cramfs/mkfs for BE and different pagesizes

Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
9 years agolsblk: don't ignore dependences for partitioned devies
Karel Zak [Wed, 1 Apr 2015 10:23:23 +0000 (12:23 +0200)] 
lsblk: don't ignore dependences for partitioned devies

The code only lists partitions, but ignore another dependencies
on whole-disk device:

$ lsblk /dev/sdb
NAME   MAJ:MIN RM   SIZE RO TYPE MOUNTPOINT
sdb      8:16   0 298.1G  0 disk
└─sdb1   8:17   0 298.1G  0 part

$ ls /sys/block/sdb/holders/
dm-0

fixed version:

$ lsblk /dev/sdb
NAME        MAJ:MIN RM   SIZE RO TYPE  MOUNTPOINT
sdb           8:16   0 298.1G  0 disk
├─sdb1        8:17   0 298.1G  0 part
└─mpatha    253:0    0 298.1G  0 mpath
  └─mpatha1 253:1    0 298.1G  0 part

Signed-off-by: Karel Zak <kzak@redhat.com>
9 years agolsblk: follow kernel for inverse tree
Karel Zak [Wed, 1 Apr 2015 10:06:41 +0000 (12:06 +0200)] 
lsblk: follow kernel for inverse tree

For multi-path devices kernel defines dependence between the device
and whole-list:

$ ls /sys/block/dm-0/slaves/
sdb

but lsblk inserts partition into the tree:

$ lsblk -s -oNAME,KNAME /dev/dm-1
mpatha1   dm-1
└─mpatha  dm-0
  └─sdb1  sdb1     <--- !
    └─sdb sdb

Signed-off-by: Karel Zak <kzak@redhat.com>
9 years agolsblk: add debug support
Karel Zak [Wed, 1 Apr 2015 10:06:15 +0000 (12:06 +0200)] 
lsblk: add debug support

Signed-off-by: Karel Zak <kzak@redhat.com>
9 years agocfdisk: cleanup extra partitions info for slang
Karel Zak [Tue, 31 Mar 2015 11:10:17 +0000 (13:10 +0200)] 
cfdisk: cleanup extra partitions info for slang

The patch removes problem with getch() on slang, now the code is based
on subwin() and extra info window is persistent.

A new problem is that slang does not keep sub-window border
persistent. I'm going to ignore this slang problem... use ncurses
dude!

Signed-off-by: Karel Zak <kzak@redhat.com>
9 years agobuild-sys: define cfdisk dependence on open_memstream
Karel Zak [Mon, 30 Mar 2015 11:54:08 +0000 (13:54 +0200)] 
build-sys: define cfdisk dependence on open_memstream

Signed-off-by: Karel Zak <kzak@redhat.com>
9 years agomount: fix lazytime docs
Karel Zak [Mon, 30 Mar 2015 10:52:22 +0000 (12:52 +0200)] 
mount: fix lazytime docs

Signed-off-by: Karel Zak <kzak@redhat.com>
9 years agolibmount: add support for MS_LAZYTIME
Karel Zak [Mon, 30 Mar 2015 10:43:45 +0000 (12:43 +0200)] 
libmount: add support for MS_LAZYTIME

Signed-off-by: Karel Zak <kzak@redhat.com>
9 years agosetarch: fix regression for sparc builds
Waldemar Brodkorb [Sun, 29 Mar 2015 13:00:30 +0000 (15:00 +0200)] 
setarch: fix regression for sparc builds

With following commit:
5edb0ea6bbd57dd916417737f98c9109dc1ecb5b

Sparc cross-compile fails.

Signed-off-by: Waldemar Brodkorb <wbx@openadk.org>
9 years agobuild-sys: typo -ltinfo
Ruediger Meier [Sat, 28 Mar 2015 10:23:53 +0000 (11:23 +0100)] 
build-sys: typo -ltinfo

Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
9 years agosfdisk: cleanup prompt usage
Karel Zak [Fri, 27 Mar 2015 14:04:58 +0000 (15:04 +0100)] 
sfdisk: cleanup prompt usage

Let's use fgets-like callback only when compiled with readline,
otherwise (and also for non-tty) print prompt by printf().

Reported-by: Ruediger Meier <sweet_f_a@gmx.de>
Signed-off-by: Karel Zak <kzak@redhat.com>
9 years agocfdisk: provide extra partinfo with "x"
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>

9 years agolibfdisk: don't return empty strings from fdisk_partition_to_string()
Karel Zak [Fri, 27 Mar 2015 12:47:13 +0000 (13:47 +0100)] 
libfdisk: don't return empty strings from fdisk_partition_to_string()

Signed-off-by: Karel Zak <kzak@redhat.com>
9 years agobuild-sys: add HAVE_LIBMOUNT
Karel Zak [Fri, 27 Mar 2015 12:46:15 +0000 (13:46 +0100)] 
build-sys: add HAVE_LIBMOUNT

Signed-off-by: Karel Zak <kzak@redhat.com>
9 years agobuild-sys: add TINFO_LIBS_STATIC
Karel Zak [Fri, 27 Mar 2015 09:32:24 +0000 (10:32 +0100)] 
build-sys: add TINFO_LIBS_STATIC

and use this variable for $READLINE_LIBS_STATIC.

Note the patch also moves READLINE checks after TINFO check.

Signed-off-by: Karel Zak <kzak@redhat.com>
9 years agobuild-sys: fix READLINE_LIBS_STATIC usage for fdisk
Karel Zak [Thu, 26 Mar 2015 18:05:11 +0000 (19:05 +0100)] 
build-sys: fix READLINE_LIBS_STATIC usage for fdisk

Signed-off-by: Karel Zak <kzak@redhat.com>
9 years agosfdisk: fix -a vs. -A bug
Karel Zak [Thu, 26 Mar 2015 17:21:53 +0000 (18:21 +0100)] 
sfdisk: fix -a vs. -A bug

The -A has been originally used for --activate, since v2.26 it's used
for --append. This is stupid mistake. This patch reverts the change to:

 -A, --activate
 -a, --append

Note that --append is a new command line option in v2.26.

Addresses: https://bugs.archlinux.org/task/44349
Signed-off-by: Karel Zak <kzak@redhat.com>
9 years agodocs: document --exclude for tests
Karel Zak [Thu, 26 Mar 2015 12:00:24 +0000 (13:00 +0100)] 
docs: document --exclude for tests

Signed-off-by: Karel Zak <kzak@redhat.com>
9 years agotests: add documentation about environment variables
Ruediger Meier [Wed, 25 Mar 2015 11:09:36 +0000 (12:09 +0100)] 
tests: add documentation about environment variables

Introduced in 8e3ac29e, now advertised :)

Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
9 years agotests: verify logger return value
Ruediger Meier [Tue, 24 Mar 2015 18:37:01 +0000 (19:37 +0100)] 
tests: verify logger return value

Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>