]> git.ipfire.org Git - thirdparty/util-linux.git/log
thirdparty/util-linux.git
4 years agolibfdisk: (script) fix segmentation fault
Gaël PORTAY [Fri, 20 Mar 2020 20:10:35 +0000 (16:10 -0400)] 
libfdisk: (script) fix segmentation fault

This patch fixes a segmentation fault that occurs if the name value is
empty (i.e. name=).

Signed-off-by: Gaël PORTAY <gael.portay@collabora.com>
4 years agobuild-sys: fix chfn-chsh configure help text
Karel Zak [Mon, 16 Mar 2020 09:53:55 +0000 (10:53 +0100)] 
build-sys: fix chfn-chsh configure help text

Signed-off-by: Karel Zak <kzak@redhat.com>
4 years agolibmount: smb2 is unsupported alias
Karel Zak [Wed, 11 Mar 2020 17:38:09 +0000 (18:38 +0100)] 
libmount: smb2 is unsupported alias

Kenneth D'souza wrote:
 # grep -w MODULE_ALIAS_FS fs/cifs/cifsfs.c
 MODULE_ALIAS_FS("cifs");
 112/112│MODULE_ALIAS_FS("smb3");

Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=1812118
Signed-off-by: Karel Zak <kzak@redhat.com>
4 years agolibmount: improve smb{2,3} support
Karel Zak [Wed, 11 Mar 2020 09:38:37 +0000 (10:38 +0100)] 
libmount: improve smb{2,3} support

It seems kernel can use smb3 as fstype in mountinfo.

Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=1812118
Signed-off-by: Karel Zak <kzak@redhat.com>
4 years agoagetty: (man) fix typo
Karel Zak [Tue, 10 Mar 2020 19:55:00 +0000 (20:55 +0100)] 
agetty: (man) fix typo

Signed-off-by: Karel Zak <kzak@redhat.com>
4 years agoagetty: (man) add "white" color name
Karel Zak [Tue, 10 Mar 2020 11:33:35 +0000 (12:33 +0100)] 
agetty: (man) add "white" color name

Addresses: https://github.com/karelzak/util-linux/issues/979
Signed-off-by: Karel Zak <kzak@redhat.com>
4 years agoinclude: cleanup pidfd inckudes
Karel Zak [Tue, 10 Mar 2020 10:43:16 +0000 (11:43 +0100)] 
include: cleanup pidfd inckudes

Signed-off-by: Karel Zak <kzak@redhat.com>
4 years agofsck.cramfs: fix macro usage
Zbigniew Jędrzejewski-Szmek [Tue, 25 Feb 2020 12:29:08 +0000 (13:29 +0100)] 
fsck.cramfs: fix macro usage

Autotoolz does not define HAVE_LCHOWN when the condition is false,
so it is appropriate to use #ifdef/#ifndef as everywhere else.

Signed-off-by: Karel Zak <kzak@redhat.com>
4 years agobuild-sys: rename automake variable to match define name
Zbigniew Jędrzejewski-Szmek [Sat, 22 Feb 2020 20:19:26 +0000 (21:19 +0100)] 
build-sys: rename automake variable to match define name

Just to make things a bit more consistent.

Signed-off-by: Karel Zak <kzak@redhat.com>
4 years agobuild-sys: remove unneeded include of generated file
Zbigniew Jędrzejewski-Szmek [Fri, 31 Jan 2020 06:44:36 +0000 (07:44 +0100)] 
build-sys: remove unneeded include of generated file

Signed-off-by: Karel Zak <kzak@redhat.com>
4 years agolib/color-names: add "white" between human-readable
Karel Zak [Tue, 10 Mar 2020 08:45:33 +0000 (09:45 +0100)] 
lib/color-names: add "white" between human-readable

Addresses: https://github.com/karelzak/util-linux/issues/979
Signed-off-by: Karel Zak <kzak@redhat.com>
4 years agoMerge branch 'nsenter' of https://github.com/adrianreber/util-linux
Karel Zak [Tue, 10 Mar 2020 08:40:34 +0000 (09:40 +0100)] 
Merge branch 'nsenter' of https://github.com/adrianreber/util-linux

4 years agonsenter: add support for the time namespace
Adrian Reber [Mon, 9 Mar 2020 13:02:45 +0000 (13:02 +0000)] 
nsenter: add support for the time namespace

Just as with unshare and lsns this adds time namespace support to
nsenter.

In contrast to unshare nsenter does not have the options '--boottime'
and '--monotonic' as that offset can only be set as long as there have
no processes being started in the corresponding time namespace.

