]> git.ipfire.org Git - thirdparty/util-linux.git/log
thirdparty/util-linux.git
4 years agolibuuid: ensure variable is initialized [cppcheck]
Sami Kerola [Sat, 29 Feb 2020 08:51:53 +0000 (08:51 +0000)] 
libuuid: ensure variable is initialized [cppcheck]

This fix has a little bit of a feel of making a static analyzer to be happy
instead of real progress.  If I read the preprocessor directives correctly
it should be impossible hit uninitialized variable.  Then again if a bug
creeps into these ifdef's in that case it is nice to have robust code that
doesn't immediately go wrong.

    libuuid/src/gen_uuid.c:200:20: error: Uninitialized variable: a [uninitvar]
       memcpy(node_id, a, 6);
                       ^
    libuuid/src/gen_uuid.c:197:8: error: Uninitialized variable: a [uninitvar]
      if (!a[0] && !a[1] && !a[2] && !a[3] && !a[4] && !a[5])
           ^

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
4 years agoctrlaltdel: display error message indicated by errno
Sami Kerola [Tue, 25 Feb 2020 21:30:19 +0000 (21:30 +0000)] 
ctrlaltdel: display error message indicated by errno

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
4 years agolibmount: make mnt_context_find_umount_fs() more extendable
Karel Zak [Fri, 27 Mar 2020 10:34:12 +0000 (11:34 +0100)] 
libmount: make mnt_context_find_umount_fs() more extendable

Signed-off-by: Karel Zak <kzak@redhat.com>
4 years agolibmount: (umount) FS lookup refactoring
Karel Zak [Fri, 27 Mar 2020 10:10:26 +0000 (11:10 +0100)] 
libmount: (umount) FS lookup refactoring

Let's split lookup to more function to make it easy to add another
lookup method.

Signed-off-by: Karel Zak <kzak@redhat.com>
4 years agoblkzone: ioctl related code refactoring
Damien Le Moal [Thu, 26 Mar 2020 10:27:50 +0000 (11:27 +0100)] 
blkzone: ioctl related code refactoring

[kzak@redhat.com: - generate patch from Damien's v3
                  - make commands[] initialization more robust]

Signed-off-by: Aravind Ramesh <Aravind.Ramesh@wdc.com>
Signed-off-by: Damien Le Moal <damien.lemoal@wdc.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
4 years agoblkzone: add open/close/finish commands
Aravind Ramesh [Tue, 24 Mar 2020 10:02:17 +0000 (19:02 +0900)] 
blkzone: add open/close/finish commands

Introduce blkzone open, close and finish commands, issuing BLKOPENZONE,
BLKCLOSEZONE and BLKFINISHZONE ioctl commands to open, close or finish
a range of zones of a zoned block device.

Since these three commands are similar to the existing zone reset
command, the existing zone reset command implementation is changed into
the generic blkzone_action() internal handler function for processing
all zone actions.

The BLKOPENZONE, BLKCLOSEZONE and BLKFINISHZONE ioctl commands codes are
defined in linux/blkzoned.h starting with kernel version 5.5. To ensure
that the blkzone utility compiles even with older blkzoned.h kernel
header versions, these ioctl commands are internally defined if the
blkzoned.h header definition is not present. Execution of these commands
on kernels older than 5.5 will result in a -ENOTTY error (missing
ioctl).

Signed-off-by: Aravind Ramesh <Aravind.Ramesh@wdc.com>
Signed-off-by: Damien Le Moal <damien.lemoal@wdc.com>
Tested-by: Hans Holmberg <Hans.Holmberg@wdc.com>
Reviewed-by: Hans Holmberg <Hans.Holmberg@wdc.com>
4 years agotests: cleanup fdisk based stuff
Karel Zak [Tue, 24 Mar 2020 13:30:16 +0000 (14:30 +0100)] 
tests: cleanup fdisk based stuff

* use fdisk --noauto-pt to avoid re-creation of the default architecture specific PT
* use more verbose "Created a new" messages in the output

Signed-off-by: Karel Zak <kzak@redhat.com>
4 years agofdisk: make sure label defined for some menu entries
Karel Zak [Tue, 24 Mar 2020 11:00:28 +0000 (12:00 +0100)] 
fdisk: make sure label defined for some menu entries

Signed-off-by: Karel Zak <kzak@redhat.com>
4 years agofdisk: add --noauto-pt
Karel Zak [Tue, 24 Mar 2020 10:17:34 +0000 (11:17 +0100)] 
fdisk: add --noauto-pt

The default partition table depends on system arch, for example on
Sparc it's SUN and on x86_64 it's MBR. This option forces fdisk to
keep the device empty and allow user to create non-default PT in more
elegant way.

Addresses: https://github.com/karelzak/util-linux/pull/994
Signed-off-by: Karel Zak <kzak@redhat.com>
4 years agolibfdisk: remove unwanted assert()
Karel Zak [Tue, 24 Mar 2020 09:52:54 +0000 (10:52 +0100)] 
libfdisk: remove unwanted assert()

Signed-off-by: Karel Zak <kzak@redhat.com>
4 years agoRevert "tests: fixes fdisk/align-512-* tests"
Karel Zak [Tue, 24 Mar 2020 09:48:55 +0000 (10:48 +0100)] 
Revert "tests: fixes fdisk/align-512-* tests"

