]> git.ipfire.org Git - thirdparty/util-linux.git/log
thirdparty/util-linux.git
5 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>
5 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>
5 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>
5 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>
5 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>
5 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>
5 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>
5 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>
5 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>
5 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>
5 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>
5 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>
5 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>
5 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>
5 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>
5 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>
5 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>
5 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>
5 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>
5 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>
5 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>
5 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>
5 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>
5 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>
5 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>
5 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>
5 years agoirqtop: init README
zhenwei pi [Mon, 11 Nov 2019 12:51:12 +0000 (20:51 +0800)] 
irqtop: init README

add basic infomation in README

Signed-off-by: zhenwei pi <pizhenwei@bytedance.com>
5 years agoirqtop: implement a new utility to display kernel interrupt
zhenwei pi [Mon, 11 Nov 2019 12:48:59 +0000 (20:48 +0800)] 
irqtop: implement a new utility to display kernel interrupt

currently, there are usually 40/48/64/96 CPUs on a single server,
and a lot of interrupts are enabled by multi-queues of a NIC.
"/proc/interrupts" is not human readable any more.
'watch -d -n 1 "cat /proc/interrupts"' also can not work well.

so implement irqtop to show the interrupts information, we can
sort the interrupts by count(default), name and /proc/interrupts.

irqtop - IRQ : 49, TOTAL : 2361705032, CPU : 8, ACTIVE CPU : 8
 IRQ        COUNT   DESC
 CAL        21196   Function call interrupts
 LOC        13733   Local timer interrupts
 154         1430   IR-PCI-MSI 32768-edge      i915
 127         1322   IR-PCI-MSI 327680-edge      xhci_hcd
 RES         1224   Rescheduling interrupts
 146          336   IR-PCI-MSI 520192-edge      enp0s31f6
 IWI          135   IRQ work interrupts
 147           48   IR-PCI-MSI 31981569-edge      nvme0q2
 151           42   IR-PCI-MSI 31981573-edge      nvme0q6
 TLB            8   TLB shootdowns
 150            7   IR-PCI-MSI 31981572-edge      nvme0q5
 152            5   IR-PCI-MSI 31981574-edge      nvme0q7
 156            4   IR-PCI-MSI 1572864-edge      iwlwifi
 148            3   IR-PCI-MSI 31981570-edge      nvme0q3
 153            2   IR-PCI-MSI 31981575-edge      nvme0q8
 NMI            2   Non-maskable interrupts
 PMI            2   Performance monitoring interrupts
   0            0   IR-IO-APIC    2-edge      timer
   1            0   IR-IO-APIC    1-edge      i8042
   8            0   IR-IO-APIC    8-edge      rtc0
   9            0   IR-IO-APIC    9-fasteoi   acpi
  12            0   IR-IO-APIC   12-edge      i8042

test on 4.14 & 4.19, work fine. test on bare metal & kvm virtual
machine, work fine. hot-plug/hot-unplug virtual NIC during running
irqtop, work fine.

Signed-off-by: zhenwei pi <pizhenwei@bytedance.com>
5 years agoMerge branch 'master' of https://github.com/benfrankel/util-linux
Karel Zak [Fri, 21 Feb 2020 08:29:48 +0000 (09:29 +0100)] 
Merge branch 'master' of https://github.com/benfrankel/util-linux

* 'master' of https://github.com/benfrankel/util-linux:
  docs: Improve grammar

5 years agodocs: Improve grammar
Ben Frankel [Fri, 21 Feb 2020 00:46:47 +0000 (16:46 -0800)] 
docs: Improve grammar

5 years agofdisk: update expected test outputs with command outputs
Sami Kerola [Thu, 20 Feb 2020 21:19:37 +0000 (21:19 +0000)] 
fdisk: update expected test outputs with command outputs

Reference; https://github.com/karelzak/util-linux/pull/959
Addresses: 5d271cefad0d7a5b4d2fb4fa0f26c1e341f1354c
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
5 years agovarious: fix more lgtm scan warnings
Sami Kerola [Thu, 20 Feb 2020 20:08:00 +0000 (20:08 +0000)] 
various: fix more lgtm scan warnings

The logger and rtwake time function changes continue the same fixes as
previous commit - use thread safe functions.  The libsmartcols condition
removal is possible because width must be greater than tb->termwidth that is
size_t and cannot be smaller than zero.  And remove couple FIXME's that are
old and unlikely ever to get fixed.