Signed-off-by: Adrian Reber <areber@redhat.com>
4 years agounshare: use '-T' for time namespace instead of '-t'
Adrian Reber [Mon, 9 Mar 2020 12:20:51 +0000 (12:20 +0000)] 
unshare: use '-T' for time namespace instead of '-t'

While working on getting time namespace support into 'nsenter' it was
not possible to use '-t' to enter a time namespace as '-t' is the short
option for '--target'. Fortunately '-T' is still available in 'nsenter'
and 'unshare' and therefore let's change 'unshare' to use the same flag
for the time namespace as 'nsenter'.

Signed-off-by: Adrian Reber <areber@redhat.com>
4 years agodocs: add rev(1) to TODO
Karel Zak [Mon, 9 Mar 2020 10:07:48 +0000 (11:07 +0100)] 
docs: add rev(1) to TODO

Addresses: https://github.com/karelzak/util-linux/issues/972
Signed-off-by: Karel Zak <kzak@redhat.com>
4 years agorev: (man) add note about limitations
Karel Zak [Mon, 9 Mar 2020 10:03:30 +0000 (11:03 +0100)] 
rev: (man) add note about limitations

Addresses: https://github.com/karelzak/util-linux/issues/972
Signed-off-by: Karel Zak <kzak@redhat.com>
4 years agohexdump: fix typo, dcl instead of dc1
Karel Zak [Mon, 9 Mar 2020 09:54:28 +0000 (10:54 +0100)] 
hexdump: fix typo, dcl instead of dc1

Addresses: https://github.com/karelzak/util-linux/issues/976
Signed-off-by: Karel Zak <kzak@redhat.com>
4 years agoMerge branch 'time-namespace' of https://github.com/adrianreber/util-linux
Karel Zak [Mon, 9 Mar 2020 09:31:45 +0000 (10:31 +0100)] 
Merge branch 'time-namespace' of https://github.com/adrianreber/util-linux

* 'time-namespace' of https://github.com/adrianreber/util-linux:
  unshare: support the time namespace
  unshare: fix help message indentation

4 years agoMerge branch 'lsns' of https://github.com/adrianreber/util-linux
Karel Zak [Mon, 9 Mar 2020 09:29:32 +0000 (10:29 +0100)] 
Merge branch 'lsns' of https://github.com/adrianreber/util-linux

* 'lsns' of https://github.com/adrianreber/util-linux:
  lsns: add time namespace support

4 years agoMerge branch 'topic/irq'
Karel Zak [Mon, 9 Mar 2020 09:25:48 +0000 (10:25 +0100)] 
Merge branch 'topic/irq'

4 years agolsns: add time namespace support
Adrian Reber [Mon, 9 Mar 2020 09:16:07 +0000 (09:16 +0000)] 
lsns: add time namespace support

 # ./lsns -t time
         NS TYPE  NPROCS   PID USER COMMAND
 4026531834 time     102     1 root /usr/lib/systemd/systemd --switched-root --system --deserialize 29
 4026532246 time       1 54797 root sleep 1000

Signed-off-by: Adrian Reber <areber@redhat.com>
4 years agounshare: support the time namespace
Adrian Reber [Fri, 6 Mar 2020 11:05:00 +0000 (12:05 +0100)] 
unshare: support the time namespace

This adds support to unshare for time namespaces. With the newly added
options '-t, --time' and '--monotonic' and '--boottime' it is now
possible to change CLOCK_MONOTONIC and CLOCK_BOOTTIME in a new time
namespace.

The time namespace has been merged in kernel version 5.6 and an easy way
to test it is using CLOCK_BOOTTIME and the uptime command:

 # uptime
 11:08:26 up 20:28,  1 user,  load average: 0.00, 0.00, 0.00
 # ./unshare --fork --time --boottime 100000000 uptime
 11:08:29 up 1158 days,  6:15,  1 user,  load average: 0.00, 0.00, 0.00

Signed-off-by: Adrian Reber <areber@redhat.com>
4 years agounshare: fix help message indentation
Adrian Reber [Fri, 6 Mar 2020 11:03:50 +0000 (12:03 +0100)] 
unshare: fix help message indentation

A few lines of the help message were unaligned in the output because of
mixes use of tabs and space. This removes all tabs and replaces them
with spaces.

Signed-off-by: Adrian Reber <areber@redhat.com>
4 years agodocs: fix spacing in irqtop and lsirq manual pages
Sami Kerola [Fri, 6 Mar 2020 20:34:06 +0000 (20:34 +0000)] 
docs: fix spacing in irqtop and lsirq manual pages

And convert font changing macros to ones used in howto-man-page.txt

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
4 years agolsirq: mark --json and --pairs options mutually exclusive
Sami Kerola [Fri, 6 Mar 2020 20:14:06 +0000 (20:14 +0000)] 
lsirq: mark --json and --pairs options mutually exclusive

