Commit Graph

11899 Commits

Author SHA1 Message Date
Sami Kerola 473ec35974 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>
2017-08-30 11:21:56 +02:00
Vaclav Dolezal 6c183c283b fdisk: use strutils to trim whitespace from input
Signed-off-by: Vaclav Dolezal <vdolezal@redhat.com>
2017-08-29 15:26:39 +02:00
Vaclav Dolezal 1d775aa260 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>
2017-08-28 14:06:15 +02:00
Vaclav Dolezal 3063670425 fdisk: minor fixes to make readline work
Signed-off-by: Vaclav Dolezal <vdolezal@redhat.com>
2017-08-28 14:03:30 +02:00
J William Piggott e406be01b4 hwclock: for debugging print startup system time
Signed-off-by: J William Piggott <elseifthen@gmx.com>
2017-08-24 18:49:11 -04:00
J William Piggott e5cb8d4dfe hwclock: refactor set_system_clock()
Signed-off-by: J William Piggott <elseifthen@gmx.com>
2017-08-24 18:48:47 -04:00
J William Piggott c8f64f94f3 hwclock: update set_system_clock comments
Signed-off-by: J William Piggott <elseifthen@gmx.com>
2017-08-24 18:30:39 -04:00
J William Piggott b44dd522b4 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>
2017-08-24 18:30:39 -04:00
J William Piggott 3a7669aa8a 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>
2017-08-24 18:30:39 -04:00
J William Piggott 404fdd2ca4 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>
2017-08-24 18:30:39 -04:00
Karel Zak ebfab541cf fdisk: add missing include
Signed-off-by: Karel Zak <kzak@redhat.com>
2017-08-24 19:59:20 +02:00
Karel Zak c1154128db 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>
2017-08-24 15:48:46 +02:00
Vaclav Dolezal 6c8c429d49 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>
2017-08-24 13:08:22 +02:00
Vaclav Dolezal 55cf371609 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>
2017-08-24 11:27:18 +02:00
Vaclav Dolezal 504c594777 libfdisk: fix fdisk_reset_partition() leaking *_chs strings.
Signed-off-by: Vaclav Dolezal <vdolezal@redhat.com>
2017-08-24 11:23:44 +02:00
Vaclav Dolezal 5cebb2ab33 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>
2017-08-24 11:21:59 +02:00
Karel Zak b428eb14a8 libfdisk: improve alignment debug mesagges
Signed-off-by: Karel Zak <kzak@redhat.com>
2017-08-22 15:12:36 +02:00
Karel Zak 27c284b848 libfdisk: add --grain to mkpart sample
Signed-off-by: Karel Zak <kzak@redhat.com>
2017-08-22 14:59:42 +02:00
Karel Zak adf09b5c38 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>
2017-08-22 14:55:51 +02:00
Karel Zak 980cc4a182 libfdisk: (dos) use size-=1 when alignment not used later
Signed-off-by: Karel Zak <kzak@redhat.com>
2017-08-22 14:54:27 +02:00
Karel Zak 1573e95514 libfdisk: improve "add partition" debug message
Signed-off-by: Karel Zak <kzak@redhat.com>
2017-08-22 14:53:18 +02:00
Karel Zak 694a407de9 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>
2017-08-22 14:48:14 +02:00
Karel Zak 3f30dedd56 docs: add CAP_SYS_ADMIN to TODO
Signed-off-by: Karel Zak <kzak@redhat.com>
2017-08-22 11:22:26 +02:00
Karel Zak c64376b051 Merge branch 'master' of https://github.com/pali/util-linux
* 'master' of https://github.com/pali/util-linux:
  libblkid: udf: Define magic constants
2017-08-21 11:33:17 +02:00
Karel Zak 1da83869cf isosize: usage() and coding style cleanup
Signed-off-by: Karel Zak <kzak@redhat.com>
2017-08-21 11:16:51 +02:00
Karel Zak c380180289 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>
2017-08-21 11:11:11 +02:00
Sami Kerola a653878c45 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>
2017-08-21 10:48:20 +02:00
Pali Rohár c748335382 libblkid: udf: Define magic constants 2017-08-20 14:50:02 +02:00
Karel Zak 6047c6db9c lslogins: be more explicit with -g in man page
Signed-off-by: Karel Zak <kzak@redhat.com>
2017-08-18 10:29:54 +02:00
Karel Zak f4513f27c2 lslogins: ignore non-existing users
Signed-off-by: Karel Zak <kzak@redhat.com>
2017-08-18 10:23:38 +02:00
Ruediger Meier e282116f6d misc: fix some printf format strings
Noticed on xcode/OSX.

Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
2017-08-16 15:51:15 +02:00
Karel Zak fcd90d9ac7 dmesg: fix delimiter calculation
Reported-by: Laszlo Varkonyi <vlsoftsystems@gmail.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
2017-08-16 14:15:56 +02:00
Karel Zak feeeaca967 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>
2017-08-16 11:55:57 +02:00
Karel Zak 6b1e439a0e cfdisk: add missing 0x7F key mapping
Addresses: https://github.com/karelzak/util-linux/issues/499
Signed-off-by: Karel Zak <kzak@redhat.com>
2017-08-15 14:03:43 +02:00
Karel Zak 77d03707d9 docs: add --enable-programs to TODO
Signed-off-by: Karel Zak <kzak@redhat.com>
2017-08-14 12:25:07 +02:00
Karel Zak 9612a41085 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>
2017-08-14 12:10:16 +02:00
Karel Zak 80701a7ace blockdev: document --setro more properly
Addresses: https://github.com/karelzak/util-linux/issues/498
Signed-off-by: Karel Zak <kzak@redhat.com>
2017-08-14 11:30:37 +02:00
Karel Zak 51013d3efa 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>
2017-08-14 10:56:08 +02:00
Karel Zak 5264aebb4f 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>
2017-08-14 10:33:06 +02:00
Karel Zak 60eedb0a53 losetup: add info about lazy detach to manpage
Signed-off-by: Karel Zak <kzak@redhat.com>
2017-08-10 12:37:34 +02:00
Karel Zak 959b9250d8 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).
2017-08-10 10:26:21 +02:00
Christopher James Halse Rogers cc7d1fd16d 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.
2017-08-08 11:28:25 +10:00
Christopher James Halse Rogers a7df0f5f35 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()
2017-08-08 11:27:49 +10:00
Karel Zak 6a2c5b572c Merge branch 'blkid-ubi' 2017-08-07 10:00:34 +02:00
Karel Zak baf3281e6c 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
2017-08-07 09:52:23 +02:00
Karel Zak 7e6f029448 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>
2017-08-07 09:48:51 +02:00
Sami Kerola 82214f45e9
agetty: fix invalid usage crash
$ agetty
agetty: not enough arguments: Success
Segmentation fault (core dumped)

Reference: 9325dbfd20
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2017-08-05 16:49:07 +01:00
Sami Kerola 63d94613a8
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>
2017-08-05 16:46:55 +01:00
Sami Kerola 11841430c9
agetty: add --list-speeds option
Proposed-by: Karel Zak <kzak@redhat.com>
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2017-08-05 16:04:37 +01:00
Sami Kerola 43a1709e3b
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>
2017-08-05 09:58:25 +01:00