]> git.ipfire.org Git - thirdparty/util-linux.git/log
thirdparty/util-linux.git
8 years agocolumn: make more obvious what is default behavior
Karel Zak [Wed, 1 Mar 2017 11:25:16 +0000 (12:25 +0100)] 
column: make more obvious what is default behavior

The man page contains mistakes. The default is to fill columns before
lines:

$ printf 'aaaaaaaaaaaaaaaaaaaaaa\nBBBBBBBBBBBBBBBBBBBBB\nXXXXXXX\nYYYYYYYYYYY\nZZZZZ' > data

$ column --columns 80 < data
aaaaaaaaaaaaaaaaaaaaaa XXXXXXX ZZZZZ
BBBBBBBBBBBBBBBBBBBBB YYYYYYYYYYY

$ column  --fillrows --columns 80 < data
aaaaaaaaaaaaaaaaaaaaaa BBBBBBBBBBBBBBBBBBBBB XXXXXXX
YYYYYYYYYYY ZZZZZ

The patch also rename functions in the code to make it more obvious
for code readers.

Signed-off-by: Karel Zak <kzak@redhat.com>
8 years agolibmount: cosmetic change to mnt_table_find_srcpath()
Karel Zak [Tue, 28 Feb 2017 13:47:02 +0000 (14:47 +0100)] 
libmount: cosmetic change to mnt_table_find_srcpath()

Signed-off-by: Karel Zak <kzak@redhat.com>
8 years agolibmount: return tab entry for default node
Petr Vorel [Thu, 23 Feb 2017 18:25:13 +0000 (19:25 +0100)] 
libmount: return tab entry for default node

This is useful for lsblk.

Signed-off-by: Petr Vorel <pvorel@suse.cz>
8 years agosetterm: fix bitfield warning [smatch]
Sami Kerola [Sat, 25 Feb 2017 17:35:17 +0000 (17:35 +0000)] 
setterm: fix bitfield warning [smatch]

term-utils/setterm.c:179:27: warning: dubious bitfield without explicit
`signed' or `unsigned'

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
8 years agolibfdisk: (dos) add ID related debug messages
Karel Zak [Mon, 27 Feb 2017 12:44:08 +0000 (13:44 +0100)] 
libfdisk: (dos) add ID related debug messages

Signed-off-by: Karel Zak <kzak@redhat.com>
8 years agolibfdisk: add version to debug output
Karel Zak [Mon, 27 Feb 2017 12:16:18 +0000 (13:16 +0100)] 
libfdisk: add version to debug output

Signed-off-by: Karel Zak <kzak@redhat.com>
8 years agoagetty: fix a memory leak when parsing \S in issue files
Matthias Gerstner [Mon, 27 Feb 2017 11:03:57 +0000 (12:03 +0100)] 
agetty: fix a memory leak when parsing \S in issue files

8 years agounshare: add note about sysfs and procfs
Karel Zak [Mon, 27 Feb 2017 11:09:35 +0000 (12:09 +0100)] 
unshare: add note about sysfs and procfs

Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=1390057
Signed-off-by: Karel Zak <kzak@redhat.com>
8 years agodocs: add note about branches to README
Karel Zak [Fri, 24 Feb 2017 13:19:04 +0000 (14:19 +0100)] 
docs: add note about branches to README

Signed-off-by: Karel Zak <kzak@redhat.com>
8 years agoblkzone: add count option to bash-completion
Karel Zak [Fri, 24 Feb 2017 11:05:13 +0000 (12:05 +0100)] 
blkzone: add count option to bash-completion

and fix typo in man page

Signed-off-by: Karel Zak <kzak@redhat.com>
8 years agoblkzone: use optutils.h to check mutually exclusive options
Karel Zak [Fri, 24 Feb 2017 10:59:53 +0000 (11:59 +0100)] 
blkzone: use optutils.h to check mutually exclusive options

Signed-off-by: Karel Zak <kzak@redhat.com>
8 years agoblkzone: Add --count option
Damien Le Moal [Fri, 24 Feb 2017 06:45:31 +0000 (15:45 +0900)] 
blkzone: Add --count option

The length option is used to specify the number of zones to
operate on. To be more consistent with other tools, have this
option use a number of sectors and introduce the --count option
to allow users to specify a number of zones.
The --count and --length options cannot be used together on
the command line.

Signed-off-by: Damien Le Moal <damien.lemoal@wdc.com>
8 years agoblkzone: Improve zone information print
Damien Le Moal [Fri, 24 Feb 2017 03:47:29 +0000 (12:47 +0900)] 
blkzone: Improve zone information print

Add "0x" to the zone start, length and write pointer print
to make it always clear that the values are Hexadecimal.

Also update the zone condition string and associated comments
to match more closely the wording in the standard document.
The man page is also updated to match the new wording.