Before this change --pairs option would always win over --json.  That is
unnecessarily confusing, it is much better to disallow combination that does
not make sense.

Notice that the --noheadings in combination with --json or --pairs will not
cause any effect.  In strictest possible understanding --noheadings should
also be exclusive.  Looking from more relaxed point of view neither --json
nor --pairs has heading, so excluding is not necessary because --noheading
is happening already.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
4 years agobash-completion: update irqtop and lsirq completions
Sami Kerola [Fri, 6 Mar 2020 19:49:34 +0000 (19:49 +0000)] 
bash-completion: update irqtop and lsirq completions

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
4 years agolsirq: add -P option
Karel Zak [Fri, 6 Mar 2020 15:34:51 +0000 (16:34 +0100)] 
lsirq: add -P option

Signed-off-by: Karel Zak <kzak@redhat.com>
4 years agolsirq: add -n option
Karel Zak [Fri, 6 Mar 2020 15:26:06 +0000 (16:26 +0100)] 
lsirq: add -n option

Signed-off-by: Karel Zak <kzak@redhat.com>
4 years agolsirq: add new command
Karel Zak [Fri, 6 Mar 2020 15:21:10 +0000 (16:21 +0100)] 
lsirq: add new command

Signed-off-by: Karel Zak <kzak@redhat.com>
4 years agoirqtop: cleanup man page
Karel Zak [Fri, 6 Mar 2020 15:16:38 +0000 (16:16 +0100)] 
irqtop: cleanup man page

Signed-off-by: Karel Zak <kzak@redhat.com>
4 years agoirqtop: cleanup sort stuff
Karel Zak [Fri, 6 Mar 2020 14:28:57 +0000 (15:28 +0100)] 
irqtop: cleanup sort stuff

* user "cmp" in the function names (it does not sort)
* keep all in irq-common.c
* use column names on command line (e.g. --sort NAME)
* hardcode default to sort_result()

Signed-off-by: Karel Zak <kzak@redhat.com>
4 years agoirqtop: small cleanup in main()
Karel Zak [Fri, 6 Mar 2020 13:55:19 +0000 (14:55 +0100)] 
irqtop: small cleanup in main()

4 years agoirqtop: cleanup struct irq_stat use
Karel Zak [Fri, 6 Mar 2020 13:49:53 +0000 (14:49 +0100)] 
irqtop: cleanup struct irq_stat use

Signed-off-by: Karel Zak <kzak@redhat.com>
4 years agoirqtop: move WINDOW back to control struct
Karel Zak [Fri, 6 Mar 2020 13:21:46 +0000 (14:21 +0100)] 
irqtop: move WINDOW back to control struct

Signed-off-by: Karel Zak <kzak@redhat.com>
4 years agoirqtop: minor cleanup
Karel Zak [Fri, 6 Mar 2020 13:11:30 +0000 (14:11 +0100)] 
irqtop: minor cleanup

Signed-off-by: Karel Zak <kzak@redhat.com>
4 years agoirqtop: move independent code to irq-common.c
Karel Zak [Fri, 6 Mar 2020 13:04:33 +0000 (14:04 +0100)] 
irqtop: move independent code to irq-common.c

Signed-off-by: Karel Zak <kzak@redhat.com>
4 years agoirqtop: add struct irq_output
Karel Zak [Fri, 6 Mar 2020 12:38:02 +0000 (13:38 +0100)] 
irqtop: add struct irq_output

* add irq_output to keep top-like stufff independent on data
  management

* remove horrible "const"

Signed-off-by: Karel Zak <kzak@redhat.com>
4 years agoirqtop: keep table in functions only
Karel Zak [Fri, 6 Mar 2020 11:56:56 +0000 (12:56 +0100)] 
irqtop: keep table in functions only

Signed-off-by: Karel Zak <kzak@redhat.com>
4 years agoirqtop: remove dead code
Karel Zak [Fri, 6 Mar 2020 11:46:45 +0000 (12:46 +0100)] 
irqtop: remove dead code

Signed-off-by: Karel Zak <kzak@redhat.com>
4 years agoirqtop: separate normal and ncurses way
Karel Zak [Fri, 6 Mar 2020 11:44:16 +0000 (12:44 +0100)] 
irqtop: separate normal and ncurses way

Signed-off-by: Karel Zak <kzak@redhat.com>
4 years agoirqtop: remove unnecessary code
Karel Zak [Fri, 6 Mar 2020 11:36:41 +0000 (12:36 +0100)] 
irqtop: remove unnecessary code

* remove unused code smp_num_cpus
* care about hostname and timer only real top-like output

