]> git.ipfire.org Git - thirdparty/util-linux.git/log
thirdparty/util-linux.git
10 years agoscript: add struct script_control and remove global variables
Sami Kerola [Sat, 20 Dec 2014 01:05:49 +0000 (01:05 +0000)] 
script: add struct script_control and remove global variables

Fix also couple indentation issues.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
10 years agoscript: remove function prototypes
Sami Kerola [Sat, 20 Dec 2014 00:02:42 +0000 (00:02 +0000)] 
script: remove function prototypes

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
10 years agotests: check script options work as expected
Sami Kerola [Sun, 24 May 2015 17:14:58 +0000 (18:14 +0100)] 
tests: check script options work as expected

Options --flush and --timing remain unchecked, as I do not have an idea
how to check them reliably.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
10 years agotests: add script output buffering race check
Sami Kerola [Sun, 24 May 2015 16:48:05 +0000 (17:48 +0100)] 
tests: add script output buffering race check

Regression check to a fix by Stanislav Brabec.

Reference: 0b285b84b2f14339fd86857244654ba25fac7d73
CC: Stanislav Brabec <sbrabec@suse.cz>
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
10 years agolibsmartcols: keep JSON field names lower-case
Karel Zak [Fri, 5 Jun 2015 09:58:42 +0000 (11:58 +0200)] 
libsmartcols: keep JSON field names lower-case

Signed-off-by: Karel Zak <kzak@redhat.com>
10 years agolslocks: add --json
Karel Zak [Fri, 5 Jun 2015 08:45:15 +0000 (10:45 +0200)] 
lslocks: add --json

Signed-off-by: Karel Zak <kzak@redhat.com>
10 years agolosetup: add --json
Karel Zak [Fri, 5 Jun 2015 08:30:52 +0000 (10:30 +0200)] 
losetup: add --json

Signed-off-by: Karel Zak <kzak@redhat.com>
10 years agofindmnt: add --json
Karel Zak [Fri, 5 Jun 2015 07:47:59 +0000 (09:47 +0200)] 
findmnt: add --json

Signed-off-by: Karel Zak <kzak@redhat.com>
10 years agolsblk: add --json
Karel Zak [Thu, 4 Jun 2015 13:49:52 +0000 (15:49 +0200)] 
lsblk: add --json

Signed-off-by: Karel Zak <kzak@redhat.com>
10 years agolibsmartcols: add JSON output format
Karel Zak [Thu, 4 Jun 2015 13:47:21 +0000 (15:47 +0200)] 
libsmartcols: add JSON output format

Signed-off-by: Karel Zak <kzak@redhat.com>
10 years agolibmount: (docs) fix wording
Ronny Chevalier [Wed, 3 Jun 2015 11:21:52 +0000 (13:21 +0200)] 
libmount: (docs) fix wording

Signed-off-by: Ronny Chevalier <chevalier.ronny@gmail.com>
10 years agolibmount: (docs) fix typo
Ronny Chevalier [Wed, 3 Jun 2015 11:06:59 +0000 (13:06 +0200)] 
libmount: (docs) fix typo

Signed-off-by: Ronny Chevalier <chevalier.ronny@gmail.com>
10 years agolosetup: print more usable error message on failed -f
Karel Zak [Wed, 3 Jun 2015 10:05:09 +0000 (12:05 +0200)] 
losetup: print more usable error message on failed -f

Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=1215370
Signed-off-by: Karel Zak <kzak@redhat.com>
10 years agolibmount: do not call umount helper on --fake
Karel Zak [Wed, 3 Jun 2015 08:59:35 +0000 (10:59 +0200)] 
libmount: do not call umount helper on --fake

The umount.<type> helpers does not support --fake option and it does
not make sense to call the helpers at all. All we need is to remove
mtab/utab entries.

Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=1172297
Signed-off-by: Karel Zak <kzak@redhat.com>
10 years agolscpu: add warning for __SANITIZE_ADDRESS__
Karel Zak [Tue, 2 Jun 2015 12:52:56 +0000 (14:52 +0200)] 
lscpu: add warning for __SANITIZE_ADDRESS__

