]> git.ipfire.org Git - thirdparty/util-linux.git/log
thirdparty/util-linux.git
7 years agorfkill: fix coding style and error messages
Karel Zak [Fri, 15 Sep 2017 10:28:44 +0000 (12:28 +0200)] 
rfkill: fix coding style and error messages

Signed-off-by: Karel Zak <kzak@redhat.com>
7 years agorfkill: do not fsync(3) /dev/rfkill file descriptor
Sami Kerola [Mon, 11 Sep 2017 19:55:58 +0000 (20:55 +0100)] 
rfkill: do not fsync(3) /dev/rfkill file descriptor

Attempt to fsync() this device returns EINVAL, causing the rfkill always to
return EXIT_FAILURE when either block or unblock is requested.  Simply
closing the file descriptor will fix the issue.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
7 years agorfkill: allow use of multiple arguments
Sami Kerola [Mon, 11 Sep 2017 19:55:57 +0000 (20:55 +0100)] 
rfkill: allow use of multiple arguments

There is no reason why multiple arguments could not be supported.

Most common use case is to do multiple control commands in one go without us
of 'all' argument that can cause unnecessary connection breakage.  For
example someone might want to add to a system initialization following
commands.

    rfkill block bluetooth uwb wimax wwan gps fm nfc

That will ensure everything but wifi is turned off with as few commands as
possible, without killing wifi at any point.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
7 years agoscript: support sig{stop/cont}
Karel Zak [Fri, 8 Sep 2017 07:48:29 +0000 (09:48 +0200)] 
script: support sig{stop/cont}

* call wait() only when child exited
* suspend all session (including script master process) when child get
  SIGSTOP and send SIGCONT to child when master process resume

This allows to suspend all session and later use "fg" shell command to
resume.

$ ps af
14722 pts/1    Ss     0:00 bash
 4870 pts/1    S+     0:00  \_ ./script
 4871 pts/6    Ss+    0:00      \_ bash -i

$ kill -SIGSTOP 4871

and script session on another terminal:

$ script
Script started, file is typescript

[1]+  Stopped                 ./script

$ fg 1
./script

... session again usable ...
^D
Script done, file is typescript

Signed-off-by: Karel Zak <kzak@redhat.com>
7 years agolsblk: small man page change in return codes description
Karel Zak [Thu, 7 Sep 2017 08:03:18 +0000 (10:03 +0200)] 
lsblk: small man page change in return codes description

Signed-off-by: Karel Zak <kzak@redhat.com>
7 years agohwclock: add -a that is short of --adjust to manual page and usage
Sami Kerola [Sun, 3 Sep 2017 22:34:07 +0000 (23:34 +0100)] 
hwclock: add -a that is short of --adjust to manual page and usage

In same go use -V as return value of --version from getopts_long().

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
7 years agohwclock: update usage()
J William Piggott [Mon, 4 Sep 2017 01:17:28 +0000 (21:17 -0400)] 
hwclock: update usage()

Improve usage strings for debug and version.

Signed-off-by: J William Piggott <elseifthen@gmx.com>
7 years agoMerge branch '170825' of github.com:jwpi/util-linux
Karel Zak [Tue, 5 Sep 2017 10:24:40 +0000 (12:24 +0200)] 
Merge branch '170825' of github.com:jwpi/util-linux

* '170825' of github.com:jwpi/util-linux:
  hwclock: close hwaudit_fd unconditionally
  hwclock: don't always use hwclock_exit
  hwclock: remove sysexits.h

7 years agouuidgen: add more details to man page
Karel Zak [Tue, 5 Sep 2017 10:17:26 +0000 (12:17 +0200)] 
uuidgen: add more details to man page

Signed-off-by: Karel Zak <kzak@redhat.com>
7 years agouuidgen: add support for hash-based UUIDs
Philip Prindeville [Mon, 28 Aug 2017 19:36:30 +0000 (13:36 -0600)] 
uuidgen: add support for hash-based UUIDs

Signed-off-by: Philip Prindeville <philipp@redfish-solutions.com>
7 years agomisc: replace magic number 37 with UUID_STR_LEN
Philip Prindeville [Mon, 28 Aug 2017 19:20:55 +0000 (13:20 -0600)] 
misc: replace magic number 37 with UUID_STR_LEN

Signed-off-by: Philip Prindeville <philipp@redfish-solutions.com>
7 years agolibuuid: add support for hash-based UUIDs
Philip Prindeville [Tue, 5 Sep 2017 09:19:26 +0000 (11:19 +0200)] 
libuuid: add support for hash-based UUIDs

Adding V3 and V5 UUIDs per RFC-4122.

[kzak@redhat.com: - fix symbols file]