Signed-off-by: Damien Le Moal <damien.lemoal@wdc.com>
8 years agoblkzone: Report all zones if length is not specified
Damien Le Moal [Fri, 24 Feb 2017 03:36:08 +0000 (12:36 +0900)] 
blkzone: Report all zones if length is not specified

Report all zones of the block device when length is not specified
on the command line. To do this, introduce an inner loop in
blkzone_report to repeatedly issue report zone ioctl to the
device.

Signed-off-by: Damien Le Moal <damien.lemoal@wdc.com>
8 years agoblkzone: Reset all zones when length is not specified
Damien Le Moal [Fri, 24 Feb 2017 02:48:45 +0000 (11:48 +0900)] 
blkzone: Reset all zones when length is not specified

If length is 0, operate on all zones starting from offset.
This also fix the maximum length calculation from offset.

Signed-off-by: Damien Le Moal <damien.lemoal@wdc.com>
8 years agoblkreport, blkreset: remove in favour of blkzone
Karel Zak [Thu, 23 Feb 2017 16:03:26 +0000 (17:03 +0100)] 
blkreport, blkreset: remove in favour of blkzone

Signed-off-by: Karel Zak <kzak@redhat.com>
8 years agoblkzone: add bash-completion
Karel Zak [Thu, 23 Feb 2017 16:01:29 +0000 (17:01 +0100)] 
blkzone: add bash-completion

Signed-off-by: Karel Zak <kzak@redhat.com>
8 years agoblkzone: add new command (merge blkreport and blkreset)
Karel Zak [Thu, 23 Feb 2017 15:43:51 +0000 (16:43 +0100)] 
blkzone: add new command (merge blkreport and blkreset)

This new command is based on the original implementation of blkreport
and blkreset command.

Signed-off-by: Karel Zak <kzak@redhat.com>
8 years agobuild-sys: simplify UL_ENABLE_ALIAS() semantic
Karel Zak [Tue, 21 Feb 2017 10:00:19 +0000 (11:00 +0100)] 
build-sys: simplify UL_ENABLE_ALIAS() semantic

Let's follow only $enable_ variables. In this case the MASTERNAME
(e.g. [schedutils] for --enable-schedutils) has to be without
UL_BUILD_INIT.

Signed-off-by: Karel Zak <kzak@redhat.com>
8 years agobuild-sys: fix --disable-all-programs --enable-schedutils
Karel Zak [Mon, 20 Feb 2017 13:17:37 +0000 (14:17 +0100)] 
build-sys: fix --disable-all-programs --enable-schedutils

* add UL_ENABLE_ALIAS(NAME, MASTERNAME) to initialize $enable_<name>
  according to MASTERNAME. Note that we have to use $build_<mastername>,
  the $enable_<mastername> is just AC_ARG_ENABLE() stuff only. The
  $build_ is evaluated and modified by our UL_...() functions.

* add enable-schedutils.conf to have build-system regression test for
  this use-case

Addresses: https://github.com/karelzak/util-linux/issues/415
Signed-off-by: Karel Zak <kzak@redhat.com>
8 years agotests: another improvement to the sfdisk wipe test
Karel Zak [Mon, 20 Feb 2017 12:22:55 +0000 (13:22 +0100)] 
tests: another improvement to the sfdisk wipe test

Signed-off-by: Karel Zak <kzak@redhat.com>
8 years agolibblkid: remove unnecessary 'static' keyword
Karel Zak [Mon, 20 Feb 2017 12:08:30 +0000 (13:08 +0100)] 
libblkid: remove unnecessary 'static' keyword

Signed-off-by: Karel Zak <kzak@redhat.com>
8 years agofindmnt: fix couple memory leaks [cppcheck]
Sami Kerola [Sun, 12 Feb 2017 20:42:49 +0000 (20:42 +0000)] 
findmnt: fix couple memory leaks [cppcheck]

In both cases FILE *f was leaked.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
8 years agolibblkid: declare across file variables in blkidP.h [smatch scan]
Sami Kerola [Sun, 12 Feb 2017 18:48:21 +0000 (18:48 +0000)] 
libblkid: declare across file variables in blkidP.h [smatch scan]

Else these variables will cause following warning:

libblkid/src/superblocks/superblocks.c:165:29: warning: symbol
'superblocks_drv' was not declared.  Should it be static?

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
8 years agolib/idcache: add void to function declaration [smatch scan]
Sami Kerola [Sun, 12 Feb 2017 08:25:03 +0000 (08:25 +0000)] 
lib/idcache: add void to function declaration [smatch scan]

lib/idcache.c:29:29: warning: non-ANSI function declaration of function
'new_idcache'

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
8 years agomisc: add static keyword to where needed [smatch scan]
Sami Kerola [Sun, 12 Feb 2017 00:19:33 +0000 (00:19 +0000)] 
misc: add static keyword to where needed [smatch scan]