Signed-off-by: Karel Zak <kzak@redhat.com>
10 years agosys-utils: lscpu segfaults when built with -fsanitize=address
Cristian Rodríguez [Sat, 30 May 2015 18:51:41 +0000 (15:51 -0300)] 
sys-utils: lscpu segfaults when built with -fsanitize=address

This is expected and a false positive, exclude the vmware detection
trick when __SANITIZE_ADDRESS__ is defined.

10 years agolsblk.8: Fix description of output format
Stanislav Brabec [Thu, 28 May 2015 15:41:39 +0000 (17:41 +0200)] 
lsblk.8: Fix description of output format

Signed-off-by: Stanislav Brabec <sbrabec@suse.cz>
10 years agolibmount: fix mnt_monitor_event_cleanup()
Karel Zak [Mon, 1 Jun 2015 11:17:41 +0000 (13:17 +0200)] 
libmount: fix mnt_monitor_event_cleanup()

We have to call epoll to drain mountinfo events too. The problem is
visible if the monitor epoll FD is within another (top-level) epoll.

Signed-off-by: Karel Zak <kzak@redhat.com>
10 years agolsblk: use internally sysfs devnames
Karel Zak [Fri, 29 May 2015 08:55:01 +0000 (10:55 +0200)] 
lsblk: use internally sysfs devnames

It seems better to keep the strange sysfs devnames internally and
translate to real devnames only on output or when we read from /dev.

Signed-off-by: Karel Zak <kzak@redhat.com>
10 years agodocs: fix gtk-docs related warnings
Karel Zak [Thu, 28 May 2015 10:28:23 +0000 (12:28 +0200)] 
docs: fix gtk-docs related warnings

Signed-off-by: Karel Zak <kzak@redhat.com>
10 years agolib/sysfs: rename devname functions, cleanup
Karel Zak [Thu, 28 May 2015 10:09:41 +0000 (12:09 +0200)] 
lib/sysfs: rename devname functions, cleanup

Well, I don't have mental power to use function names like

 sysfs_devname_to_dev_name()

so this patch renames to

 sysfs_devname_sys_to_dev()
 sysfs_devname_dev_to_sys()

It also cleanups usage of the functions. We have to be sure that
sysfs.c code returns regular devnames. The existence of the sysfs
devnames (with '!') should be completely hidden in sysfs specific
code.

Signed-off-by: Karel Zak <kzak@redhat.com>
10 years agolib/sysfs: Fix /dev to /sys node name translation
Stanislav Brabec [Wed, 27 May 2015 13:12:08 +0000 (15:12 +0200)] 
lib/sysfs: Fix /dev to /sys node name translation

d0dc6c1 introduced translation of /sys names to /dev names, as required
by the kernel linux/drivers/base/core.c: device_get_devnode(). But there
are other places of code that use /dev names in /sys. They need reverse
translation from '/' to '!'.

For example, fdisk -l returns empty list since a22c6eb for device nodes
in subdirectories (used e. g. by cciss driver).

Introduce yet another helper sysfs_dev_name_to_devname() and use it where
appropriate.

Signed-off-by: Stanislav Brabec <sbrabec@suse.cz>
10 years agolibfdisk: Use predictable /dev/mapper partition names for /dev/dm-N
Stanislav Brabec [Tue, 26 May 2015 15:59:29 +0000 (17:59 +0200)] 
libfdisk: Use predictable /dev/mapper partition names for /dev/dm-N

It is impossible to predict /dev/dm-N partition names. Use predictable
and better readable /dev/mapper names instead.

[kzak@redhat.com: - remove if-before-free]

Signed-off-by: Stanislav Brabec <sbrabec@suse.cz>
Signed-off-by: Karel Zak <kzak@redhat.com>
10 years agoUse correct partition names for /dev/mapper
Stanislav Brabec [Mon, 25 May 2015 19:17:52 +0000 (21:17 +0200)] 
Use correct partition names for /dev/mapper

The default configuration of multipath-tools appends "-partN" to
partition nodes. Follow this conventions and do the same.

It fixes for example fdisk -l /dev/mapper/name_of_the_device.

Note that the current implementation only partially fixes the problem. It
does not reflect any udev configuration changes, as udev does not provide
any function to return names of future (or current) partitions of a
particular device. It also does not fix fdisk -l /dev/dm-0.