Signed-off-by: Philip Prindeville <philipp@redfish-solutions.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
7 years agohwclock: close hwaudit_fd unconditionally
J William Piggott [Tue, 29 Aug 2017 01:19:55 +0000 (21:19 -0400)] 
hwclock: close hwaudit_fd unconditionally

Signed-off-by: J William Piggott <elseifthen@gmx.com>
7 years agohwclock: don't always use hwclock_exit
J William Piggott [Sun, 3 Sep 2017 16:23:44 +0000 (12:23 -0400)] 
hwclock: don't always use hwclock_exit

Special exit handling is not wanted for usage() or bad
command syntax. For example we do not want to audit:
hwclock --set --date foo

Signed-off-by: J William Piggott <elseifthen@gmx.com>
7 years agohwclock: remove sysexits.h
J William Piggott [Mon, 28 Aug 2017 00:26:41 +0000 (20:26 -0400)] 
hwclock: remove sysexits.h

sysexits.h was introduced in v2.11t prior to util-linux-ng, with the
HISTORY entry: * hwclock: minor polishing.

So there was no specific issue solved by adding it. Its use was never
documented so it should be safe to remove.

Also, fix return values being used for the exit status that were not
magic constants (portability issue).

Signed-off-by: J William Piggott <elseifthen@gmx.com>
7 years agotests: update sfdisk wipe test
Karel Zak [Fri, 1 Sep 2017 08:42:51 +0000 (10:42 +0200)] 
tests: update sfdisk wipe test

Now command wipefs returns results in the order how superblocks has
been detected on the device.

Signed-off-by: Karel Zak <kzak@redhat.com>
7 years agorfkill: add NFC fallback for old headers
Karel Zak [Thu, 31 Aug 2017 18:40:37 +0000 (20:40 +0200)] 
rfkill: add NFC fallback for old headers

Signed-off-by: Karel Zak <kzak@redhat.com>
7 years agowipefs: cleanup offsets list usage, fix -t filter
Karel Zak [Thu, 31 Aug 2017 12:47:14 +0000 (14:47 +0200)] 
wipefs: cleanup offsets list usage, fix -t filter

* move list with offsets specified by -o to the wipe_control struct
* don't clone the list of offsets, just keep it simple and stupid
* apply all filters (-o and -t) in get_desc_for_probe()
* always return offset and len by get_desc_for_probe() and apply
  always use libblkid hide & step-back

Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=1486777
Signed-off-by: Karel Zak <kzak@redhat.com>
7 years agolib/match: make match_fstype() case insensitive
Karel Zak [Thu, 31 Aug 2017 12:15:23 +0000 (14:15 +0200)] 
lib/match: make match_fstype() case insensitive

Signed-off-by: Karel Zak <kzak@redhat.com>
7 years agobuild-sys: add --disable-rfkill
Karel Zak [Thu, 31 Aug 2017 09:40:51 +0000 (11:40 +0200)] 
build-sys: add --disable-rfkill

Signed-off-by: Karel Zak <kzak@redhat.com>
7 years agorfkill: cleanup returns
Karel Zak [Thu, 31 Aug 2017 09:16:07 +0000 (11:16 +0200)] 
rfkill: cleanup returns

Signed-off-by: Karel Zak <kzak@redhat.com>
7 years agobuild-sys: remove unused rfkill.py
Karel Zak [Thu, 31 Aug 2017 08:37:36 +0000 (10:37 +0200)] 
build-sys: remove unused rfkill.py

Signed-off-by: Karel Zak <kzak@redhat.com>
7 years agorfkill: add Sami to authors
Karel Zak [Thu, 31 Aug 2017 08:36:51 +0000 (10:36 +0200)] 
rfkill: add Sami to authors

Signed-off-by: Karel Zak <kzak@redhat.com>
7 years agorfkill: cleanup usage()
Karel Zak [Thu, 31 Aug 2017 08:31:21 +0000 (10:31 +0200)] 
rfkill: cleanup usage()

Signed-off-by: Karel Zak <kzak@redhat.com>
7 years agoMerge branch 'rfkill' of git://github.com/kerolasa/lelux-utiliteetit into rfkill
Karel Zak [Thu, 31 Aug 2017 07:56:18 +0000 (09:56 +0200)] 
Merge branch 'rfkill' of git://github.com/kerolasa/lelux-utiliteetit into rfkill

* 'rfkill' of git://github.com/kerolasa/lelux-utiliteetit: (57 commits)
  rfkill: add systemd-rfkill(8) see also segment
  rfkill: check id number refers to a device that exists
  rfkill: use back and forward compatible test
  rfkill: add bash-completion file
  rfkill: inform in syslog when rfkill is invoked
  rfkill: use human readable timestamps in event output
  rfkill: use libsmartcols output
  rfkill: do not ignore read error
  rfkill: clarify 'all devices' handling
  rfkill: update manual page
  rfkill: make programming style to match util-linux project
  rfkill: make command to build in util-linux project
  rfkill: move files to appropriate locations
  add python module
  use uapi rfkill.h
  version 0.5
  fix compiler warning
  Add NFC support
  version 0.4
  Add rfkill type "fm" to the man page.
  ...