text-utils/rev.c:68:9: warning: symbol 'buf' was not declared. Should it be
static?

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
8 years agomisc: do not use plain 0 as NULL [smatch scan]
Sami Kerola [Sat, 11 Feb 2017 20:23:26 +0000 (20:23 +0000)] 
misc: do not use plain 0 as NULL [smatch scan]

text-utils/tailf.c:69:21: warning: Using plain integer as NULL pointer

Since many 'struct option' has used zero as NULL make them more readable in
same go by reindenting, and using named argument requirements.

Reference: https://lwn.net/Articles/93577/
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
8 years agocfdisk: avoid use of VLA in combination with sizeof() [smatch scan]
Sami Kerola [Sat, 11 Feb 2017 19:01:08 +0000 (19:01 +0000)] 
cfdisk: avoid use of VLA in combination with sizeof() [smatch scan]

disk-utils/cfdisk.c:1066:29: error: cannot size expression

One should use sizeof() only when variable size can be known at time of
compilation.  That is not the case with variable length arrays.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
8 years agotests: make sfdisk wipe partition optional
Karel Zak [Fri, 17 Feb 2017 15:24:35 +0000 (16:24 +0100)] 
tests: make sfdisk wipe partition optional

Signed-off-by: Karel Zak <kzak@redhat.com>
8 years agolibfdisk: add sample-fdisk-mkpart binary
Karel Zak [Fri, 17 Feb 2017 15:15:03 +0000 (16:15 +0100)] 
libfdisk: add sample-fdisk-mkpart binary

For example:
# sample-fdisk-mkpart --device /dev/sdc 1M 2M 3M - 5M

# fdisk -l /dev/sdc
...
Device     Boot Start    End Sectors Size Id Type
/dev/sdc1        2048   4095    2048   1M 83 Linux
/dev/sdc2        4096   8191    4096   2M 83 Linux
/dev/sdc3        8192  14335    6144   3M 83 Linux
/dev/sdc4       14336 204799  190464  93M  5 Extended
/dev/sdc5       16384  26623   10240   5M 83 Linux

Addresses: https://github.com/karelzak/util-linux/issues/204
Signed-off-by: Karel Zak <kzak@redhat.com>
8 years agolibfdisk: (dos) make it possible to create primary/logical by template
Karel Zak [Fri, 17 Feb 2017 15:11:37 +0000 (16:11 +0100)] 
libfdisk: (dos) make it possible to create primary/logical by template

Let's check partition partno if specified to create logical or primary
partition.

Addresses: https://github.com/karelzak/util-linux/issues/204
Signed-off-by: Karel Zak <kzak@redhat.com>
8 years agolibfdisk: (gpt) make sure it's GPT in public API
Karel Zak [Fri, 17 Feb 2017 13:47:00 +0000 (14:47 +0100)] 
libfdisk: (gpt) make sure it's GPT in public API

Signed-off-by: Karel Zak <kzak@redhat.com>
8 years agolibfdisk: verify partno from template
Karel Zak [Fri, 17 Feb 2017 12:15:09 +0000 (13:15 +0100)] 
libfdisk: verify partno from template

* verify partno from template when create a new partition
* remove unnecessary l->ext_offset check

Signed-off-by: Karel Zak <kzak@redhat.com>
8 years agotests: (sfdisk) tell kernel about new partition
Karel Zak [Fri, 17 Feb 2017 09:28:53 +0000 (10:28 +0100)] 
tests: (sfdisk) tell kernel about new partition

Signed-off-by: Karel Zak <kzak@redhat.com>
8 years agotests: add udevadm settle to sfdisk wipe
Karel Zak [Thu, 16 Feb 2017 14:30:45 +0000 (15:30 +0100)] 
tests: add udevadm settle to sfdisk wipe

Signed-off-by: Karel Zak <kzak@redhat.com>
8 years agobuild-sys: add missing file
Karel Zak [Thu, 16 Feb 2017 14:27:07 +0000 (15:27 +0100)] 
build-sys: add missing file

Signed-off-by: Karel Zak <kzak@redhat.com>
8 years agotests: add --show-diff
Karel Zak [Thu, 16 Feb 2017 13:14:54 +0000 (14:14 +0100)] 
tests: add --show-diff

Signed-off-by: Karel Zak <kzak@redhat.com>
8 years agobuild-sys: add non-widechar.conf
Karel Zak [Thu, 16 Feb 2017 12:47:34 +0000 (13:47 +0100)] 
build-sys: add non-widechar.conf

Signed-off-by: Karel Zak <kzak@redhat.com>
8 years agocfdisk: use buffer editor for ui_get_string()
Karel Zak [Thu, 16 Feb 2017 12:46:26 +0000 (13:46 +0100)] 
cfdisk: use buffer editor for ui_get_string()

Addresses: https://github.com/karelzak/util-linux/issues/403
Signed-off-by: Karel Zak <kzak@redhat.com>
8 years agolib/mbsedit: add simple buffer editor
Karel Zak [Thu, 16 Feb 2017 12:04:26 +0000 (13:04 +0100)] 
lib/mbsedit: add simple buffer editor