Signed-off-by: Stanislav Brabec <sbrabec@suse.cz>
10 years agoFix /sys to /dev node name translation
Stanislav Brabec [Mon, 25 May 2015 16:21:36 +0000 (18:21 +0200)] 
Fix /sys to /dev node name translation

linux/drivers/base/core.c: device_get_devnode() defines a translation of
'!' in sysfs nodes to '/' in /dev nodes. The same translation has to be
done to properly support device nodes with slash (e. g. device nodes of
cciss driver and several other drivers).

Introduce new helper sysfs_devname_to_devno() and use it where
appropriate.

Fixes for example lsblk -f on devices using cciss driver.

Signed-off-by: Stanislav Brabec <sbrabec@suse.cz>
10 years agohwclock: don't allow non-root access
Karel Zak [Tue, 26 May 2015 08:32:38 +0000 (10:32 +0200)] 
hwclock: don't allow non-root access

Fortunately very few people are crazy enough to install hwclock as
setuid. Some comments in code and unfortunately also man page
advertising that setuid is no problem. That's pretty stupid promise.

The code quality is poor and it's obviously not designed to be secure
(things like popen() without drop privileges, etc.).

This patch removes all notes about "setuid support" and for sure
disable hwclock execution for non-root users.

Addresses: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=786804
Signed-off-by: Karel Zak <kzak@redhat.com>
10 years agosulogin: don't use strcpy(), enlarge pwd line buffer
Karel Zak [Mon, 25 May 2015 13:24:13 +0000 (15:24 +0200)] 
sulogin: don't use strcpy(), enlarge pwd line buffer