7 years agorfkill: add systemd-rfkill(8) see also segment
Sami Kerola [Thu, 6 Jul 2017 20:57:59 +0000 (21:57 +0100)] 
rfkill: add systemd-rfkill(8) see also segment

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
7 years agorfkill: check id number refers to a device that exists
Sami Kerola [Tue, 4 Jul 2017 20:43:56 +0000 (21:43 +0100)] 
rfkill: check id number refers to a device that exists

Earlier all commands happily accepted without detecting failure when
none-existing id number was used.  For example:

$ rfkill block 2017; echo $?
0

The same input after this change looks following.

$ rfkill block 2017; echo $?
rfkill: invalid identifier: 2017
1

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
7 years agorfkill: use back and forward compatible test
Sami Kerola [Sat, 1 Jul 2017 08:15:12 +0000 (09:15 +0100)] 
rfkill: use back and forward compatible test

The rfkill_event struct might grow in future, so ensure the read sizes are
at least the minimum, and allow it to be more.

Reference: https://github.com/torvalds/linux/blob/master/include/uapi/linux/rfkill.h#L90-L102
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
7 years agorfkill: add bash-completion file
Sami Kerola [Sun, 25 Jun 2017 12:21:31 +0000 (13:21 +0100)] 
rfkill: add bash-completion file

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
7 years agorfkill: inform in syslog when rfkill is invoked
Sami Kerola [Sun, 25 Jun 2017 11:12:40 +0000 (12:12 +0100)] 
rfkill: inform in syslog when rfkill is invoked

This should help when trying to explain what or who is flicking wireles on
or off.  Notice that the change is not perfect - if rfkill command is
setting a state that is already set the syslog entry is sent eventhough
there was no effective change.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
7 years agorfkill: use human readable timestamps in event output
Sami Kerola [Sun, 25 Jun 2017 10:33:57 +0000 (11:33 +0100)] 
rfkill: use human readable timestamps in event output

The event command appears to be something what primarily a developers will
to use when debugging.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
7 years agorfkill: use libsmartcols output
Sami Kerola [Sun, 25 Jun 2017 08:42:06 +0000 (09:42 +0100)] 
rfkill: use libsmartcols output

This also makes the rfkill to output status when executed without arguments.
That is believed ot be more useful than usage() output.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
7 years agorfkill: do not ignore read error
Sami Kerola [Sun, 25 Jun 2017 00:35:28 +0000 (01:35 +0100)] 
rfkill: do not ignore read error

Read error should be impossible, but when one does happen user certainly
wants to know about that rather than see even more strange issue caused
random data in name variable.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
7 years agorfkill: clarify 'all devices' handling
Sami Kerola [Sun, 25 Jun 2017 00:04:41 +0000 (01:04 +0100)] 
rfkill: clarify 'all devices' handling

Stop using RFKILL_IS_INVALID a marker when rfkill is iterating over all
devices.  Addition of RFKIL_IS_ALL should make this a lot easier to digest,
especially if reading code in hurry.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
7 years agorfkill: update manual page
Sami Kerola [Sat, 24 Jun 2017 23:01:19 +0000 (00:01 +0100)] 
rfkill: update manual page

Make the manual page style to match with util-linux project.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
7 years agorfkill: make programming style to match util-linux project
Sami Kerola [Sat, 24 Jun 2017 19:42:58 +0000 (20:42 +0100)] 
rfkill: make programming style to match util-linux project

Use the usual facilities, add translation strings, move global variables at
the beginning of the file, make usage() look as expected, add standard
command-line option parsing.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
7 years agorfkill: make command to build in util-linux project
Sami Kerola [Sat, 24 Jun 2017 19:19:26 +0000 (20:19 +0100)] 
rfkill: make command to build in util-linux project

After this commit the command merely builds, but does not confirm style used
in util-linux project.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
7 years agorfkill: move files to appropriate locations
Sami Kerola [Sat, 24 Jun 2017 19:03:38 +0000 (20:03 +0100)] 
rfkill: move files to appropriate locations

Also remove unnecessary items.  Notice that the licence text from COPYING is
moved to top of the command in comment section.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
7 years agorfkill: merge rfkill.8 project to util-linux
Sami Kerola [Wed, 30 Aug 2017 19:29:31 +0000 (20:29 +0100)] 
rfkill: merge rfkill.8 project to util-linux

Projet merge discussion in maillists:
http://www.spinics.net/lists/util-linux-ng/msg14289.html
http://marc.info/?l=linux-wireless&m=149880885914076&w=2