Signed-off-by: Karel Zak <kzak@redhat.com>
8 years agotests: use swap in sfdisk wipe test
Karel Zak [Thu, 16 Feb 2017 10:01:35 +0000 (11:01 +0100)] 
tests: use swap in sfdisk wipe test

and add "udevadm settle".

Signed-off-by: Karel Zak <kzak@redhat.com>
8 years agorename: add --no-act to bash-completion
Karel Zak [Wed, 15 Feb 2017 12:45:02 +0000 (13:45 +0100)] 
rename: add --no-act to bash-completion

Signed-off-by: Karel Zak <kzak@redhat.com>
8 years agorename: add --no-act option
Alexander F Rødseth [Mon, 13 Feb 2017 12:44:38 +0000 (13:44 +0100)] 
rename: add --no-act option

[kzak@redhat.com: - rename --dry-run to --no-act]

Signed-off-by: Alexander F Rødseth <xyproto@archlinux.org>
Signed-off-by: Karel Zak <kzak@redhat.com>
8 years agotests: add sfdisk --wipe and --wipe-partition tests
Karel Zak [Wed, 15 Feb 2017 11:48:06 +0000 (12:48 +0100)] 
tests: add sfdisk --wipe and --wipe-partition tests

Addresses: https://github.com/karelzak/util-linux/issues/410
Addresses: https://github.com/karelzak/util-linux/issues/411
Signed-off-by: Karel Zak <kzak@redhat.com>
8 years agolibblkid: (gpt) fix force flag
Karel Zak [Wed, 15 Feb 2017 10:30:58 +0000 (11:30 +0100)] 
libblkid: (gpt) fix force flag

Signed-off-by: Karel Zak <kzak@redhat.com>
8 years agofdisk: improve --wipe functionality
Karel Zak [Tue, 14 Feb 2017 14:11:35 +0000 (15:11 +0100)] 
fdisk: improve --wipe functionality

* always (except --wipe=never) wipe old partition tables
* improve warn messages
* improve man page

Addresses: https://github.com/karelzak/util-linux/issues/410
Signed-off-by: Karel Zak <kzak@redhat.com>
8 years agosfdisk: improve --wipe functionality
Karel Zak [Tue, 14 Feb 2017 14:11:35 +0000 (15:11 +0100)] 
sfdisk: improve --wipe functionality

* always (except --wipe=never) wipe old partition tables
* improve warn messages
* improve man page

Addresses: https://github.com/karelzak/util-linux/issues/410
Signed-off-by: Karel Zak <kzak@redhat.com>
8 years agolibblkid: fix BLKID_PARTS_FORCE_GPT usage
Karel Zak [Tue, 14 Feb 2017 13:57:24 +0000 (14:57 +0100)] 
libblkid: fix BLKID_PARTS_FORCE_GPT usage

Now wipefs always inform about MBR as about PMBR. That's bug.

Signed-off-by: Karel Zak <kzak@redhat.com>
8 years agolibfdisk: (dos) debug what we read from first sector
Karel Zak [Tue, 14 Feb 2017 13:46:19 +0000 (14:46 +0100)] 
libfdisk: (dos) debug what we read from first sector

Signed-off-by: Karel Zak <kzak@redhat.com>
8 years agolibfdisk: classify collision type
Karel Zak [Tue, 14 Feb 2017 13:23:45 +0000 (14:23 +0100)] 
libfdisk: classify collision type

Signed-off-by: Karel Zak <kzak@redhat.com>
8 years agolibfdisk: check for collisions when create new label
Karel Zak [Tue, 14 Feb 2017 12:07:54 +0000 (13:07 +0100)] 
libfdisk: check for collisions when create new label

We need to be sure that when create a new disklabel than the old label
will be removed.

Addresses: https://github.com/karelzak/util-linux/issues/410
Signed-off-by: Karel Zak <kzak@redhat.com>
8 years agolib/randutils: glibc 2.25 has getrandom(2) declaration
Sami Kerola [Sat, 11 Feb 2017 18:04:14 +0000 (18:04 +0000)] 
lib/randutils: glibc 2.25 has getrandom(2) declaration

Use correct header file to include the function.

Reference: http://git.kernel.org/cgit/docs/man-pages/man-pages.git/commit/?id=2cbb6fb4e926e56dc3985b19ac02389321a0af5d
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
8 years agobash-completion: add blkreset and blkreport completion
Sami Kerola [Sat, 11 Feb 2017 14:10:52 +0000 (14:10 +0000)] 
bash-completion: add blkreset and blkreport completion

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
8 years agoman: improve blkreport(8) and blkreset(8) manual pages
Sami Kerola [Sat, 11 Feb 2017 14:10:51 +0000 (14:10 +0000)] 
man: improve blkreport(8) and blkreset(8) manual pages