* according to "man getpwnam" 16384 bytes is enough to store one
  passwd entry (let's use 2*BUFSIZE to avoid magic numbers in code)

* don't use strcpy() to set empty password

Signed-off-by: Karel Zak <kzak@redhat.com>
10 years agobuild-sys: add --without-* for all libs
Karel Zak [Fri, 22 May 2015 10:43:33 +0000 (12:43 +0200)] 
build-sys: add --without-* for all libs

It's necessary for people who want to compile util-linux in very
unusual environment and disable as much as possible dependencies.
For example distro bootstrap.

References: https://bugzilla.redhat.com/show_bug.cgi?id=1223894
Signed-off-by: Karel Zak <kzak@redhat.com>
10 years agoblkid: another hint to the man page
Karel Zak [Thu, 21 May 2015 11:13:49 +0000 (13:13 +0200)] 
blkid: another hint to the man page

Signed-off-by: Karel Zak <kzak@redhat.com>
10 years agoblkid: be more precise in the man page
Karel Zak [Thu, 21 May 2015 10:37:18 +0000 (12:37 +0200)] 
blkid: be more precise in the man page

Signed-off-by: Karel Zak <kzak@redhat.com>
10 years agoblkid: don't ignore info about partitions on non-formated devices
Karel Zak [Thu, 21 May 2015 10:14:32 +0000 (12:14 +0200)] 
blkid: don't ignore info about partitions on non-formated devices

 # blkid -p /dev/sdc1; echo $?
 2

but libblkid provides information about partition, fixed version:

 # blkid -p /dev/sdc1; echo $?
 /dev/sdc1: PART_ENTRY_SCHEME="dos" PART_ENTRY_UUID="4c1e518c-01" PART_ENTRY_TYPE="0x83" PART_ENTRY_NUMBER="1" PART_ENTRY_OFFSET="2048" PART_ENTRY_SIZE="1021952" PART_ENTRY_DISK="8:32"
 0

Signed-off-by: Karel Zak <kzak@redhat.com>
10 years agodocs: update TODO
Karel Zak [Tue, 19 May 2015 12:40:42 +0000 (14:40 +0200)] 
docs: update TODO

Signed-off-by: Karel Zak <kzak@redhat.com>
10 years agobuild-sys: support unshare.static
Georg Schiesser [Tue, 5 May 2015 11:19:51 +0000 (13:19 +0200)] 
build-sys: support unshare.static

This patch adds support for building a static version of unshare.
We need to add unshare to the list of possible static programs, and
provide build flags for the compiler and linker, which are equivalent to
the flags of the non-static program, except additional static linking.
See also: commit 2fa60c5 build-sys: support nsenter.static

Signed-off-by: Georg Schiesser <georg.schiesser@opentech.at>
10 years agocal: fix January 1753 week number printout
Sami Kerola [Sun, 17 May 2015 17:27:42 +0000 (18:27 +0100)] 
cal: fix January 1753 week number printout

Earlier output was clearly broken.

$ cal -w 1 1753
      January 1753
   Su Mo Tu We Th Fr Sa
51     1  2  3  4  5  6
52  7  8  9 10 11 12 13
52 14 15 16 17 18 19 20
52 21 22 23 24 25 26 27
52 28 29 30 31

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
10 years agozramctl: add MEM-LIMIT, MEM-USED and MIGRATED columns
Karel Zak [Mon, 18 May 2015 09:30:56 +0000 (11:30 +0200)] 
zramctl: add MEM-LIMIT, MEM-USED and MIGRATED columns

Signed-off-by: Karel Zak <kzak@redhat.com>
10 years agozramctl: support /sys/block/zram<id>/mm_stat
Karel Zak [Mon, 18 May 2015 09:13:44 +0000 (11:13 +0200)] 
zramctl: support /sys/block/zram<id>/mm_stat

Linux >= 4.1 provides all memory related statistics by one file.

Signed-off-by: Karel Zak <kzak@redhat.com>
10 years agolib/strv: add new functions (from systemd)
Karel Zak [Fri, 15 May 2015 12:57:04 +0000 (14:57 +0200)] 
lib/strv: add new functions (from systemd)

Signed-off-by: Karel Zak <kzak@redhat.com>
10 years agoscript: Fix mangled EOF and hang on big endian
Stanislav Brabec [Thu, 14 May 2015 15:55:56 +0000 (17:55 +0200)] 
script: Fix mangled EOF and hang on big endian

On s390 and other big endian machines, doinput() sends NUL instead of
EOF to the tty master. NUL does not even reach the slave, and it is
waiting for more data forever.

If STDIN is not a tty, the bug caused "^@" being into the log, and since
commit 032228c it also causes hang.

Signed-off-by: Stanislav Brabec <sbrabec@suse.cz>
10 years agoMerge branch 'test-fixes' of https://github.com/rudimeier/util-linux
Karel Zak [Wed, 13 May 2015 13:08:04 +0000 (15:08 +0200)] 
Merge branch 'test-fixes' of https://github.com/rudimeier/util-linux

* 'test-fixes' of https://github.com/rudimeier/util-linux:
  tests: fix kill/all_processes
  tests: add $top_builddir to $PATH

10 years agotests: update lscpu tests (due to CPU flags in output)
Karel Zak [Wed, 13 May 2015 13:06:22 +0000 (15:06 +0200)] 
tests: update lscpu tests (due to CPU flags in output)

Signed-off-by: Karel Zak <kzak@redhat.com>
10 years agolscpu: add cpu flags entry to summary output
WANG Chao [Wed, 13 May 2015 03:15:05 +0000 (11:15 +0800)] 
lscpu: add cpu flags entry to summary output

It'd be convenient to have unified cpu "Flags: " entry in the summary
output.

Signed-off-by: WANG Chao <wcwxyz@gmail.com>
10 years agolibfdisk: keep FDISK_FIELD_CYLINDERS independent on context mode
Karel Zak [Mon, 11 May 2015 11:01:26 +0000 (13:01 +0200)] 
libfdisk: keep FDISK_FIELD_CYLINDERS independent on context mode

Signed-off-by: Karel Zak <kzak@redhat.com>
10 years agofdisk: provide more information by 'i'nfo command
Karel Zak [Mon, 11 May 2015 10:45:21 +0000 (12:45 +0200)] 
fdisk: provide more information by 'i'nfo command

Signed-off-by: Karel Zak <kzak@redhat.com>
10 years agolibfdisk: add fdisk_label_get_fields_ids_all()
Karel Zak [Mon, 11 May 2015 10:42:24 +0000 (12:42 +0200)] 
libfdisk: add fdisk_label_get_fields_ids_all()

The current fdisk_label_get_fields_ids() is too smart as it
differentiate between details mode etc. It's useful for default
output, but in some cases it's better to provide all output fields.

Signed-off-by: Karel Zak <kzak@redhat.com>
10 years agofdisk: add the 'i'nfo command
Jean-Loup 'clippix' Bogalho [Sat, 9 May 2015 21:15:23 +0000 (23:15 +0200)] 
fdisk: add the 'i'nfo command

Add the 'i'nfo command to fdisk that prints details about a specific partition.
Details are everything the function 'fdisk_label_get_field' can return.

Signed-off-by: Jean-Loup 'clippix' Bogalho <clippix@lse.epita.fr>
10 years agotests: add hexdump from GPT
Karel Zak [Mon, 11 May 2015 10:18:12 +0000 (12:18 +0200)] 
tests: add hexdump from GPT

* use hardcoded UUIDs for partitions in sfdisk GPT test
* output hexdump of the GPT header (it would be possible to use MD5
  sum, but from hexdump it's more obvious where is problem)

Signed-off-by: Karel Zak <kzak@redhat.com>
10 years agolibfdisk: (gpt) fix attributes endianess
Ruediger Meier [Fri, 8 May 2015 11:39:53 +0000 (13:39 +0200)] 
libfdisk: (gpt) fix attributes endianess

The new libfdisk/gpt test (4a4a0927) discovered that we read and write
partition attributes wrongly on BE systems.

Our temporarily used char[8] bits are always LE and do not need to be
converted.

CC: Michael Marineau <michael.marineau@coreos.com>
Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
10 years agotests: fix kill/all_processes
Ruediger Meier [Thu, 7 May 2015 13:20:47 +0000 (15:20 +0200)] 
tests: fix kill/all_processes

We have to wait for the killed helper.

Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
10 years agotests: add $top_builddir to $PATH
Ruediger Meier [Mon, 13 Apr 2015 13:51:02 +0000 (15:51 +0200)] 
tests: add $top_builddir to $PATH

Since we have dropped some more hardcoded search paths we should
make sure that our tested binaries would use the right helpers
from our build directory.

See 07b51567 and follow-up commits.

Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
10 years agoRevert "travise: try to add coverity_scan"
Karel Zak [Wed, 6 May 2015 14:43:35 +0000 (16:43 +0200)] 
Revert "travise: try to add coverity_scan"

This reverts commit 3053e14997194849b17a7dae3d4a0366a52c6b45.

10 years agotravise: try to add coverity_scan
Karel Zak [Wed, 6 May 2015 14:16:17 +0000 (16:16 +0200)] 
travise: try to add coverity_scan

Signed-off-by: Karel Zak <kzak@redhat.com>
10 years agoflock: NULL deref
Brad Forschinger [Tue, 5 May 2015 01:51:24 +0000 (11:51 +1000)] 
flock: NULL deref

cmd_argv[2] will be initialised only if it's specificed with -c.  NULL
deref otherwise resulting in crash.

Signed-off-by: Brad Forschinger <bnjf@bnjf.id.au>
10 years agobuild-sys: fix parallel builds w/setarch links
Mike Frysinger [Mon, 4 May 2015 03:51:04 +0000 (23:51 -0400)] 
build-sys: fix parallel builds w/setarch links

The symlink generation tries to write to the sys-utils/ subdir but does
not make sure that dir exists.  This can sometimes lead to parallel build
failures when building out-of-tree like:
...
echo ".so man8/setarch.8" > sys-utils/linux64.8
/bin/bash: sys-utils/linux64.8: No such file or directory
Makefile:11503: recipe for target 'sys-utils/linux64.8' failed
make: *** [sys-utils/linux64.8] Error 1

References: https://bugs.gentoo.org/511812
Signed-off-by: Mike Frysinger <vapier@chromium.org>
10 years agolibfdisk: (gpt) add API for raw partition attributes
Michael Marineau [Sat, 2 May 2015 22:52:48 +0000 (15:52 -0700)] 
libfdisk: (gpt) add API for raw partition attributes

The existing APIs can only toggle individual bits or get and set bits in
a complex text representation, making it impractical to use libfdisk for
manipulating the GPT partition attribute field in more complex ways such
as updating a value that is multiple bits wide. For example priority
based partition selection originally designed for ChromeOS includes two
integer values that are 4-bits wide.

http://www.chromium.org/chromium-os/chromiumos-design-docs/disk-format#TOC-Trusting-the-GPT

[kzak@redhat.com: - add new symbols to .sym file and docs
                  - remove unused variables from test program]

Signed-off-by: Michael Marineau <michael.marineau@coreos.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
10 years agolibfdisk: (gpt) fix check for beginning of protective partition
Michael Marineau [Sat, 2 May 2015 04:44:33 +0000 (21:44 -0700)] 
libfdisk: (gpt) fix check for beginning of protective partition

Search for the protective partition before attempting to validate that
it covers the GPT header. Some hybrid MBRs list partitions out of order.
For example, CoreOS images ship with a hybrid MBR that lists the boot
partition first and the protective partition second in order to maintain
compatibility with old versions of Xen's PV-GRUB.

Signed-off-by: Michael Marineau <michael.marineau@coreos.com>
10 years agofsck: Fix parsing of -r
Stanislav Brabec [Wed, 29 Apr 2015 16:49:47 +0000 (18:49 +0200)] 
fsck: Fix parsing of -r

Fix regression introduced by commit 658c089: -r cannot be used as a last
option:

fsck -r /dev/sda1
fsck: invalid argument -r: '/dev/sda1'

Signed-off-by: Stanislav Brabec <sbrabec@suse.cz>
10 years agodocs: fix TODO typos
Karel Zak [Tue, 28 Apr 2015 12:04:15 +0000 (14:04 +0200)] 
docs: fix TODO typos

Signed-off-by: Karel Zak <kzak@redhat.com>
10 years agodocs: update TODO
Karel Zak [Tue, 28 Apr 2015 12:00:28 +0000 (14:00 +0200)] 
docs: update TODO

Signed-off-by: Karel Zak <kzak@redhat.com>
10 years agofsck: print errors on invalid -r argument
Karel Zak [Tue, 28 Apr 2015 11:43:14 +0000 (13:43 +0200)] 
fsck: print errors on invalid -r argument

The patch also add support for -r 0.

Signed-off-by: Karel Zak <kzak@redhat.com>
10 years agofsck: implement fsck -r {fd}
Stanislav Brabec [Mon, 27 Apr 2015 15:20:55 +0000 (17:20 +0200)] 
fsck: implement fsck -r {fd}

Make possible sending of statistics to a dedicated file descriptor.

Rationale: When UI is calling fsck from a remote terminal, fsck progress
needs to be sent to stdout. It is mixed there with output of statistics,
and it is impossible to parse the output to get the statistics.

Now it will be possible e. g. with "fsck -C -r 3 /dev/sda1"

Note: Code in if and else is intentionally partially duplicated. Current
human readable output of floats does not conform to locale conventions,
and may be changed in future. But we want to keep machine readable output
exactly same as it is now.

[kzak@redhat.com: - don't use report_stats_fd globally]

Signed-off-by: Stanislav Brabec <sbrabec@suse.cz>
Signed-off-by: Karel Zak <kzak@redhat.com>
10 years agohwclock: fix spelling, punctuation and formatting mistakes in the man page
Benno Schulenberg [Wed, 8 Apr 2015 08:22:43 +0000 (10:22 +0200)] 
hwclock: fix spelling, punctuation and formatting mistakes in the man page

Also improve some wordings.

Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
10 years agohwclock: clean up man page header
Karel Zak [Tue, 28 Apr 2015 10:27:18 +0000 (12:27 +0200)] 
hwclock: clean up man page header

We already use .TQ in another man pages for years and nobody
complains, so I guess the fallback is unnecessary.

The patch also minimize in-header change-log. We have git for this
purpose.

Signed-off-by: Karel Zak <kzak@redhat.com>
10 years agohwclock: remove an untrue phrase from the man page
Benno Schulenberg [Tue, 17 Mar 2015 20:34:51 +0000 (21:34 +0100)] 
hwclock: remove an untrue phrase from the man page

Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
10 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>
10 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>
10 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>
10 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>
10 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>
10 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>
10 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>
10 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>
10 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>
10 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>
10 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>
10 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>
10 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>
10 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>
10 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>
10 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>
10 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>
10 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>
10 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>
10 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>
10 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>
10 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>
10 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>
10 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>
10 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>
10 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>
10 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>
10 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>
10 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>
10 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>
10 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>
10 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>
10 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()

10 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

10 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>
10 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>
10 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>