Old-Remote: http://git.sipsolutions.net/rfkill.git/
Old-Remote: git://git.kernel.org/pub/scm/linux/kernel/git/jberg/rfkill.git
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
7 years agodocs: remove TODO item for fdisk
Karel Zak [Wed, 30 Aug 2017 10:01:21 +0000 (12:01 +0200)] 
docs: remove TODO item for fdisk

We use libsmartcols so basic escape for terminal should be already
done by the library.

Signed-off-by: Karel Zak <kzak@redhat.com>
7 years agobuild-sys: define dependence between chsh and getusershell
Karel Zak [Wed, 30 Aug 2017 09:30:41 +0000 (11:30 +0200)] 
build-sys: define dependence between chsh and getusershell

7 years agochsh: remove local /etc/shells parsing in favour of getusershell(3)
Sami Kerola [Mon, 28 Aug 2017 20:38:13 +0000 (21:38 +0100)] 
chsh: remove local /etc/shells parsing in favour of getusershell(3)

Less code, less bugs.  And if there are bugs at least share them with all
other programs that use getusershell(3) from libc.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
7 years agobash-completion: simplify pid listing
Sami Kerola [Sat, 26 Aug 2017 12:45:13 +0000 (13:45 +0100)] 
bash-completion: simplify pid listing

Changing directory in subshell does not effect parent process, so this is
better and possibly quicker way to list pids.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
7 years agohwclock: remove bool type definition
Sami Kerola [Sat, 26 Aug 2017 12:38:07 +0000 (13:38 +0100)] 
hwclock: remove bool type definition

Use plain int instead of type defining it to a boolean, and use numbers to
signify true or false as we do everywhere else in this source tree.  And in
hwclock-cmos.c file booleans weren't even needed, to the related code is
removed.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
7 years agofdisk: use strutils to trim whitespace from input
Vaclav Dolezal [Tue, 29 Aug 2017 12:31:06 +0000 (14:31 +0200)] 
fdisk: use strutils to trim whitespace from input

Signed-off-by: Vaclav Dolezal <vdolezal@redhat.com>
7 years agofdisk: fix copy from readline and whitespace stripping
Vaclav Dolezal [Mon, 28 Aug 2017 11:20:34 +0000 (13:20 +0200)] 
fdisk: fix copy from readline and whitespace stripping

Bug fixed:
---
678: fdisk:      ASK: asking for number ['Partition number', <1,4>, default=1, range: 1-4]
678: fdisk:      ASK: asking for user replay [interactive]
Partition number (1-4, default 1): 12345
678: fdisk:      ASK: user's reply: >>>12345<<<
Value out of range.
678: fdisk:      ASK: asking for user replay [interactive]
Partition number (1-4, default 1): 1
678: fdisk:      ASK: user's reply: >>>12345<<<
Value out of range.
678: fdisk:      ASK: asking for user replay [interactive]
Partition number (1-4, default 1):
678: fdisk:      ASK: user's reply: >>>22345<<<
Value out of range.
---

Signed-off-by: Vaclav Dolezal <vdolezal@redhat.com>
7 years agofdisk: minor fixes to make readline work
Vaclav Dolezal [Mon, 28 Aug 2017 10:31:10 +0000 (12:31 +0200)] 
fdisk: minor fixes to make readline work

Signed-off-by: Vaclav Dolezal <vdolezal@redhat.com>
7 years agohwclock: for debugging print startup system time
J William Piggott [Sun, 13 Aug 2017 17:38:18 +0000 (13:38 -0400)] 
hwclock: for debugging print startup system time

Signed-off-by: J William Piggott <elseifthen@gmx.com>
7 years agohwclock: refactor set_system_clock()
J William Piggott [Sun, 13 Aug 2017 17:11:25 +0000 (13:11 -0400)] 
hwclock: refactor set_system_clock()

Signed-off-by: J William Piggott <elseifthen@gmx.com>
7 years agohwclock: update set_system_clock comments
J William Piggott [Sun, 13 Aug 2017 00:13:22 +0000 (20:13 -0400)] 
hwclock: update set_system_clock comments

Signed-off-by: J William Piggott <elseifthen@gmx.com>
7 years agohwclock: update set_system_clock debugging
J William Piggott [Wed, 9 Aug 2017 00:50:55 +0000 (20:50 -0400)] 
hwclock: update set_system_clock debugging

Update debug messages for a combined --systz and --hctosys in
the set_system_clock function.

New debug messages:

hwclock --test -D --systz --localtime
Calling settimeofday(NULL, 240) to warp System time.
Test mode: clock was not changed

hwclock --test -D --systz --utc
Calling settimeofday(NULL, 0) to lock the warp function.
Calling settimeofday(NULL, 240) to set the kernel timezone.
Test mode: clock was not changed

hwclock --test -D --hctosys --utc
Calling settimeofday(1502239269.733639, 240)
Test mode: clock was not changed