This reverts commit 25f5c514b95e1bf55d5f4bb1717fe2ec7e09d63b.

4 years agoMerge branch 'fdisk-sparc' of https://github.com/mator/util-linux
Karel Zak [Mon, 23 Mar 2020 15:35:32 +0000 (16:35 +0100)] 
Merge branch 'fdisk-sparc' of https://github.com/mator/util-linux

* 'fdisk-sparc' of https://github.com/mator/util-linux:
  tests: fixes fdisk/align-512-* tests

4 years agotests: fixes fdisk/align-512-* tests
Anatoly Pugachev [Mon, 23 Mar 2020 14:23:01 +0000 (17:23 +0300)] 
tests: fixes fdisk/align-512-* tests

write 'MSDOS' partition table before test

Signed-off-by: Anatoly Pugachev <matorola@gmail.com>
4 years agolibblkid: remove unnecessary uuid.h
Karel Zak [Mon, 23 Mar 2020 14:21:48 +0000 (15:21 +0100)] 
libblkid: remove unnecessary uuid.h

Addresses: https://github.com/karelzak/util-linux/issues/993
Signed-off-by: Karel Zak <kzak@redhat.com>
4 years agoMerge branch 'eject-sparc' of https://github.com/mator/util-linux
Karel Zak [Mon, 23 Mar 2020 11:14:57 +0000 (12:14 +0100)] 
Merge branch 'eject-sparc' of https://github.com/mator/util-linux

* 'eject-sparc' of https://github.com/mator/util-linux:
  tests: fixes mount tests on SPARC
  tests: fixes libmount/ on SPARC
  tests: fixes eject/umount on SPARC

4 years agolibblkid: Add support for zonefs
Damien Le Moal [Fri, 20 Mar 2020 04:55:43 +0000 (13:55 +0900)] 
libblkid: Add support for zonefs

The zonefs filesystem was added to upstream linux kernel 5.6. This
patch add support for probing zonefs formatted zoned block devices so
that other file system formatting tool can detect its presence on a
device.

[kzak@redhat.com: - use standard integer types]

Signed-off-by: Damien Le Moal <damien.lemoal@wdc.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
4 years agoMerge branch 'man-kill' of https://github.com/kerolasa/util-linux
Karel Zak [Mon, 23 Mar 2020 09:28:16 +0000 (10:28 +0100)] 
Merge branch 'man-kill' of https://github.com/kerolasa/util-linux

* 'man-kill' of https://github.com/kerolasa/util-linux:
  docs: kill.1 add note about shell-internal kill implementations

4 years agoMerge branch 'libfdisk-script-fix-segmentation-fault' of https://github.com/gportay...
Karel Zak [Mon, 23 Mar 2020 09:27:53 +0000 (10:27 +0100)] 
Merge branch 'libfdisk-script-fix-segmentation-fault' of https://github.com/gportay/util-linux

* 'libfdisk-script-fix-segmentation-fault' of https://github.com/gportay/util-linux:
  lib/mangle: check for the NULL string argument
  libfdisk: (script) fix segmentation fault

4 years agodocs: kill.1 add note about shell-internal kill implementations
Sami Kerola [Sun, 22 Mar 2020 09:37:41 +0000 (09:37 +0000)] 
docs: kill.1 add note about shell-internal kill implementations

Requested-by: Ilia Baryshnikov <qwelias@gmail.com>
Reference: https://github.com/karelzak/util-linux/issues/991#issuecomment-602108648
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
4 years agolib/mangle: check for the NULL string argument
Gaël PORTAY [Fri, 20 Mar 2020 20:21:58 +0000 (16:21 -0400)] 
lib/mangle: check for the NULL string argument

This patch prevents to call the function strlen() with a NULL string
argument that leads to a segmentation fault.

Signed-off-by: Gaël PORTAY <gael.portay@collabora.com>
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 agoFix typo in the mount (8) man page
Mark Barbone [Thu, 19 Mar 2020 22:13:46 +0000 (18:13 -0400)] 
Fix typo in the mount (8) man page

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 agotests: fixes mount tests on SPARC
Anatoly Pugachev [Tue, 10 Mar 2020 22:05:50 +0000 (01:05 +0300)] 
tests: fixes mount tests on SPARC

fdisk partition table fix for writting "msdos" label before the test

Signed-off-by: Anatoly Pugachev <matorola@gmail.com>
4 years agotests: fixes libmount/ on SPARC
Anatoly Pugachev [Tue, 10 Mar 2020 17:24:40 +0000 (20:24 +0300)] 
tests: fixes libmount/ on SPARC

fdisk partition table fix for writting "msdos" label before test

Signed-off-by: Anatoly Pugachev <matorola@gmail.com>
4 years agotests: fixes eject/umount on SPARC
Anatoly Pugachev [Tue, 10 Mar 2020 16:16:01 +0000 (19:16 +0300)] 
tests: fixes eject/umount on SPARC

Since SPARC is using 'sun' partition table by default, make test not to
assume that disk has 'dos' partition table, so write 'dos' partition
table on disk, before proceeding any further.

Signed-off-by: Anatoly Pugachev <matorola@gmail.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>