Signed-off-by: Karel Zak <kzak@redhat.com>
4 years agoirqtop: keep WINDOW pointer in functions only
Karel Zak [Fri, 6 Mar 2020 11:32:39 +0000 (12:32 +0100)] 
irqtop: keep WINDOW pointer in functions only

Signed-off-by: Karel Zak <kzak@redhat.com>
4 years agoirqtop: separate screen and scols code
Karel Zak [Fri, 6 Mar 2020 11:25:40 +0000 (12:25 +0100)] 
irqtop: separate screen and scols code

Signed-off-by: Karel Zak <kzak@redhat.com>
4 years agoirqtop: reorder function
Karel Zak [Fri, 6 Mar 2020 11:12:12 +0000 (12:12 +0100)] 
irqtop: reorder function

Move functions to make next changes more readable.

Signed-off-by: Karel Zak <kzak@redhat.com>
4 years agoirqtop: cleanup command line options
Karel Zak [Fri, 6 Mar 2020 10:40:49 +0000 (11:40 +0100)] 
irqtop: cleanup command line options

* use -o for output columns (like we have in another tools)
* support -o +COLUMN

Signed-off-by: Karel Zak <kzak@redhat.com>
4 years agoirqtop: trim white spaces from end of name field
Sami Kerola [Wed, 4 Mar 2020 21:39:07 +0000 (21:39 +0000)] 
irqtop: trim white spaces from end of name field