hwclock --test -D --hctosys --localtime
Calling settimeofday(NULL, 240) to set persistent_clock_is_local.
Calling settimeofday(1502253708.200200, 240)
Test mode: clock was not changed

Signed-off-by: J William Piggott <elseifthen@gmx.com>
7 years agohwclock: remove set_system_clock_timezone()
J William Piggott [Sun, 6 Aug 2017 16:17:10 +0000 (12:17 -0400)] 
hwclock: remove set_system_clock_timezone()

Remove set_system_clock_timezone() because the previous patch
moved its functionality into set_system_clock().

Signed-off-by: J William Piggott <elseifthen@gmx.com>
7 years agohwclock: move systz into hctosys
J William Piggott [Sun, 6 Aug 2017 15:39:33 +0000 (11:39 -0400)] 
hwclock: move systz into hctosys

The set_system_clock_timezone() function is nearly identical to
set_system_clock(). Three additional statements are required
to include systz in hctosys.

This patch is intentionally incomplete to make reviewing the
actual required changes easier. Other patches in this set will:

 * remove set_system_clock_timezone()
 * fix messages and debugging
 * fix comments
 * and finally refactor set_system_clock()

Signed-off-by: J William Piggott <elseifthen@gmx.com>
7 years agofdisk: add missing include
Karel Zak [Thu, 24 Aug 2017 17:59:20 +0000 (19:59 +0200)] 
fdisk: add missing include

Signed-off-by: Karel Zak <kzak@redhat.com>
7 years agofdisk: fix readline interaction with signals
Karel Zak [Thu, 24 Aug 2017 13:37:16 +0000 (15:37 +0200)] 
fdisk: fix readline interaction with signals

The high-level readline API is crazy to use with signals. Fortunately
the library provides low-level rl_callback_* API. In this case we can
use poll() to wait for input and control all signals, etc.

This patch also a little changes fdisk behavior on CTRL+C and CTRL+D.
The signals does not kill fdisk, but forces fdisk to return to the
main menu, if already in the main menu then exit. If the disk layout
has been modified than ask "Do you really want to exit...".

Signed-off-by: Karel Zak <kzak@redhat.com>
7 years agofdisk: handle SIGINT in dialogs as cancel
Vaclav Dolezal [Tue, 15 Aug 2017 13:25:32 +0000 (15:25 +0200)] 
fdisk: handle SIGINT in dialogs as cancel

[kzak@redhat.com: - use sig_atomic_t]

Signed-off-by: Vaclav Dolezal <vdolezal@redhat.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
7 years agofdisk: add wrap_fgets() for getting user input
Vaclav Dolezal [Tue, 15 Aug 2017 11:08:49 +0000 (13:08 +0200)] 
fdisk: add wrap_fgets() for getting user input

make function wrapping rl_fgets() and fputs()&fgets() to remove
code duplication in get_user_reply().

Signed-off-by: Vaclav Dolezal <vdolezal@redhat.com>
7 years agolibfdisk: fix fdisk_reset_partition() leaking *_chs strings.
Vaclav Dolezal [Tue, 15 Aug 2017 08:02:45 +0000 (10:02 +0200)] 
libfdisk: fix fdisk_reset_partition() leaking *_chs strings.

Signed-off-by: Vaclav Dolezal <vdolezal@redhat.com>
7 years agolibfdisk: fix two potential memory errors.
Vaclav Dolezal [Mon, 14 Aug 2017 10:57:52 +0000 (12:57 +0200)] 
libfdisk: fix two potential memory errors.

Fixes one leak and one unchecked allocation error.

[kzak@redhat.com: - don't call fdisk_ask_menu_get_result()
                    after failed fdisk_do_ask()]

Signed-off-by: Vaclav Dolezal <vdolezal@redhat.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
7 years agolibfdisk: improve alignment debug mesagges
Karel Zak [Tue, 22 Aug 2017 13:12:36 +0000 (15:12 +0200)] 
libfdisk: improve alignment debug mesagges

Signed-off-by: Karel Zak <kzak@redhat.com>
7 years agolibfdisk: add --grain to mkpart sample
Karel Zak [Tue, 22 Aug 2017 12:59:42 +0000 (14:59 +0200)] 
libfdisk: add --grain to mkpart sample

Signed-off-by: Karel Zak <kzak@redhat.com>
7 years agolibfdisk: add fdisk_save_user_grain()
Karel Zak [Tue, 22 Aug 2017 12:55:51 +0000 (14:55 +0200)] 
libfdisk: add fdisk_save_user_grain()

Let's provide API for applications that don't want to use the default
1MiB grain. The new function allow to use "as minimal as possible" if
grain is set by fdisk_save_user_grain() to 512.

If the phy sector size (or minimal I/O size) is greater than specified
grain size than smallest possible setting is used.