Tell in manual page what ZAC and ZBC acronyms mean.  Include explanation to
blkreport output, so that users do not need to search source code to
understand what the tool informed.  And fix couple dot double space issues.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
8 years agoblkreport, blkreset: small code clean ups
Sami Kerola [Sat, 11 Feb 2017 14:10:50 +0000 (14:10 +0000)] 
blkreport, blkreset: small code clean ups

Set variables read-only where possible.  Fix few code style issues, mostly
with spacing.  Avoid initializing variables if they are never read before
next update.  Remove "ERR: %d -> %s" message that repeated system error
three times, twice in that message and once at end of main that is the only
of these three left in place.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
8 years agodocs: Fix word repetitions
Yuri Chornoivan [Fri, 10 Feb 2017 11:05:04 +0000 (13:05 +0200)] 
docs: Fix word repetitions

8 years agofindmnt: use line separator for --poll output
Karel Zak [Fri, 10 Feb 2017 16:28:07 +0000 (17:28 +0100)] 
findmnt: use line separator for --poll output

Addresses: https://github.com/karelzak/util-linux/issues/409
Signed-off-by: Karel Zak <kzak@redhat.com>
8 years agolibfdisk: fix fdisk_set_wipe_area() calls
Karel Zak [Fri, 10 Feb 2017 15:45:18 +0000 (16:45 +0100)] 
libfdisk: fix fdisk_set_wipe_area() calls

The function expects size in sectors rather than in bytes.

Addresses: https://github.com/karelzak/util-linux/issues/410
Signed-off-by: Karel Zak <kzak@redhat.com>
8 years agosfdisk: --quiet fixes
Karel Zak [Fri, 10 Feb 2017 11:54:23 +0000 (12:54 +0100)] 
sfdisk: --quiet fixes

Addresses: https://github.com/karelzak/util-linux/issues/412
Signed-off-by: Karel Zak <kzak@redhat.com>
8 years agotaskset: don't use zero PID in messages
Karel Zak [Fri, 10 Feb 2017 10:46:37 +0000 (11:46 +0100)] 
taskset: don't use zero PID in messages

The pid 0 is technically correct, but very confusing for end users. Use
getpid() in the messages.

Addresses: https://github.com/karelzak/util-linux/issues/413
Signed-off-by: Karel Zak <kzak@redhat.com>
8 years agoblkreset: remove "LBA" from usage()
Karel Zak [Fri, 10 Feb 2017 09:53:38 +0000 (10:53 +0100)] 
blkreset: remove "LBA" from usage()

* "LBA" sounds confusing

Reported-by: Damien Le Moal <damien.lemoal@wdc.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
8 years agoblkreport: remove "LBA" from usage() and unnecessary alignment check
Karel Zak [Fri, 10 Feb 2017 09:53:38 +0000 (10:53 +0100)] 
blkreport: remove "LBA" from usage() and unnecessary alignment check

* "LBA" sounds confusing

* alignment check is unnecessary for report ioctl

Reported-by: Damien Le Moal <damien.lemoal@wdc.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
8 years agoblkreport: slice up option descriptions, fix typo, fix docstring
Benno Schulenberg [Thu, 9 Feb 2017 16:24:00 +0000 (17:24 +0100)] 
blkreport: slice up option descriptions, fix typo, fix docstring

Each option plus its description should be a separate translatable
string.  And, if all is well, blkreport should not discard anything
-- that is: fix the cut-and-paste error from blkdiscard.

Additionally, tweak some wordings.

Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
8 years agoblkzonecmd, blkreport: Add new commands for ZAC/ZBC drives
Shaun Tancheff [Mon, 23 Jan 2017 13:32:42 +0000 (20:32 +0700)] 
blkzonecmd, blkreport: Add new commands for ZAC/ZBC drives

This patch adds:
 - blkreset to issue Reset (Write Pointer) zone commands
 - blkreport to retrieve drive zone information

[kzak@redhat.com: - cleanup man page and usage()
                  - remove command line options aliases,
                  - use strtosize_or_err()
                  - remove unnecessary -ludev
                  - use blkdev.h stuff]

Signed-off-by: Shaun Tancheff <shaun@tancheff.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
8 years agohwclock: remove if-if-condition
Karel Zak [Thu, 9 Feb 2017 10:42:01 +0000 (11:42 +0100)] 
hwclock: remove if-if-condition

8 years agoMerge branch 'hwclock-jwp-reviewed' of git://github.com/kerolasa/lelux-utiliteetit
Karel Zak [Thu, 9 Feb 2017 10:35:50 +0000 (11:35 +0100)] 
Merge branch 'hwclock-jwp-reviewed' of git://github.com/kerolasa/lelux-utiliteetit