Excess white spaces were easiest to see in json output.

    $ irqtop --once --json
    {
       "interrupts": [
          {"irq":"LOC", "total":7425148, "name":"Local timer interrupts "},
          {"irq":"51", "total":1848384, "name":"IR-PCI-MSI 32768-edge i915 "},
          {"irq":"RES", "total":1176665, "name":"Rescheduling interrupts "},
          ...

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
4 years agoirqtop: use -J for JSON
Karel Zak [Wed, 4 Mar 2020 13:58:18 +0000 (14:58 +0100)] 
irqtop: use -J for JSON

* add -J to the man page
* add note about default output
* be compatible with another util-linux tools and use -J

Signed-off-by: Karel Zak <kzak@redhat.com>
4 years agoirqtop: don't print header for --once
Karel Zak [Wed, 4 Mar 2020 13:51:12 +0000 (14:51 +0100)] 
irqtop: don't print header for --once

We don't use any extra header for lsblk, lsmem, ... so don't make it
different.

Signed-off-by: Karel Zak <kzak@redhat.com>
4 years agoirqtop: simplify terminal resizing
Karel Zak [Wed, 4 Mar 2020 13:47:20 +0000 (14:47 +0100)] 
irqtop: simplify terminal resizing

* don't care about term size and attrs when runs only once
* explicitly define signals
* resize immediately after SIGWINCH (to keep it nice for users)

Signed-off-by: Karel Zak <kzak@redhat.com>
4 years agoiqrtop: cleanup header
Karel Zak [Wed, 4 Mar 2020 13:17:27 +0000 (14:17 +0100)] 
iqrtop: cleanup header

* add '|' to make it more readable
* use time string without 'T'

Signed-off-by: Karel Zak <kzak@redhat.com>
4 years agorev: report line on error
Karel Zak [Wed, 4 Mar 2020 12:20:56 +0000 (13:20 +0100)] 
rev: report line on error

Signed-off-by: Karel Zak <kzak@redhat.com>
4 years agolscpu: use official name for HiSilicon tsv110
Karel Zak [Wed, 4 Mar 2020 11:54:24 +0000 (12:54 +0100)] 
lscpu: use official name for HiSilicon tsv110

Addresses: https://github.com/karelzak/util-linux/issues/969
Signed-off-by: Karel Zak <kzak@redhat.com>
4 years agoMerge branch 'topic/fdisk'
Karel Zak [Tue, 3 Mar 2020 15:22:10 +0000 (16:22 +0100)] 
Merge branch 'topic/fdisk'

4 years agofdisk: add support for parttype aliases
Karel Zak [Tue, 3 Mar 2020 15:10:02 +0000 (16:10 +0100)] 
fdisk: add support for parttype aliases

* add list of supported aliases to 'l' and 'L' output
* support aliases in 't' dialog

For example (use 'swap' to set 0x82 partition type):

 Command (m for help): t
 Selected partition 1
 Hex code or alias (type L to list all): swap
 Changed type of partition 'Linux' to 'Linux swap / Solaris'.

Note that the aliases are evaluated as the last possibility if user's
input dues not match up with any partition type. This is necessary for
backward compatibility.

This patch does NOT introduce shortcuts (.e.g. 'S' for swap) to
fdisk(8) due to collisions with already used dialog keys.

Addresses: https://github.com/karelzak/util-linux/issues/958
Signed-off-by: Karel Zak <kzak@redhat.com>
4 years agosfdisk: extend --part-type, support aliases
Karel Zak [Tue, 3 Mar 2020 15:07:00 +0000 (16:07 +0100)] 
sfdisk: extend --part-type, support aliases

* add support for aliases to sfdisk scripts
* add shortcuts and aliases to --part-type command

Note that --part-type evaluates shortcuts and aliases as the last
possibility (so after regular type string). This is necessary for
backward compatibility.

Example ('raid' type alias):
 # sfdisk --part-type /dev/sdc 1 raid

 # fdisk -l /dev/sdc
 ...
 Device     Boot Start    End Sectors Size Id Type
 /dev/sdc1        2048 204799  202752  99M fd Linux raid autodetect

Example ('L' type shortcut):

 # sfdisk --part-type /dev/sdc 1 L

 # fdisk -l /dev/sdc
 ...
 Device     Boot Start    End Sectors Size Id Type
 /dev/sdc1        2048 204799  202752  99M 83 Linux

Addresses: https://github.com/karelzak/util-linux/issues/958
Signed-off-by: Karel Zak <kzak@redhat.com>
4 years agolibfdisk: add partition type aliases and shortcuts
Karel Zak [Tue, 3 Mar 2020 14:59:49 +0000 (15:59 +0100)] 
libfdisk: add partition type aliases and shortcuts

Now, the type shortcuts are supported for sfdisk scripts only.

Unfortunately, the current implementation is not generic enough
and it's also fragile as 'E' shortcut is in collision with 0x0E
type for MBR. The another issue is 'L' which makes shortcuts useless
for fdisk where 'L' is used for another purpose in dialogs.

This patch introduces partition type aliases as extension to
shortcuts. The definition of the shortcut is part of the label
definition and it's not more hardcoded in sfdisk script code.

This patch also introduces 'Ex' shortcut as replacement for (now
deprecated) 'E'.

Signed-off-by: Karel Zak <kzak@redhat.com>
4 years agolibmount: try read-only mount on write-protected superblock too
Karel Zak [Tue, 3 Mar 2020 10:39:10 +0000 (11:39 +0100)] 
libmount: try read-only mount on write-protected superblock too

The classic mount(8) behavior is to try read-only on write-protected devices
if the first mount syscall attempt ends with EACCES.

It seems we can implement this feature also for EBUSY if the same mount source
is already mounted with "ro" superblock option.

The typical use-case is iso image (always read-only) mounted on two places.

Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=1809124
Signed-off-by: Karel Zak <kzak@redhat.com>
4 years agolibmount: move "already mounted" code to separate function
Karel Zak [Tue, 3 Mar 2020 09:55:28 +0000 (10:55 +0100)] 
libmount: move "already mounted" code to separate function

Signed-off-by: Karel Zak <kzak@redhat.com>
4 years agosfdisk: fix previous --append patch, improve man page
Karel Zak [Mon, 2 Mar 2020 13:41:39 +0000 (14:41 +0100)] 
sfdisk: fix previous --append patch, improve man page

- fix stupid typo (!has_container_or_unused(sf))
- use fdisk_is_partition_used() as fdisk_get_partition() returns
  nothing for unused partition
- update tests
- add more hints to the man page

Addresses: https://github.com/calamares/calamares/issues/1332
Signed-off-by: Karel Zak <kzak@redhat.com>
4 years agosfdisk: fix --append to PT with gaps
Karel Zak [Mon, 2 Mar 2020 11:27:36 +0000 (12:27 +0100)] 
sfdisk: fix --append to PT with gaps

sfdisk trying to be more smart than libfdisk when analyze if we can
append to the current PT. libfdisk is able to use unused partition
to create a new one (if partno not strictly specified), but sfdisk
assumes that we can add partition to extended partition only.

Addresses: https://github.com/calamares/calamares/issues/1332
Signed-off-by: Karel Zak <kzak@redhat.com>
4 years agodocs: add note about AsciiDocs
Karel Zak [Thu, 27 Feb 2020 13:56:46 +0000 (14:56 +0100)] 
docs: add note about AsciiDocs

Signed-off-by: Karel Zak <kzak@redhat.com>
4 years agolibuuid: add uuid_parse_range() to man page and symbol-table
Karel Zak [Thu, 27 Feb 2020 13:52:06 +0000 (14:52 +0100)] 
libuuid: add uuid_parse_range() to man page and symbol-table

Signed-off-by: Karel Zak <kzak@redhat.com>
4 years agoMerge branch 'libuuid-range' of https://github.com/UQ-RCC/util-linux
Karel Zak [Thu, 27 Feb 2020 13:44:43 +0000 (14:44 +0100)] 
Merge branch 'libuuid-range' of https://github.com/UQ-RCC/util-linux

* 'libuuid-range' of https://github.com/UQ-RCC/util-linux:
  libuuid: add uuid_parse_range()

4 years agosu, runuser: (man) add more info about PATH and PAM
Karel Zak [Thu, 27 Feb 2020 13:37:23 +0000 (14:37 +0100)] 
su, runuser: (man) add more info about PATH and PAM

Addresses: https://github.com/karelzak/util-linux/issues/964
Signed-off-by: Karel Zak <kzak@redhat.com>
4 years agohwclock: fix audit exit status
Karel Zak [Thu, 27 Feb 2020 13:04:55 +0000 (14:04 +0100)] 
hwclock: fix audit exit status

According to audit_log_user_message(3) result 1 is "success" and 0 is
"failed", we use standard EXIT_{SUCCESS,FAILURE} macros with reverse
status.

Addresses: https://github.com/karelzak/util-linux/issues/966
Signed-off-by: Karel Zak <kzak@redhat.com>
4 years agochsh: (man) fix default behavior description
Karel Zak [Thu, 27 Feb 2020 12:54:05 +0000 (13:54 +0100)] 
chsh: (man) fix default behavior description

Addresses: https://github.com/karelzak/util-linux/issues/967
Signed-off-by: Karel Zak <kzak@redhat.com>
4 years agofindmnt: make xalloc use mroe robust
Karel Zak [Thu, 27 Feb 2020 09:02:39 +0000 (10:02 +0100)] 
findmnt: make xalloc use mroe robust

Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=1807003
Signed-off-by: Karel Zak <kzak@redhat.com>
4 years agolsblk: fix -P regression from v2.34
Karel Zak [Tue, 25 Feb 2020 14:31:23 +0000 (15:31 +0100)] 
lsblk: fix -P regression from v2.34

Since v2.34 --list prints devices only once to make the output
user-readable. Unfortunately, it's regression for scripts/applications
where we need to parse lsblk output. So, let's make --pairs and --raw
backwardly compatible with versions before 2.34 and print all hierarchy.

Addresses: https://github.com/ibm-s390-tools/s390-tools/issues/80
Signed-off-by: Karel Zak <kzak@redhat.com>
4 years agolibfdisk: (gpt) partition name default to empty string
Karel Zak [Tue, 25 Feb 2020 11:39:26 +0000 (12:39 +0100)] 
libfdisk: (gpt) partition name default to empty string

Just for backward compatibility, otherwise it's strange ;-)

Signed-off-by: Karel Zak <kzak@redhat.com>
4 years agolibfdisk: add missing comments
Karel Zak [Tue, 25 Feb 2020 11:25:17 +0000 (12:25 +0100)] 
libfdisk: add missing comments

Signed-off-by: Karel Zak <kzak@redhat.com>
4 years agolibfdisk: use ul_encode_to_utf8()
Karel Zak [Tue, 25 Feb 2020 11:21:32 +0000 (12:21 +0100)] 
libfdisk: use ul_encode_to_utf8()

Signed-off-by: Karel Zak <kzak@redhat.com>
4 years agolibblkid: fix compiler warning [-Wsign-compare]
Karel Zak [Tue, 25 Feb 2020 11:06:06 +0000 (12:06 +0100)] 
libblkid: fix compiler warning [-Wsign-compare]

libblkid/src/superblocks/exfat.c: In function ‘probe_exfat’:
./include/c.h:133:17: warning: comparison of distinct pointer types lacks a cast
libblkid/src/superblocks/exfat.c:129:5: note: in expansion of macro ‘min’
./include/c.h:134:8: warning: comparison of integer expressions of different signedness: ‘int’ and ‘long unsigned int’ [-Wsign-compare]

Signed-off-by: Karel Zak <kzak@redhat.com>
4 years agolibblkid: move UTF encoding function to lib/
Karel Zak [Tue, 25 Feb 2020 11:00:27 +0000 (12:00 +0100)] 
libblkid: move UTF encoding function to lib/

Let's consolidate the code, we need to use it in libfdisk too. It
seems better to keep it generic and libblkid independent.

This patch also removes blkid_encode_alloc(), this function is overkill.

Signed-off-by: Karel Zak <kzak@redhat.com>
4 years agolibuuid: add uuid_parse_range()
Zane van Iperen [Tue, 5 Nov 2019 07:21:17 +0000 (17:21 +1000)] 
libuuid: add uuid_parse_range()

For compatibility with C++'s std::string_view, et al.

Signed-off-by: Zane van Iperen <z.vaniperen@uq.edu.au>
4 years agodocs: remove irqtop TODO item
Sami Kerola [Mon, 24 Feb 2020 18:27:16 +0000 (18:27 +0000)] 
docs: remove irqtop TODO item

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
4 years agoirqtop: tidy coding style and update usage() text
Sami Kerola [Mon, 24 Feb 2020 18:26:38 +0000 (18:26 +0000)] 
irqtop: tidy coding style and update usage() text

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
4 years agohwclock: make glibc 2.31 compatible
J William Piggott [Sat, 22 Feb 2020 01:03:47 +0000 (20:03 -0500)] 
hwclock: make glibc 2.31 compatible

______________________________________________________
GNU C Library NEWS -- history of user-visible changes.
Version 2.31
Deprecated and removed features, and other changes affecting compatibility:

* The settimeofday function can still be used to set a system-wide time
  zone when the operating system supports it.  This is because the Linux
  kernel reused the API, on some architectures, to describe a system-wide
  time-zone-like offset between the software clock maintained by the kernel,
  and the "RTC" clock that keeps time when the system is shut down.

  However, to reduce the odds of this offset being set by accident,
  settimeofday can no longer be used to set the time and the offset
  simultaneously.  If both of its two arguments are non-null, the call
  will fail (setting errno to EINVAL).

  Callers attempting to set this offset should also be prepared for the call
  to fail and set errno to ENOSYS; this already happens on the Hurd and on
  some Linux architectures.  The Linux kernel maintainers are discussing a
  more principled replacement for the reused API.  After a replacement
  becomes available, we will change settimeofday to fail with ENOSYS on all
  platforms when its 'tzp' argument is not a null pointer.

  settimeofday itself is obsolescent according to POSIX.  Programs that set
  the system time should use clock_settime and/or the adjtime family of
  functions instead.  We may cease to make settimeofday available to newly
  linked binaries after there is a replacement for Linux's time-zone-like
  offset API.
______________________________________________________

hwclock(8) had one settimeofday(2) call where both args were set for
--hctosys when the RTC was ticking UTC. This allowed setting the system
time, timezone, and locking the warp_clock function with a single call.
That operation now takes 3 calls of settimeofday(2).

Although this common operation now takes three calls, the overall logic
for the set_system_clock() function was simplified.

Co-Author: Karel Zak <kzak@redhat.com>
Signed-off-by: J William Piggott <elseifthen@gmx.com>
4 years agoumount: don't try it as non-suid if not found mountinfo entry
Karel Zak [Mon, 24 Feb 2020 12:02:09 +0000 (13:02 +0100)] 
umount: don't try it as non-suid if not found mountinfo entry

Addresses: https://github.com/karelzak/util-linux/issues/961
Signed-off-by: Karel Zak <kzak@redhat.com>
4 years agoirqtop: do not use fixed size /proc/interrupts line buffer
Sami Kerola [Sun, 23 Feb 2020 07:39:11 +0000 (07:39 +0000)] 
irqtop: do not use fixed size /proc/interrupts line buffer

Allocating and freeing all the time is a little bit heavier, but it is also
more robust.  It is impossible to know if field lenghts stay fixed.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
4 years agoirqtop: add total and delta as own columns
Sami Kerola [Sat, 22 Feb 2020 16:42:56 +0000 (16:42 +0000)] 
irqtop: add total and delta as own columns

This commit add total and delta as separate columns rather than a toggle,
making output generally more informative.  When using command I found that
sort order key bindings should match with first letter of column headers so
that they are as easy as possible to remember, and therefore enhancing user
experience.

Requested-by: Karel Zak <kzak@redhat.com>
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
4 years agoirqtop: use name instead of desc as irq name field referal
Sami Kerola [Sat, 22 Feb 2020 15:19:09 +0000 (15:19 +0000)] 
irqtop: use name instead of desc as irq name field referal

This matches with sort order n for name, and allows later usage of d for
delta without needing to go around d for description.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
4 years agoirqtop: improve header
Sami Kerola [Sat, 22 Feb 2020 14:48:55 +0000 (14:48 +0000)] 
irqtop: improve header

Change total to display delta or count depending on run mode.  Add space in
between header and irqtop body.  Print only number of active CPU in header.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
4 years agoirqtop: hide cursor when in interactive mode
Sami Kerola [Sat, 22 Feb 2020 08:12:59 +0000 (08:12 +0000)] 
irqtop: hide cursor when in interactive mode

Visible cursor is distraction.  Secondly with visible cursor key commands
can be visible adding unwanted characters to end of output.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
4 years agoirqtop: display number of new interupts in-between updates
Sami Kerola [Fri, 21 Feb 2020 22:28:43 +0000 (22:28 +0000)] 
irqtop: display number of new interupts in-between updates

The rirst output is total count followed by number of interupts since
previous screen update.  This is how the irqtop worked before libsmartcols
was added to the command.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
4 years agoirqtop: add bash-completion
Sami Kerola [Sat, 8 Feb 2020 16:28:52 +0000 (16:28 +0000)] 
irqtop: add bash-completion

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
4 years agoirqtop: add manual page
Sami Kerola [Sat, 8 Feb 2020 16:03:07 +0000 (16:03 +0000)] 
irqtop: add manual page

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
4 years agoirqtop: use libsmartcols
Sami Kerola [Sat, 8 Feb 2020 16:00:20 +0000 (16:00 +0000)] 
irqtop: use libsmartcols

This makes output to be automatically be nicely adjusted to optimal width.
In this commit also removes excess spaces from description strings.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
4 years agoirqtop: include hostname and timestamp to output header
Sami Kerola [Sun, 5 Jan 2020 10:40:12 +0000 (10:40 +0000)] 
irqtop: include hostname and timestamp to output header

Having a when and from where information is useful in situations when output
is examined later and possibly elsewhere.  Typical example would be a
screenshot or output copy-paste of a terminal to a ticketing system.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
4 years agoirqtop: use epoll event loop
Sami Kerola [Sun, 5 Jan 2020 09:27:19 +0000 (09:27 +0000)] 
irqtop: use epoll event loop

The event loop takes care of the standard screen updates, signals, and user
inputs.  Two nice things using even loop like this are; 1) no need for any
global variables and 2) effect of user commands is immediate.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
4 years agoirqtop: move screen update to a separate function
Sami Kerola [Sun, 5 Jan 2020 09:00:28 +0000 (09:00 +0000)] 
irqtop: move screen update to a separate function