Signed-off-by: Karel Zak <kzak@redhat.com>
7 years agolibfdisk: (dos) use size-=1 when alignment not used later
Karel Zak [Tue, 22 Aug 2017 12:54:27 +0000 (14:54 +0200)] 
libfdisk: (dos) use size-=1 when alignment not used later

Signed-off-by: Karel Zak <kzak@redhat.com>
7 years agolibfdisk: improve "add partition" debug message
Karel Zak [Tue, 22 Aug 2017 12:53:18 +0000 (14:53 +0200)] 
libfdisk: improve "add partition" debug message

Signed-off-by: Karel Zak <kzak@redhat.com>
7 years agolibfdisk: (gpt) fix size-1 error
Karel Zak [Tue, 22 Aug 2017 12:48:14 +0000 (14:48 +0200)] 
libfdisk: (gpt) fix size-1 error

If partition does not require alignment, then don't call LBA align
function and don't use size-=1 (fdisk_align_lba_in_range() returns
unmodified size and we call size=-1 more than once for the same size).

Signed-off-by: Karel Zak <kzak@redhat.com>
7 years agodocs: add CAP_SYS_ADMIN to TODO
Karel Zak [Tue, 22 Aug 2017 09:22:26 +0000 (11:22 +0200)] 
docs: add CAP_SYS_ADMIN to TODO

Signed-off-by: Karel Zak <kzak@redhat.com>
7 years agoMerge branch 'master' of https://github.com/pali/util-linux
Karel Zak [Mon, 21 Aug 2017 09:33:17 +0000 (11:33 +0200)] 
Merge branch 'master' of https://github.com/pali/util-linux

* 'master' of https://github.com/pali/util-linux:
  libblkid: udf: Define magic constants

7 years agoisosize: usage() and coding style cleanup
Karel Zak [Mon, 21 Aug 2017 09:16:51 +0000 (11:16 +0200)] 
isosize: usage() and coding style cleanup

Signed-off-by: Karel Zak <kzak@redhat.com>
7 years agoisosize: iterate over all arguments even when something fails
Karel Zak [Mon, 21 Aug 2017 09:11:11 +0000 (11:11 +0200)] 
isosize: iterate over all arguments even when something fails

Earlier the command exit too early if one of the arguments failed.  After
this change all arguments are examined, and command return value will have
information what happen during processing.

Based on patch from Sami Kerola <kerolasa@iki.fi>

Signed-off-by: Karel Zak <kzak@redhat.com>
7 years agolook: use WORDLIST environment variable to find word list
Sami Kerola [Sat, 12 Aug 2017 08:31:11 +0000 (09:31 +0100)] 
look: use WORDLIST environment variable to find word list

The WORDLIST is the same hunspell(1) and ispell(1) uses to achieve the same.
Apparently aspell(1) does not work with files like traditional dict lists.

Reference: https://github.com/hunspell/hunspell/blob/master/man/hunspell.1#L388
Reference: http://www.skrenta.com/rt/man/ispell.1.html
Reference: http://aspell.net/man-html/Creating-an-Individual-Word-List.html#Creating-an-Individual-Word-List
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
7 years agolibblkid: udf: Define magic constants
Pali Rohár [Sun, 20 Aug 2017 12:50:02 +0000 (14:50 +0200)] 
libblkid: udf: Define magic constants

7 years agolslogins: be more explicit with -g in man page
Karel Zak [Fri, 18 Aug 2017 08:29:54 +0000 (10:29 +0200)] 
lslogins: be more explicit with -g in man page

Signed-off-by: Karel Zak <kzak@redhat.com>
7 years agolslogins: ignore non-existing users
Karel Zak [Fri, 18 Aug 2017 08:23:38 +0000 (10:23 +0200)] 
lslogins: ignore non-existing users

Signed-off-by: Karel Zak <kzak@redhat.com>
7 years agomisc: fix some printf format strings
Ruediger Meier [Wed, 16 Aug 2017 12:50:57 +0000 (14:50 +0200)] 
misc: fix some printf format strings

Noticed on xcode/OSX.

Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
7 years agodmesg: fix delimiter calculation
Karel Zak [Wed, 16 Aug 2017 12:15:56 +0000 (14:15 +0200)] 
dmesg: fix delimiter calculation

Reported-by: Laszlo Varkonyi <vlsoftsystems@gmail.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
7 years agolibblkid: fix compiler warning [-Wformat-truncation=]
Karel Zak [Wed, 16 Aug 2017 09:55:57 +0000 (11:55 +0200)] 
libblkid: fix compiler warning [-Wformat-truncation=]

The MBR partition pseudo-UUID is generated from table ID and partition
partno. The final UUID size limit is 37 bytes. The table ID has to be
restricted to keep compiler happy (for MBR the table ID is 8 bytes
as string).