Reference: 3160589d86470ce7d20c81090fb7f211b3822053
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
5 years agofdisk: improve list-types readability
Karel Zak [Thu, 20 Feb 2020 14:27:05 +0000 (15:27 +0100)] 
fdisk: improve list-types readability

Signed-off-by: Karel Zak <kzak@redhat.com>
5 years agosfdisk: (man) add note about type and shortcuts collision
Karel Zak [Thu, 20 Feb 2020 14:26:28 +0000 (15:26 +0100)] 
sfdisk: (man) add note about type and shortcuts collision

Signed-off-by: Karel Zak <kzak@redhat.com>
5 years agoMerge branch 'master' of https://github.com/pali/util-linux
Karel Zak [Tue, 18 Feb 2020 13:06:09 +0000 (14:06 +0100)] 
Merge branch 'master' of https://github.com/pali/util-linux

* 'master' of https://github.com/pali/util-linux:
  exfat: Fix parsing exfat label

5 years agoMerge branch 'various-fixes' of https://github.com/kerolasa/util-linux
Karel Zak [Tue, 18 Feb 2020 13:02:41 +0000 (14:02 +0100)] 
Merge branch 'various-fixes' of https://github.com/kerolasa/util-linux

* 'various-fixes' of https://github.com/kerolasa/util-linux:
  kill: include sys/types.h before checking SYS_pidfd_send_signal
  libfdisk: fix pointer wraparound warning
  hwclock: update yacc file
  script: fix minor warning
  getopt: use examples installation directory in man page
  fstrim: randomize timer start time across 100 minutes
  various: use threadsafe versions of time functions [lgtm scan]
  write: fix potential string overflow

5 years agoMerge branch 'parttype-var' of https://github.com/nl6720/util-linux
Karel Zak [Tue, 18 Feb 2020 09:00:55 +0000 (10:00 +0100)] 
Merge branch 'parttype-var' of https://github.com/nl6720/util-linux

* 'parttype-var' of https://github.com/nl6720/util-linux:
  libfdisk: add Linux /var, /var/tmp and root verity GPT partition types

5 years agolscpu: fix SIGSEGV on archs without drawers & books
Karel Zak [Mon, 17 Feb 2020 12:13:11 +0000 (13:13 +0100)] 
lscpu: fix SIGSEGV on archs without drawers & books

The drawers and books are optional and not supported on all
architectures and in this case drawers/books relevant arrays are not
allocated, so don't access it although user wants it
(e.g.  "lscpu -p -y --output-all").

This patch also cleans up arrays allocation to make it more readable
and robust against edit mistakes.

Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=1801760
Signed-off-by: Karel Zak <kzak@redhat.com>
5 years agokill: include sys/types.h before checking SYS_pidfd_send_signal
Sami Kerola [Sat, 15 Feb 2020 21:12:50 +0000 (21:12 +0000)] 
kill: include sys/types.h before checking SYS_pidfd_send_signal

Including sys/types.h must happen before SYS_pidfd_send_signal is checked,
because that header defines variable in normal conditions.  When sys/types.h
does not have SYS_pidfd_send_signal then fallback is defined in config.h
that is included by default, and has therefore worked fine before and after
this change.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
5 years agolibfdisk: fix pointer wraparound warning
Sami Kerola [Thu, 13 Feb 2020 21:28:37 +0000 (21:28 +0000)] 
libfdisk: fix pointer wraparound warning

libfdisk/src/gpt.c:1713:6: warning: assuming pointer wraparound does not
occur when comparing P +- C1 with P +- C2 [-Wstrict-overflow]

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
5 years agohwclock: update yacc file
Sami Kerola [Thu, 13 Feb 2020 20:57:53 +0000 (20:57 +0000)] 
hwclock: update yacc file

$ bison --update sys-utils/hwclock-parse-date.y
sys-utils/hwclock-parse-date.y:287.1-12: warning: deprecated directive:
‘%pure-parser’, use ‘%define api.pure’ [-Wdeprecated]

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
5 years agoscript: fix minor warning
Sami Kerola [Thu, 13 Feb 2020 20:47:51 +0000 (20:47 +0000)] 
script: fix minor warning

ICO C does not allow extra ‘;’ outside of a function [-Wpedantic]

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
5 years agogetopt: use examples installation directory in man page
Sami Kerola [Wed, 12 Feb 2020 21:05:54 +0000 (21:05 +0000)] 
getopt: use examples installation directory in man page