* 'hwclock-jwp-reviewed' of git://github.com/kerolasa/lelux-utiliteetit: (25 commits)
  hwclock: remove --compare option
  hwclock: remove trailing dot from messages that include system error message
  hwclock: make --date=argument less prone to injection
  hwclock: fix rtc atexit registration
  hwclock: clarify cmos inb and outb preprocessor directives
  hwclock: try RTCGET and RTCSET only when normal rtc fails
  hwclock: stream line synchronize_to_clock_tick_rtc()
  hwclock: improve coding style
  hwclock: remove division by zero [asan]
  hwclock: add debugging to open_rtc()
  hwclock: remove magic constants from interpret_date_string()
  hwclock: use symbolic magic values passed in between functions
  hwclock: initialize struct adjtime members
  hwclock: alloate date_resp parsing buffer in interpret_date_string()
  hwclock: simplify save_adjtime() execution flow
  hwclock: remove dead code and other minor fixes
  hwclock: move error messages to determine_clock_access_method()
  hwclock: clarify set_cmos_epoch() code
  hwclock: move command-line options to control structure
  hwclock: remove unnecessary type casts
  ...

8 years agobuild-sys: improve detection of the "isnan" function in uClibc
Carlos Santos [Wed, 8 Feb 2017 15:27:36 +0000 (13:27 -0200)] 
build-sys: improve detection of the "isnan" function in uClibc

Since commit beceb14b450ded6560ed743634a5e80604a8edf3, MATH_LIBS is set
to "-lm" when the isnan function is detected. In uClibc, however, isnan
is a macro that calls __isnan, __isnanf, or __isnanl, depending on the
size of the argument (double, float or long double).

Fixes:
  http://autobuild.buildroot.net/results/2c2/2c29a78ed81ca844a87dcd076ab3e14ea080296d/
  http://autobuild.buildroot.net/results/404/404b10f359b2ae8a7216729fa1bab37fed2d3d4c/

Signed-off-by: Carlos Santos <casantos@datacom.ind.br>
8 years agoumount: exclude selinuxfs from --all
Karel Zak [Thu, 9 Feb 2017 10:21:49 +0000 (11:21 +0100)] 
umount: exclude selinuxfs from --all

Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=1417722
Signed-off-by: Karel Zak <kzak@redhat.com>
8 years agohwclock: remove --compare option
Sami Kerola [Tue, 10 Jan 2017 21:16:20 +0000 (21:16 +0000)] 
hwclock: remove --compare option

Compare functionality was printing nonsense values.  There is no knowledge
of anyone using this broken functionality.  Instead of deprecating the code
for months, and removing it after few release, it is removed immediately.
Needless to say this is unusual removal.

Reference: http://marc.info/?l=util-linux-ng&m=148396210506652&w=2
Signed-off-by: Karel Zak <kzak@redhat.com>
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
8 years agohwclock: remove trailing dot from messages that include system error message
Sami Kerola [Sat, 31 Dec 2016 21:29:27 +0000 (21:29 +0000)] 
hwclock: remove trailing dot from messages that include system error message

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
8 years agohwclock: make --date=argument less prone to injection
Sami Kerola [Wed, 27 Jul 2016 18:47:38 +0000 (19:47 +0100)] 
hwclock: make --date=argument less prone to injection

This change should not improve security much.  One hopes hwclock --set is
restricted for root only.  Where hwclock is allowed to run via sudo, or has
setuid setup, there is a pretty easy privilege escalation via subshell.

$ sudo ./hwclock --set --date='2000-10-20$(touch /tmp/hwclock.inject)'

Reviewed-by: J William Piggott <elseifthen@gmx.com>
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
8 years agohwclock: fix rtc atexit registration
Sami Kerola [Tue, 26 Jul 2016 13:34:30 +0000 (14:34 +0100)] 
hwclock: fix rtc atexit registration

Commit 27f9db17bd57b85947445c03e2cd9dda36ca377f missed a minus sign from
comparison.

Reviewed-by: J William Piggott <elseifthen@gmx.com>
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
8 years agohwclock: clarify cmos inb and outb preprocessor directives
Sami Kerola [Tue, 26 Jul 2016 07:33:32 +0000 (08:33 +0100)] 
hwclock: clarify cmos inb and outb preprocessor directives

The cmos only works when architecture is i386, x86_64, or alpha.

Reviewed-by: J William Piggott <elseifthen@gmx.com>
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
8 years agohwclock: try RTCGET and RTCSET only when normal rtc fails
Sami Kerola [Tue, 26 Jul 2016 09:52:15 +0000 (10:52 +0100)] 
hwclock: try RTCGET and RTCSET only when normal rtc fails

The RTCGET and RTCSET are in use for sparcs with sbus, so try them as
fallback rather than always.

Reference: https://github.com/torvalds/linux/blob/master/fs/compat_ioctl.c#L967-L974
Reviewed-by: J William Piggott <elseifthen@gmx.com>
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
8 years agohwclock: stream line synchronize_to_clock_tick_rtc()
Sami Kerola [Tue, 26 Jul 2016 07:54:00 +0000 (08:54 +0100)] 
hwclock: stream line synchronize_to_clock_tick_rtc()