Signed-off-by: Karel Zak <kzak@redhat.com>
7 years agocfdisk: add missing 0x7F key mapping
Karel Zak [Tue, 15 Aug 2017 12:03:43 +0000 (14:03 +0200)] 
cfdisk: add missing 0x7F key mapping

Addresses: https://github.com/karelzak/util-linux/issues/499
Signed-off-by: Karel Zak <kzak@redhat.com>
7 years agodocs: add --enable-programs to TODO
Karel Zak [Mon, 14 Aug 2017 10:25:07 +0000 (12:25 +0200)] 
docs: add --enable-programs to TODO

Signed-off-by: Karel Zak <kzak@redhat.com>
7 years agodocs: add UUID v3 an v5 to TODO
Karel Zak [Mon, 14 Aug 2017 10:09:50 +0000 (12:09 +0200)] 
docs: add UUID v3 an v5 to TODO

Addresses: https://github.com/karelzak/util-linux/issues/495
Signed-off-by: Karel Zak <kzak@redhat.com>
7 years agoblockdev: document --setro more properly
Karel Zak [Mon, 14 Aug 2017 09:30:37 +0000 (11:30 +0200)] 
blockdev: document --setro more properly

Addresses: https://github.com/karelzak/util-linux/issues/498
Signed-off-by: Karel Zak <kzak@redhat.com>
7 years agolib/randutils: reset lose counter
Karel Zak [Mon, 14 Aug 2017 08:56:08 +0000 (10:56 +0200)] 
lib/randutils: reset lose counter

It's probaly good idea to reset lose counter when we fallback from
getrandom() to /dev/urandom.

Signed-off-by: Karel Zak <kzak@redhat.com>
7 years agolib/randutils: improve getrandom() usage
Karel Zak [Mon, 14 Aug 2017 08:33:06 +0000 (10:33 +0200)] 
lib/randutils: improve getrandom() usage

The getrandom() does not have to return all requested bytes (missing
entropy or when interrupted by signal). The current implementation in
util-linux stupidly asks for all random data again, rather than only
for missing bytes.

The current code also does not care if we repeat our requests for
ever; that's bad.

This patch uses the same way as we already use for reading from
/dev/urandom. It means:

 * repeat getrandom() for only missing bytes
 * limit number of unsuccessful request (16 times)
 * fallback to /dev/urandom on ENOSYS (old kernel or so...)

Addresses: https://github.com/karelzak/util-linux/issues/496
Signed-off-by: Karel Zak <kzak@redhat.com>
7 years agolosetup: add info about lazy detach to manpage
Karel Zak [Thu, 10 Aug 2017 10:37:34 +0000 (12:37 +0200)] 
losetup: add info about lazy detach to manpage

Signed-off-by: Karel Zak <kzak@redhat.com>
7 years agoMerge branch 'master' of https://github.com/RAOF/util-linux
Karel Zak [Thu, 10 Aug 2017 08:26:21 +0000 (10:26 +0200)] 
Merge branch 'master' of https://github.com/RAOF/util-linux

* 'master' of https://github.com/RAOF/util-linux:
  lib/randutils.c: More paranoia in getrandom() call.
  lib/randutils.c: Fall back gracefully when kernel doesn't support getrandom(2).

8 years agolib/randutils.c: More paranoia in getrandom() call.
Christopher James Halse Rogers [Mon, 7 Aug 2017 06:10:51 +0000 (16:10 +1000)] 
lib/randutils.c: More paranoia in getrandom() call.

If getrandom() is called with nbytes ≥ 256 then it can return with less than the requested
bytes filled.

In this case we *could* adjust the buffer by the number of bytes actually read, but it's
simpler to just redo the call.

8 years agolib/randutils.c: Fall back gracefully when kernel doesn't support getrandom(2).
Christopher James Halse Rogers [Mon, 7 Aug 2017 06:07:54 +0000 (16:07 +1000)] 
lib/randutils.c: Fall back gracefully when kernel doesn't support getrandom(2).

The 3.16 kernel is supported until 2020, and various distros have kernels of the same
vintage. It's entirely possible for code built against newer headers to be run against
these kernels, so fall-back to the old “read /dev/{u,}random” method if the kernel doesn'
support getrandom()

8 years agoMerge branch 'blkid-ubi'
Karel Zak [Mon, 7 Aug 2017 08:00:34 +0000 (10:00 +0200)] 
Merge branch 'blkid-ubi'

8 years agoMerge branch '170724' of github.com:jwpi/util-linux
Karel Zak [Mon, 7 Aug 2017 07:52:23 +0000 (09:52 +0200)] 
Merge branch '170724' of github.com:jwpi/util-linux

* '170724' of github.com:jwpi/util-linux:
  hwclock: fix hclock_valid test and error messages
  hwclock: remove busywait tristate return status
  hwclock: restore select() timeout warning
  hwclock: update man page
  hwclock: correlate hclocktime instead of set_time.
  hwclock: fix RTC read logic
  hwclock: move drift correction and --predict
  hwclock: move rtc permissions test
  hwclock: move systz above init clocks read