Addresses: https://bugs.debian.org/913049
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
5 years agofstrim: randomize timer start time across 100 minutes
Sami Kerola [Wed, 12 Feb 2020 20:35:22 +0000 (20:35 +0000)] 
fstrim: randomize timer start time across 100 minutes

It should not matter when exactly fstrim runs, so spread these tasks across
time to help server farms and such to simultanously get busy with io.

Addresses: https://bugs.launchpad.net/bugs/1833593
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
5 years agovarious: use threadsafe versions of time functions [lgtm scan]
Sami Kerola [Sun, 9 Feb 2020 22:14:56 +0000 (22:14 +0000)] 
various: use threadsafe versions of time functions [lgtm scan]

Deprecating calls to not-thread safe asctime(), ctime(), and localtime()
calls is pretty close to pointless change.  Lets do it to reduce lgtm scan
warnings with justification it's nicer to use static analysis tools when
they have very few positives.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
5 years agowrite: fix potential string overflow
Sami Kerola [Sat, 8 Feb 2020 21:12:14 +0000 (21:12 +0000)] 
write: fix potential string overflow

Noticed when compiled with gcc verion 9.2.1 20200130.

term-utils/write.c:182:7: warning: ‘strcmp’ argument 1 declared attribute
  ‘nonstring’ [-Wstringop-overflow=]
  182 |   if (strcmp(u->ut_line, ctl->src_tty_name) == 0) {
      |       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/utmpx.h:31,
                 from term-utils/write.c:60:
/usr/include/bits/utmpx.h:59:8: note: argument ‘ut_line’ declared here
   59 |   char ut_line[__UT_LINESIZE]
      |        ^~~~~~~

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
5 years agoexfat: Fix parsing exfat label
Pali Rohár [Wed, 12 Feb 2020 17:08:46 +0000 (18:08 +0100)] 
exfat: Fix parsing exfat label

According to released exfat specification, label is only 22 bytes long.

5 years agolibfdisk: add Linux /var, /var/tmp and root verity GPT partition types
nl6720 [Tue, 11 Feb 2020 10:04:02 +0000 (12:04 +0200)] 
libfdisk: add Linux /var, /var/tmp and root verity GPT partition types

See https://github.com/systemd/systemd/pull/14390 and https://systemd.io/DISCOVERABLE_PARTITIONS/ .

Also replace a stray tab with a space.

5 years agoMerge branch 'master' of https://github.com/pali/util-linux
Karel Zak [Mon, 10 Feb 2020 12:51:23 +0000 (13:51 +0100)] 
Merge branch 'master' of https://github.com/pali/util-linux

* 'master' of https://github.com/pali/util-linux:
  tests: Add UDF hdd image with emoji label created by mkudffs 2.2
  libblkid: Fix UTF-16 support in function blkid_encode_to_utf8()

5 years agotests: add sfdisk --dump test
Karel Zak [Mon, 10 Feb 2020 12:20:04 +0000 (13:20 +0100)] 
tests: add sfdisk --dump test

Signed-off-by: Karel Zak <kzak@redhat.com>
5 years agotests: Add UDF hdd image with emoji label created by mkudffs 2.2
Pali Rohár [Sun, 9 Feb 2020 12:04:39 +0000 (13:04 +0100)] 
tests: Add UDF hdd image with emoji label created by mkudffs 2.2

mkudffs 2.2 can create UDF filesystem which label contains Unicode code
points above U+FFFF which cannot be represented by UCS-2 encoding and
therefore UTF-16 needs to be used (via surrogate pairs). Unicode code
points above U+FFFF are encoded in UTF-8 by four bytes and some example is
emoji "😀".

This is test case to check that libblkid correctly supports UTF-16
decoding. It was created by mkudffs 2.2:

$ dd if=/dev/zero of=udf-hdd-mkudffs-2.2.img bs=1M count=10
$ mkudffs -l 😀 udf-hdd-mkudffs-2.2.img

5 years agolibblkid: Fix UTF-16 support in function blkid_encode_to_utf8()
Pali Rohár [Sun, 9 Feb 2020 12:04:34 +0000 (13:04 +0100)] 
libblkid: Fix UTF-16 support in function blkid_encode_to_utf8()

Function blkid_encode_to_utf8() says that is supports BLKID_ENC_UTF16LE and
BLKID_ENC_UTF16BE encodings, but it is not truth and supports only UCS-2
(and not full UTF-16).

As all places where BLKID_ENC_UTF16LE and BLKID_ENC_UTF16BE is used expects
UTF-16 and not UCS-2, this patch changes implementation of encodings
BLKID_ENC_UTF16LE and BLKID_ENC_UTF16BE to supports full UTF-16, including
surrogate pairs and not only UCS-2.

5 years agolibfdisk: (docs) fix typos
Karel Zak [Wed, 5 Feb 2020 13:50:05 +0000 (14:50 +0100)] 
libfdisk: (docs) fix typos

Signed-off-by: Karel Zak <kzak@redhat.com>
5 years agosfdisk: add --relocate command
Karel Zak [Wed, 5 Feb 2020 13:40:45 +0000 (14:40 +0100)] 
sfdisk: add --relocate command

This command allows to relocate GPT backup header behind last
partition (--relocate gpt-bak-mini) or to standard position
(--relocate gpt-bak-std).

Hint: use "fdisk --list-details" to see "Alternative LBA".

Signed-off-by: Karel Zak <kzak@redhat.com>
5 years agolibfdisk: (gpt) add functionality to move backup header
Karel Zak [Wed, 5 Feb 2020 13:37:41 +0000 (14:37 +0100)] 
libfdisk: (gpt) add functionality to move backup header

- add fdisk_gpt_disable_relocation() to disable move backup header to standard location

- add fdisk_gpt_enable_minimize() to move backup header behind last partition

Note that fdisk_gpt_disable_relocation() has to be used before fdisk_assign_device(),
because automatic relocation is done when libfdisk reads the header from the device.

For example:
lb = fdisk_get_label(cxt, "gpt");

fdisk_gpt_disable_relocation(lb, 1);
fdisk_assign_device(cxt, devname, 0);

For fdisk_gpt_enable_minimize() it's not important as recalculation is
done before write, for example:

fdisk_assign_device(cxt, devname, 0);
fdisk_gpt_enable_minimize(fdisk_get_label(cxt, NULL), 1);

... add partition, etc ...

fdisk_write_disklabel(cxt);

Signed-off-by: Karel Zak <kzak@redhat.com>
5 years agofdisk: add --list-details
Karel Zak [Mon, 3 Feb 2020 15:50:43 +0000 (16:50 +0100)] 
fdisk: add --list-details

Signed-off-by: Karel Zak <kzak@redhat.com>
5 years agolibfdisk: (gpt) add GPT debug mask
Karel Zak [Fri, 31 Jan 2020 10:41:08 +0000 (11:41 +0100)] 
libfdisk: (gpt) add GPT debug mask

Signed-off-by: Karel Zak <kzak@redhat.com>
5 years agolibfdisk: (gpt) cleanup and consolidate write code
Karel Zak [Fri, 31 Jan 2020 10:29:12 +0000 (11:29 +0100)] 
libfdisk: (gpt) cleanup and consolidate write code

- add fsync after write
- use write_all()
- use the same code for all write steps

Signed-off-by: Karel Zak <kzak@redhat.com>
5 years agodocs: improve size arguments description in --help output
Karel Zak [Wed, 5 Feb 2020 10:01:36 +0000 (11:01 +0100)] 
docs: improve size arguments description in --help output

Let's add "Arguments:" section to the --help output and describe
{K,M,G...}iB suffixes there.

Addresses: https://github.com/karelzak/util-linux/pull/917
Co-Author: ed <ed@s5h.net>
Signed-off-by: Karel Zak <kzak@redhat.com>
5 years agoinclude/c: add USAGE_ARGUMENT
Karel Zak [Tue, 4 Feb 2020 10:20:16 +0000 (11:20 +0100)] 
include/c: add USAGE_ARGUMENT

Signed-off-by: Karel Zak <kzak@redhat.com>
5 years agofstrim: do not use Protect setting in systemd service
Karel Zak [Tue, 4 Feb 2020 15:17:42 +0000 (16:17 +0100)] 
fstrim: do not use Protect setting in systemd service

The ProtectHome= and ProtectSystem= settings mounts all stuff for the service in read-only mode.

The fstrim ioctl operates on read-only mountpoint file descriptor, but
on some read-only filesystem the operation can fail, so since
2d22ac64e4 we check for read-only volumes and skip it.

References: Upstream: http://github.com/karelzak/util-linux/commit/2d22ac64e4d6e6732640f38b7232b5bcdc84a877
Addresses: https://github.com/karelzak/util-linux/issues/948
Signed-off-by: Karel Zak <kzak@redhat.com>
5 years agosfdisk: fix ref-counting for the script
Karel Zak [Tue, 4 Feb 2020 14:54:53 +0000 (15:54 +0100)] 
sfdisk: fix ref-counting for the script

Signed-off-by: Karel Zak <kzak@redhat.com>
5 years agolibfdisk: (script) fix memory leak
Karel Zak [Tue, 4 Feb 2020 14:54:10 +0000 (15:54 +0100)] 
libfdisk: (script) fix memory leak

Signed-off-by: Karel Zak <kzak@redhat.com>
5 years agolibfdisk: (script) accept sector-size, ignore unknown headers
Karel Zak [Tue, 4 Feb 2020 14:11:19 +0000 (15:11 +0100)] 
libfdisk: (script) accept sector-size, ignore unknown headers

- add sector-size between supported headers (already in --dump output)

- report unknown headers by -ENOTSUP

- ignore ENOTSUP in sfdisk (but print warning) and in fdisk_script_read_file()

Addresses: https://github.com/karelzak/util-linux/issues/949
Signed-off-by: Karel Zak <kzak@redhat.com>
5 years agochrt: Use sched_setscheduler system call directly
jonnyh64 [Wed, 29 Jan 2020 21:24:16 +0000 (22:24 +0100)] 
chrt: Use sched_setscheduler system call directly

musl libc does not support the sched_setscheduler library function
because the underlying Linux system call does not confirm to Posix;
this patch makes chrt use the system call directly

[kzak@redhat.com:
    - note that musl libc implements sched_setscheduler()
      but returns -ENOSYS all time...
    - add ifdefs to the patch
    - make sure we include syscall.h]

References: http://git.musl-libc.org/cgit/musl/commit/src/sched/sched_setscheduler.c?id=1e21e78bf7a5c24c217446d8760be7b7188711c2
Addresses: https://github.com/karelzak/util-linux/issues/943
Signed-off-by: Karel Zak <kzak@redhat.com>
5 years agolibfdisk: fix __copy_partition()
Karel Zak [Tue, 28 Jan 2020 11:46:39 +0000 (12:46 +0100)] 
libfdisk: fix __copy_partition()

The code called free() for pointers copied from the source partition.

Addresses: https://github.com/systemd/systemd/pull/14677
Signed-off-by: Karel Zak <kzak@redhat.com>
5 years agolib/randutils: use explicit data types for bit ops
Karel Zak [Tue, 28 Jan 2020 11:30:23 +0000 (12:30 +0100)] 
lib/randutils: use explicit data types for bit ops

ASAN is pretty unhappy with getpid() << 16, it seems better to save
into unsigned int and than do the bit-op.

Addresses: https://github.com/karelzak/util-linux/issues/942
Signed-off-by: Karel Zak <kzak@redhat.com>
5 years agolibfdisk: make sure we use NULL after free
Karel Zak [Tue, 28 Jan 2020 11:29:44 +0000 (12:29 +0100)] 
libfdisk: make sure we use NULL after free

Signed-off-by: Karel Zak <kzak@redhat.com>
5 years agolib/strutils: add test for strdup_to_struct_member()
Karel Zak [Tue, 28 Jan 2020 10:34:04 +0000 (11:34 +0100)] 
lib/strutils: add test for strdup_to_struct_member()

Signed-off-by: Karel Zak <kzak@redhat.com>
5 years agolibmount: fix x- options use for non-root users
Karel Zak [Tue, 28 Jan 2020 09:45:07 +0000 (10:45 +0100)] 
libmount: fix x- options use for non-root users

libmount returns EPERM for all X- and x- mount options for non-root
users when evaluate X-mount.mkdir. It's bug, we need to be sensitive
to only X-mount.mkdir and only if the target directory is missing.

Addresses: https://github.com/karelzak/util-linux/issues/941
Signed-off-by: Karel Zak <kzak@redhat.com>
5 years agobuild-sys: add --disable-hwclock-gplv3
Karel Zak [Mon, 27 Jan 2020 15:17:10 +0000 (16:17 +0100)] 
build-sys: add --disable-hwclock-gplv3

The currently used date/time parser (for hwclock --set --date <date>)
is gnulib based code with GPLv3.

This patch allows to avoid this code and replace it with minimalistic
date/time parser.

Addresses: https://github.com/karelzak/util-linux/issues/891
Reported-by: Carlos Santos <unixmania@gmail.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
5 years agoMerge branch 'master' of https://github.com/yurchor/util-linux
Karel Zak [Thu, 23 Jan 2020 14:57:37 +0000 (15:57 +0100)] 
Merge branch 'master' of https://github.com/yurchor/util-linux

* 'master' of https://github.com/yurchor/util-linux:
  po: update uk.po (from translationproject.org)

5 years agoMerge branch 'patch-2' of https://github.com/yurchor/util-linux
Karel Zak [Thu, 23 Jan 2020 14:53:19 +0000 (15:53 +0100)] 
Merge branch 'patch-2' of https://github.com/yurchor/util-linux

* 'patch-2' of https://github.com/yurchor/util-linux:
  Fix minor typo: aliast -> alias

5 years agoMerge branch 'patch-1' of https://github.com/yurchor/util-linux
Karel Zak [Thu, 23 Jan 2020 14:52:44 +0000 (15:52 +0100)] 
Merge branch 'patch-1' of https://github.com/yurchor/util-linux

* 'patch-1' of https://github.com/yurchor/util-linux:
  Fix minor typo: ussuported -> unsupported

5 years agolibfdisk: (gpt) cleanup entries array size calculations
Karel Zak [Thu, 16 Jan 2020 13:28:31 +0000 (14:28 +0100)] 
libfdisk: (gpt) cleanup entries array size calculations

- move all calculations to inline functions
- remove duplicate code
- keep the same names for the same stuff

Signed-off-by: Karel Zak <kzak@redhat.com>
5 years agolibfdisk: fix const char mess
Karel Zak [Thu, 16 Jan 2020 11:56:18 +0000 (12:56 +0100)] 
libfdisk: fix const char mess

Signed-off-by: Karel Zak <kzak@redhat.com>
5 years agosfdisk: add --disk-id to change disk UUID/ID
Karel Zak [Tue, 14 Jan 2020 10:50:46 +0000 (11:50 +0100)] 
sfdisk: add --disk-id to change disk UUID/ID

Addresses: https://github.com/karelzak/util-linux/issues/916
Signed-off-by: Karel Zak <kzak@redhat.com>
5 years agolibfdisk: add fdisk_set_disklabel_id_from_string()
Karel Zak [Tue, 14 Jan 2020 10:43:24 +0000 (11:43 +0100)] 
libfdisk: add fdisk_set_disklabel_id_from_string()

We have fdisk_set_disklabel_id(), but it's old ask-API based function.
It's not comfortable if you want to avoid dialog or template.

Addresses: https://github.com/karelzak/util-linux/issues/916
Signed-off-by: Karel Zak <kzak@redhat.com>
5 years agoblkdiscard: use O_EXCL, add --force
Karel Zak [Thu, 9 Jan 2020 10:03:51 +0000 (11:03 +0100)] 
blkdiscard: use O_EXCL, add --force

Let's make it more robust and safe. O_EXCL is an elegant way how to avoid
unwanted discard on mounted device.

Addresses: https://github.com/karelzak/util-linux/issues/915
Signed-off-by: Karel Zak <kzak@redhat.com>
5 years agoMerge branch 'dmverity_sig' of https://github.com/bluca/util-linux
Karel Zak [Thu, 23 Jan 2020 14:47:15 +0000 (15:47 +0100)] 
Merge branch 'dmverity_sig' of https://github.com/bluca/util-linux

* 'dmverity_sig' of https://github.com/bluca/util-linux:
  libmount: add support for signed verity devices

5 years agoflock: make examples in man page more readable
Karel Zak [Thu, 23 Jan 2020 14:43:23 +0000 (15:43 +0100)] 
flock: make examples in man page more readable

Signed-off-by: Karel Zak <kzak@redhat.com>
5 years agoMerge branch 'Jookia-patch-1' of https://github.com/Jookia/util-linux
Karel Zak [Thu, 23 Jan 2020 14:39:42 +0000 (15:39 +0100)] 
Merge branch 'Jookia-patch-1' of https://github.com/Jookia/util-linux

* 'Jookia-patch-1' of https://github.com/Jookia/util-linux:
  flock: Add new example using shell IO redirection

5 years agosfdisk: remove broken step alignment for --move
Karel Zak [Thu, 23 Jan 2020 14:07:32 +0000 (15:07 +0100)] 
sfdisk: remove broken step alignment for --move

* remove unnecessary and broken step alignment
* improve reported information in move log
* improve final progress bar update

Addresses: https://github.com/karelzak/util-linux/issues/938
Signed-off-by: Karel Zak <kzak@redhat.com>
5 years agosfdisk: make sure we do not overlap on --move
Karel Zak [Thu, 23 Jan 2020 11:44:58 +0000 (12:44 +0100)] 
sfdisk: make sure we do not overlap on --move

The area we need to move does not have to be aligned to optimal I/O
size (step size) -- we need to be sure we do not move data
after/before the area.

Addresses: https://github.com/karelzak/util-linux/issues/938
Signed-off-by: Karel Zak <kzak@redhat.com>
5 years agoflock: Add new example using shell IO redirection
Jookia [Thu, 23 Jan 2020 04:55:35 +0000 (04:55 +0000)] 
flock: Add new example using shell IO redirection

5 years agopo: update uk.po (from translationproject.org)
Yuri Chornoivan [Wed, 22 Jan 2020 18:52:11 +0000 (20:52 +0200)] 
po: update uk.po (from translationproject.org)

5 years agobuild-sys: release++ (v2.35) v2.35
Karel Zak [Tue, 21 Jan 2020 10:15:21 +0000 (11:15 +0100)] 
build-sys: release++ (v2.35)

Signed-off-by: Karel Zak <kzak@redhat.com>
5 years agodocs: update v2.35-ReleaseNotes
Karel Zak [Tue, 21 Jan 2020 10:12:49 +0000 (11:12 +0100)] 
docs: update v2.35-ReleaseNotes

Signed-off-by: Karel Zak <kzak@redhat.com>
5 years agodocs: update AUTHORS file
Karel Zak [Tue, 21 Jan 2020 10:07:27 +0000 (11:07 +0100)] 
docs: update AUTHORS file

Signed-off-by: Karel Zak <kzak@redhat.com>
5 years agopo: merge changes
Karel Zak [Tue, 21 Jan 2020 10:03:19 +0000 (11:03 +0100)] 
po: merge changes

Signed-off-by: Karel Zak <kzak@redhat.com>
5 years agopo: update pt.po (from translationproject.org)
Pedro Albuquerque [Tue, 21 Jan 2020 09:57:45 +0000 (10:57 +0100)] 
po: update pt.po (from translationproject.org)

5 years agopo: update pt_BR.po (from translationproject.org)
Rafael Fontenelle [Tue, 21 Jan 2020 09:57:45 +0000 (10:57 +0100)] 
po: update pt_BR.po (from translationproject.org)

5 years agopo: update pl.po (from translationproject.org)
Jakub Bogusz [Tue, 21 Jan 2020 09:57:45 +0000 (10:57 +0100)] 
po: update pl.po (from translationproject.org)

5 years agopo: update ja.po (from translationproject.org)
Takeshi Hamasaki [Tue, 21 Jan 2020 09:57:45 +0000 (10:57 +0100)] 
po: update ja.po (from translationproject.org)

5 years agopo: update hr.po (from translationproject.org)
Božidar Putanec [Tue, 21 Jan 2020 09:57:45 +0000 (10:57 +0100)] 
po: update hr.po (from translationproject.org)

5 years agopo: update fr.po (from translationproject.org)
Frédéric Marchal [Tue, 21 Jan 2020 09:57:45 +0000 (10:57 +0100)] 
po: update fr.po (from translationproject.org)

5 years agopo: update es.po (from translationproject.org)
Antonio Ceballos Roa [Tue, 21 Jan 2020 09:57:45 +0000 (10:57 +0100)] 
po: update es.po (from translationproject.org)

5 years agopo: update de.po (from translationproject.org)
Mario Blättermann [Tue, 21 Jan 2020 09:57:45 +0000 (10:57 +0100)] 
po: update de.po (from translationproject.org)

5 years agopo: update cs.po (from translationproject.org)
Petr Písař [Tue, 21 Jan 2020 09:57:45 +0000 (10:57 +0100)] 
po: update cs.po (from translationproject.org)

5 years agoscriptreplay: restrict header name size
Karel Zak [Mon, 20 Jan 2020 12:04:59 +0000 (13:04 +0100)] 
scriptreplay: restrict header name size

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