Flip if clauses to hit common case first.  This should be easier and quicker
to read and run.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
8 years agohwclock: improve coding style
Sami Kerola [Sun, 24 Jul 2016 21:33:01 +0000 (22:33 +0100)] 
hwclock: improve coding style

Make string constants to be symbolical declarations.  Use longer variable
name for rtc and cmos function pointer values.  Exclude code that is
architecture specific with preprocessor directives.  And remove message
duplication.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
8 years agohwclock: remove division by zero [asan]
Sami Kerola [Sun, 17 Jul 2016 21:04:32 +0000 (22:04 +0100)] 
hwclock: remove division by zero [asan]

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
8 years agohwclock: add debugging to open_rtc()
Sami Kerola [Sun, 17 Jul 2016 16:10:48 +0000 (17:10 +0100)] 
hwclock: add debugging to open_rtc()

Earlier when open_rtc() returned -1 the char *rtc_dev_name end up having
NULL that made it unsuitable to be used in error message.  Now one can debug
what paths the open_rtc() tries to use when one has to debug why 'cannot
open rtc device' happen.

Reviewed-by: J William Piggott <elseifthen@gmx.com>
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
8 years agohwclock: remove magic constants from interpret_date_string()
Sami Kerola [Sun, 17 Jul 2016 15:35:40 +0000 (16:35 +0100)] 
hwclock: remove magic constants from interpret_date_string()

The constants function returned were not used.  In same go clean up
execution flow a little bit.

Reviewed-by: J William Piggott <elseifthen@gmx.com>
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
8 years agohwclock: use symbolic magic values passed in between functions
Sami Kerola [Sun, 17 Jul 2016 15:14:16 +0000 (16:14 +0100)] 
hwclock: use symbolic magic values passed in between functions

The manipulate_clock() is seeing return value from
busywait_for_rtc_clock_tick().

And the get_permissions_cmos() can see i386_iopl() return value.

Reviewed-by: J William Piggott <elseifthen@gmx.com>
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
8 years agohwclock: initialize struct adjtime members
Sami Kerola [Sun, 17 Jul 2016 12:25:40 +0000 (13:25 +0100)] 
hwclock: initialize struct adjtime members

Avoid any chance of using uninitialized values.  It looks like the earlier
code did take care of that, but it was less obvious about the fact.

Reviewed-by: J William Piggott <elseifthen@gmx.com>
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
8 years agohwclock: alloate date_resp parsing buffer in interpret_date_string()
Sami Kerola [Sun, 17 Jul 2016 11:49:12 +0000 (12:49 +0100)] 
hwclock: alloate date_resp parsing buffer in interpret_date_string()

This makes overflowing the variable in question impossible.

Reviewed-by: J William Piggott <elseifthen@gmx.com>
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
8 years agohwclock: simplify save_adjtime() execution flow
Sami Kerola [Sun, 17 Jul 2016 11:12:52 +0000 (12:12 +0100)] 
hwclock: simplify save_adjtime() execution flow

Return early to avoid excessive nesting.  In same go remove any chance of
overflow by using appropriate allocation.  And update variable names to be
easier to understand.

Reviewed-by: J William Piggott <elseifthen@gmx.com>
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
8 years agohwclock: remove dead code and other minor fixes
Sami Kerola [Sun, 17 Jul 2016 10:30:40 +0000 (11:30 +0100)] 
hwclock: remove dead code and other minor fixes

Use #ifdef rather than #if to avoid undefined preprocessor identifier
warning.

Remove dead code.  The #if 0 ensured the code has not been used for long
time, which is good because the linux/mc146818rtc.h is not been part of
user-api for long time.

Value of the adjtime_p->last_calib_time is checked if it has value of zero,
so testing none-zero bit later is necessarily true, and therefore does not
need to be checked.

And at the and remove unnecessary boolean variable.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
8 years agohwclock: move error messages to determine_clock_access_method()
Sami Kerola [Sat, 16 Jul 2016 21:15:54 +0000 (22:15 +0100)] 
hwclock: move error messages to determine_clock_access_method()

This makes main() a little bit shorter.

Reviewed-by: J William Piggott <elseifthen@gmx.com>
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
8 years agohwclock: clarify set_cmos_epoch() code
Sami Kerola [Sat, 16 Jul 2016 19:18:19 +0000 (20:18 +0100)] 
hwclock: clarify set_cmos_epoch() code

Variable set_epoc is unnecessary, and removal of it makes it obvious what is
happening in this function.

Reviewed-by: J William Piggott <elseifthen@gmx.com>
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
8 years agohwclock: move command-line options to control structure
Sami Kerola [Sat, 16 Jul 2016 15:45:07 +0000 (16:45 +0100)] 
hwclock: move command-line options to control structure