8 years agoagetty: keep returns in main()
Karel Zak [Mon, 7 Aug 2017 07:48:51 +0000 (09:48 +0200)] 
agetty: keep returns in main()

Don't use list_speeds() as non-return function, it seems better to
keep main() code consistent.

Signed-off-by: Karel Zak <kzak@redhat.com>
8 years agoagetty: fix invalid usage crash
Sami Kerola [Sun, 30 Jul 2017 13:59:24 +0000 (14:59 +0100)] 
agetty: fix invalid usage crash

$ agetty
agetty: not enough arguments: Success
Segmentation fault (core dumped)

Reference: 9325dbfd2018b2a3b510617f4aa13777fbbe23c3
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
8 years agoagetty: add compile time features to --version output
Sami Kerola [Sat, 5 Aug 2017 15:46:55 +0000 (16:46 +0100)] 
agetty: add compile time features to --version output

This command has a lot of compile time #ifdef code.  It is time to add
feature listing to --version output so understanding command behavior is
easier.

Proposed-by: Karel Zak <kzak@redhat.com>
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
8 years agoagetty: add --list-speeds option
Sami Kerola [Sun, 30 Jul 2017 13:45:59 +0000 (14:45 +0100)] 
agetty: add --list-speeds option

Proposed-by: Karel Zak <kzak@redhat.com>
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
8 years agoagetty: remove dead DO_DEVFS_FIDDLING code segment
Sami Kerola [Sun, 30 Jul 2017 12:44:05 +0000 (13:44 +0100)] 
agetty: remove dead DO_DEVFS_FIDDLING code segment

There is no ./configure option to enable this, and it is unlikely any
distribution hot patching to enable fiddling when building package.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
8 years agobash-completion: look for look completions
Sami Kerola [Sat, 29 Jul 2017 21:27:46 +0000 (22:27 +0100)] 
bash-completion: look for look completions

The look(1) uses positional arguments, where first one is a word from
dictionary.  It is reasonable to assume most of the time people search from
system word lists so propose completions from there.  The second argument is
a dictionary file, that might invalidate the first input but that only
happens to users who have an idea what the want without bash-completion.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
8 years agolibuuid: use access(2) when checking /dev/random availability
Sami Kerola [Sun, 30 Jul 2017 11:33:12 +0000 (12:33 +0100)] 
libuuid: use access(2) when checking /dev/random availability

The access(2) is more lightwight than stat(2), and tells whether random
device(s) can be read or not, unlike the earlier stat() call.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
8 years agouuidparse: nil uuid have all bits set to zero
Sami Kerola [Sat, 29 Jul 2017 21:14:34 +0000 (22:14 +0100)] 
uuidparse: nil uuid have all bits set to zero

The nil UUID is special form of UUID that is specified to have all 128 bits
set to zero.

Reference: https://tools.ietf.org/html/rfc4122#section-4.1.7
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
8 years agovipw: use explicit_bzero() to clear buffer after copy
Sami Kerola [Sat, 29 Jul 2017 16:19:47 +0000 (17:19 +0100)] 
vipw: use explicit_bzero() to clear buffer after copy

This should make leaking end of /etc/shadow file more unlikely.

Notice that there is now way to tell to editors they should ensure none it
does not leak any buffers, drop cores, and so on, when editing sensitive
data.  In short this change is addressing the issue only partially.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
8 years agoinclude: move pamfail.h to auth.c
Sami Kerola [Sun, 30 Jul 2017 10:32:37 +0000 (11:32 +0100)] 
include: move pamfail.h to auth.c

This removes one small header file, and makes inline function to static to
only file it is used in.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
8 years agohwclock: fix hclock_valid test and error messages
J William Piggott [Wed, 2 Aug 2017 20:06:54 +0000 (16:06 -0400)] 
hwclock: fix hclock_valid test and error messages

Every hwclock operation that requires reading the RTC, tests
hclock_valid and prints a different warning. This redundancy
is unnecessary.

Move the warning to the RTC read block (the test was moved in
a previous patch in this set). This reduces function arguments
and is a significant code clean up. It will also benefit the
translators.

Signed-off-by: J William Piggott <elseifthen@gmx.com>
8 years agohwclock: remove busywait tristate return status
J William Piggott [Mon, 31 Jul 2017 15:57:01 +0000 (11:57 -0400)] 
hwclock: remove busywait tristate return status

The select() synchronization branch only returns success or
fail. There is no reason for the busywait branch to do more.
If synchronization fails for any reason then it must exit,
otherwise all drift correction operation will be invalid.

Signed-off-by: J William Piggott <elseifthen@gmx.com>