The main() was too long.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
4 years agoirqtop: fix open file descriptor leak
Sami Kerola [Sat, 4 Jan 2020 09:35:19 +0000 (09:35 +0000)] 
irqtop: fix open file descriptor leak

With very short delay one can see irqfile file descriptors pile up rather
quickly causing program to stop with too many open files error.  This commit
fixes that, and removes couple other memory leaks.  With these the command
should hopefully run fine for days if not even months.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
4 years agoirqtop: change the update delay to use struct timeval
Sami Kerola [Sat, 4 Jan 2020 08:32:42 +0000 (08:32 +0000)] 
irqtop: change the update delay to use struct timeval

The struct timeval is more expressive, and it allows use of fractional and
subsecond intervals.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
4 years agoirqtop: use runtime control structure
Sami Kerola [Sat, 4 Jan 2020 08:08:17 +0000 (08:08 +0000)] 
irqtop: use runtime control structure

This is pretty standard util-linux way to avoid global variables, and pass
runtime configuration around.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
4 years agoirqtop: use lib/monotonic.c to determine uptime
Sami Kerola [Sat, 4 Jan 2020 07:45:43 +0000 (07:45 +0000)] 
irqtop: use lib/monotonic.c to determine uptime

This should be functionally the same, and has the advantage of avoiding
duplicated code.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
4 years agoirqtop: use memory allocation that check errors
Sami Kerola [Sat, 4 Jan 2020 07:40:49 +0000 (07:40 +0000)] 
irqtop: use memory allocation that check errors

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
4 years agoirqtop: avoid function like pre-processor definitions
Sami Kerola [Sat, 4 Jan 2020 07:33:01 +0000 (07:33 +0000)] 
irqtop: avoid function like pre-processor definitions

And simplify how terminal size determination.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
4 years agoirqtop: use util-linux libcommon facilities
Sami Kerola [Fri, 3 Jan 2020 21:06:43 +0000 (21:06 +0000)] 
irqtop: use util-linux libcommon facilities

Including NLS support.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
4 years agoirqtop: make util-linux build-system to build the command
Sami Kerola [Fri, 3 Jan 2020 20:38:38 +0000 (20:38 +0000)] 
irqtop: make util-linux build-system to build the command

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
4 years agoirctop: move source code to sys-utils/ directory
Sami Kerola [Sat, 8 Feb 2020 17:07:18 +0000 (17:07 +0000)] 
irctop: move source code to sys-utils/ directory

And remove files that util-linux does not need from the earlier repository.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
4 years agoirqtop: fix all warnings
zhenwei pi [Wed, 25 Dec 2019 09:56:07 +0000 (17:56 +0800)] 
irqtop: fix all warnings

use -Wall for compiling flags, and fix all warnings.

Signed-off-by: zhenwei pi <pizhenwei@bytedance.com>