The control structure is read-only everywhere else but in main().  Almost
all changes are about how variables are referred, with one exception.  Calls
to read_adjtime() from manipulate_clock() and compare_clock() are moved to
main().  This way it is possible to keep variable that tells if hwclock is
using UTC-0 be part of control structure.

Changes within #ifdef __alpha__ segments were tested by flipping the
preprocessor directivive otherway around and getting good compilaton all the
way to the point where linking on none-alpha system failed.

Reviewed-by: J William Piggott <elseifthen@gmx.com>
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
8 years agohwclock: remove unnecessary type casts
Sami Kerola [Sat, 16 Jul 2016 12:43:35 +0000 (13:43 +0100)] 
hwclock: remove unnecessary type casts

Most of the casts did nothing, with exception of couple printouts where
format specifier is updated to match with the variable type.

Reviewed-by: J William Piggott <elseifthen@gmx.com>
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
8 years agohwclock: do not hardcode date command magic string twice
Sami Kerola [Sat, 16 Jul 2016 12:23:28 +0000 (13:23 +0100)] 
hwclock: do not hardcode date command magic string twice

Variable 'magic' already contains string 'seconds-into-epoch'.

Reviewed-by: J William Piggott <elseifthen@gmx.com>
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
8 years agohwclock: remove hwclock_exit() indirection
Sami Kerola [Sat, 16 Jul 2016 11:57:25 +0000 (12:57 +0100)] 
hwclock: remove hwclock_exit() indirection

Reviewed-by: J William Piggott <elseifthen@gmx.com>
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
8 years agohwclock: remove FLOOR macro in favour of floor(3)
Sami Kerola [Sat, 16 Jul 2016 11:50:53 +0000 (12:50 +0100)] 
hwclock: remove FLOOR macro in favour of floor(3)

Reviewed-by: J William Piggott <elseifthen@gmx.com>
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
8 years agolib: add timegm() portability function to lib/timeutils.c
Sami Kerola [Tue, 12 Jul 2016 21:21:10 +0000 (22:21 +0100)] 
lib: add timegm() portability function to lib/timeutils.c

Local timegm() is a replacement function in cases it is missing from libc
implementation.  Hopefully the replacement is never, or very rarely, used.

CC: Ruediger Meier <ruediger.meier@ga-group.nl>
Reviewed-by: J William Piggott <elseifthen@gmx.com>
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
8 years agohwclock: remove UTC-0 localization hack
Sami Kerola [Sun, 10 Jul 2016 19:09:55 +0000 (20:09 +0100)] 
hwclock: remove UTC-0 localization hack

Use timegm(3) instead rather than re-implement same functionality with
mktime(3) combined with removal of TZ localization.

Reviewed-by: J William Piggott <elseifthen@gmx.com>
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
8 years agocfdisk: add copyright to help
Karel Zak [Thu, 2 Feb 2017 09:28:38 +0000 (10:28 +0100)] 
cfdisk: add copyright to help

... to make it obvious this is a new cfdisk.

Signed-off-by: Karel Zak <kzak@redhat.com>
8 years agolibmount: make rootfs lookup by parent-id more robust
Karel Zak [Wed, 1 Feb 2017 15:12:55 +0000 (16:12 +0100)] 
libmount: make rootfs lookup by parent-id more robust

The root FS id really does not have to be the smallest one.

Reported-by: Michal Soltys <soltys@ziu.info>
Signed-off-by: Karel Zak <kzak@redhat.com>
8 years agocfdisk: support UI refresh on ^L
Karel Zak [Wed, 1 Feb 2017 14:34:57 +0000 (15:34 +0100)] 
cfdisk: support UI refresh on ^L

Addresses: https://github.com/karelzak/util-linux/issues/404
Signed-off-by: Karel Zak <kzak@redhat.com>
8 years agosu: properly clear child PID
Karel Zak [Wed, 1 Feb 2017 10:58:09 +0000 (11:58 +0100)] 
su: properly clear child PID

Reported-by: Tobias Stöckmann <tobias@stoeckmann.org>
Signed-off-by: Karel Zak <kzak@redhat.com>
8 years agolscpu: don't use path_exist() before path_fopen()
Karel Zak [Tue, 31 Jan 2017 19:55:07 +0000 (20:55 +0100)] 
lscpu: don't use path_exist() before path_fopen()

Signed-off-by: Karel Zak <kzak@redhat.com>
8 years agodocs: add BUG REPORTING section to README
Karel Zak [Tue, 31 Jan 2017 15:18:11 +0000 (16:18 +0100)] 
docs: add BUG REPORTING section to README

Addresses: https://github.com/karelzak/util-linux/issues/405
Signed-off-by: Karel Zak <kzak@redhat.com>
8 years agolscpu: make osrelease file optional
Karel Zak [Tue, 31 Jan 2017 12:44:43 +0000 (13:44 +0100)] 
lscpu: make osrelease file optional

Signed-off-by: Karel Zak <kzak@redhat.com>