]> git.ipfire.org Git - thirdparty/util-linux.git/log
thirdparty/util-linux.git
4 years agolib/path: fix possible leak when use ul_path_read_string() [coverity scan]
Karel Zak [Fri, 11 Jun 2021 13:43:36 +0000 (15:43 +0200)] 
lib/path: fix possible leak when use ul_path_read_string() [coverity scan]

Signed-off-by: Karel Zak <kzak@redhat.com>
4 years agohwclock: close adjtime on write error [coverity scan]
Karel Zak [Fri, 11 Jun 2021 13:17:42 +0000 (15:17 +0200)] 
hwclock: close adjtime on write error [coverity scan]

Signed-off-by: Karel Zak <kzak@redhat.com>
4 years agonewgrp: fix memory leak [coverity scan]
Karel Zak [Fri, 11 Jun 2021 13:10:22 +0000 (15:10 +0200)] 
newgrp: fix memory leak [coverity scan]

Signed-off-by: Karel Zak <kzak@redhat.com>
4 years agodmesg: fix possible memory leak [coverity scan]
Karel Zak [Thu, 10 Jun 2021 11:44:25 +0000 (13:44 +0200)] 
dmesg: fix possible memory leak [coverity scan]

Signed-off-by: Karel Zak <kzak@redhat.com>
4 years agofindmnt: (verify) fix memory leak [asan]
Karel Zak [Thu, 10 Jun 2021 11:35:05 +0000 (13:35 +0200)] 
findmnt: (verify) fix memory leak [asan]

Signed-off-by: Karel Zak <kzak@redhat.com>
4 years agofindmnt: (verify) fix cache related memory leaks on --nocanonicalize [coverity scan]
Karel Zak [Thu, 10 Jun 2021 11:28:35 +0000 (13:28 +0200)] 
findmnt: (verify) fix cache related memory leaks on --nocanonicalize [coverity scan]

Signed-off-by: Karel Zak <kzak@redhat.com>
4 years agolibblkid: check for ioctl macro rather than for header file
Karel Zak [Wed, 9 Jun 2021 14:12:13 +0000 (16:12 +0200)] 
libblkid: check for ioctl macro rather than for header file

libblkid/src/probe.c:1012:22: error: ‘BLKGETZONESZ’ undeclared (first use in this function)
 1012 |   if (!ioctl(pr->fd, BLKGETZONESZ, &zone_size_sector))
      |                      ^~~~~~~~~~~~

Signed-off-by: Karel Zak <kzak@redhat.com>
4 years agobuild-sys: make autogen.sh output more user friendly
Karel Zak [Wed, 9 Jun 2021 14:09:16 +0000 (16:09 +0200)] 
build-sys: make autogen.sh output more user friendly

Signed-off-by: Karel Zak <kzak@redhat.com>
4 years agobuild-sys: be verbose about missing gettext
Karel Zak [Wed, 9 Jun 2021 13:54:09 +0000 (15:54 +0200)] 
build-sys: be verbose about missing gettext

Reported-by: Qais Yousef <qais.yousef@arm.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
4 years agolsblk: sort list of columns
Karel Zak [Wed, 9 Jun 2021 09:09:33 +0000 (11:09 +0200)] 
lsblk: sort list of columns

It's better to maintain sorted list and it's also better for --help output.

Signed-off-by: Karel Zak <kzak@redhat.com>
4 years agolsblk: add column START for partition start offsets
Karel Zak [Wed, 9 Jun 2021 08:57:54 +0000 (10:57 +0200)] 
lsblk: add column START for partition start offsets

Fix: https://github.com/karelzak/util-linux/issues/1340
Signed-off-by: Karel Zak <kzak@redhat.com>
4 years agolibblkid: Add hyphens to UUID string representation in Stratis superblock parsing
John Baublitz [Fri, 4 Jun 2021 11:02:39 +0000 (07:02 -0400)] 
libblkid: Add hyphens to UUID string representation in Stratis superblock parsing

[kzak@redhat.com: - small code cleanup]

Signed-off-by: Karel Zak <kzak@redhat.com>
4 years agoMerge branch 'fix-display-signed-char' of https://github.com/Ram-Z/util-linux
Karel Zak [Wed, 9 Jun 2021 08:32:23 +0000 (10:32 +0200)] 
Merge branch 'fix-display-signed-char' of https://github.com/Ram-Z/util-linux

* 'fix-display-signed-char' of https://github.com/Ram-Z/util-linux:
  hexdump: correctly display signed single byte integers

4 years agohexdump: correctly display signed single byte integers
Samir Benmendil [Wed, 9 Jun 2021 00:21:46 +0000 (01:21 +0100)] 
hexdump: correctly display signed single byte integers

When using the format string '/1 "%d"', the byte did not display as a
signed integer as expected, it was interpreted as unsigned.

4 years agolsblk: fix formatting in -e option
ratijas [Tue, 8 Jun 2021 16:12:19 +0000 (19:12 +0300)] 
lsblk: fix formatting in -e option

4 years agouclampset: Fix left over optind++
Qais Yousef [Mon, 7 Jun 2021 16:11:11 +0000 (17:11 +0100)] 
uclampset: Fix left over optind++

The code was changed to use ':' in getopt_long() but these were left
over by mistake causing weird random errors when using these options
depending on the order they were fed.

Signed-off-by: Qais Yousef <qais.yousef@arm.com>
4 years agorfkill: Set scols table name to make the json output valid
Nicolai Dagestad [Sun, 6 Jun 2021 16:28:35 +0000 (18:28 +0200)] 
rfkill: Set scols table name to make the json output valid

[kzak@redhat.com: - s/rfkill/rfkilldevices/]

Fixes: https://github.com/karelzak/util-linux/issues/1339
Signed-off-by: Nicolai Dagestad <nicolai@dagestad.fr>
Signed-off-by: Karel Zak <kzak@redhat.com>
4 years agolibsmartcols: fix bare array on JSON output
Karel Zak [Mon, 7 Jun 2021 08:32:20 +0000 (10:32 +0200)] 
libsmartcols: fix bare array on JSON output

The bare array ({[...]}) for top level list of entries is invalid. It
seems better to print empty string than nothing. This is workaround
for broken utils, better is to define a table name.

Addresses: https://github.com/karelzak/util-linux/issues/1339
Signed-off-by: Karel Zak <kzak@redhat.com>
4 years agobuild-sys: make re-use of generated man-pages more robust
Karel Zak [Fri, 4 Jun 2021 09:42:03 +0000 (11:42 +0200)] 
build-sys: make re-use of generated man-pages more robust

We need to ignore man-pages at all if not available (not generated
yet), but asciidoctor is not installed.

Fix: https://github.com/karelzak/util-linux/issues/1334
Signed-off-by: Karel Zak <kzak@redhat.com>
4 years agoMerge branch 'nortas' of https://github.com/gyakovlev/util-linux
Karel Zak [Thu, 3 Jun 2021 10:25:35 +0000 (12:25 +0200)] 
Merge branch 'nortas' of https://github.com/gyakovlev/util-linux

* 'nortas' of https://github.com/gyakovlev/util-linux:
  lscpu: fix build on powerpc

4 years agobuild-sys: add generated man-pages to distribution tarball
Karel Zak [Thu, 3 Jun 2021 10:17:27 +0000 (12:17 +0200)] 
build-sys: add generated man-pages to distribution tarball

Signed-off-by: Karel Zak <kzak@redhat.com>
4 years agolscpu: fix build on powerpc
Georgy Yakovlev [Wed, 2 Jun 2021 20:59:26 +0000 (13:59 -0700)] 
lscpu: fix build on powerpc

fails with error: label at end of compound statement
and fix typo as bonus.

Signed-off-by: Georgy Yakovlev <gyakovlev@gentoo.org>
4 years agobuild-sys: add missing header
Karel Zak [Wed, 2 Jun 2021 13:31:39 +0000 (15:31 +0200)] 
build-sys: add missing header

Signed-off-by: Karel Zak <kzak@redhat.com>
4 years agolsblk: use ID_MODEL_ENC is possible
Karel Zak [Wed, 2 Jun 2021 11:32:43 +0000 (13:32 +0200)] 
lsblk: use ID_MODEL_ENC is possible

Fix: https://github.com/karelzak/util-linux/issues/1098
Signed-off-by: Karel Zak <kzak@redhat.com>
4 years agolscpu: remove extra blank lines
Karel Zak [Wed, 2 Jun 2021 11:09:28 +0000 (13:09 +0200)] 
lscpu: remove extra blank lines

Signed-off-by: Karel Zak <kzak@redhat.com>
4 years agoMerge branch 'lscpu-json-types' of https://github.com/t-8ch/util-linux
Karel Zak [Wed, 2 Jun 2021 11:06:10 +0000 (13:06 +0200)] 
Merge branch 'lscpu-json-types' of https://github.com/t-8ch/util-linux

* 'lscpu-json-types' of https://github.com/t-8ch/util-linux:
  lscpu: use optional json values
  libsmartcols: add support for optional boolean values
  lscpu: use json types

4 years agoMerge branch 'next'
Karel Zak [Wed, 2 Jun 2021 10:33:07 +0000 (12:33 +0200)] 
Merge branch 'next'

* next: (26 commits)
  build-sys: add script to compare config.h from meson and autotools
  meson: add missing header files check
  docs: update TODO
  tests: update lscpu outputs
  lscpu: read MHZ from /sys/.../cpufreq/scaling_cur_freq
  lscpu: use locale-independent strtod() when read from kernel
  lib/c_strtod; add locale independent strtod()
  tests: update lscpu output
  lscpu: use MHZ as number to be locale sensitive
  lscpu: add SCALMHZ% and "CPU scaling MHz:"
  sulogin: fix whitespace error
  sulogin: ignore none-existing console devices
  lsns: fix old error message
  lsns: fix copy & past in man page
  lsns: fill UID and USER columns for interpolated namespaces
  fixup! lsns: interpolate missing namespaces for converting forests to a tree
  lsns: interpolate missing namespaces for converting forests to a tree
  lsns: reorganize members specifying other namespaces in lsns_namespace
  lsns: make namespace having no process printable
  libblkid: support zone reset for wipefs
  ...

4 years agomount: use mnt_fs_is_regularfs()
Karel Zak [Wed, 2 Jun 2021 10:19:06 +0000 (12:19 +0200)] 
mount: use mnt_fs_is_regularfs()

Signed-off-by: Karel Zak <kzak@redhat.com>
4 years agofsck: use mnt_fs_is_regularfs()
Karel Zak [Wed, 2 Jun 2021 10:16:14 +0000 (12:16 +0200)] 
fsck: use mnt_fs_is_regularfs()

Signed-off-by: Karel Zak <kzak@redhat.com>
4 years agolibmount: add mnt_fs_is_regularfs() to public API
Karel Zak [Wed, 2 Jun 2021 10:14:10 +0000 (12:14 +0200)] 
libmount: add mnt_fs_is_regularfs() to public API

Fix: https://github.com/karelzak/util-linux/issues/1328
Signed-off-by: Karel Zak <kzak@redhat.com>
4 years agobuild-sys: fix {release-version} man pages
Karel Zak [Wed, 2 Jun 2021 09:55:44 +0000 (11:55 +0200)] 
build-sys: fix {release-version} man pages

* define {release-version} as $VERSION

* do not use {docdir} in adoc; it's built-in ascidoctor variable
  https://docs.asciidoctor.org/asciidoc/latest/attributes/document-attributes-reference/#intrinsic-attributes

Addresses: https://github.com/karelzak/util-linux/issues/1327
Signed-off-by: Karel Zak <kzak@redhat.com>
4 years agobuild-sys: install hardlink bash-completion
Karel Zak [Wed, 2 Jun 2021 09:14:36 +0000 (11:14 +0200)] 
build-sys: install hardlink bash-completion

Signed-off-by: Karel Zak <kzak@redhat.com>
4 years agotools: allow to update specific files on kernel.org
Karel Zak [Tue, 1 Jun 2021 09:45:16 +0000 (11:45 +0200)] 
tools: allow to update specific files on kernel.org

Signed-off-by: Karel Zak <kzak@redhat.com>
4 years agodocs: fix typo in v2.37-ReleaseNotes
Karel Zak [Tue, 1 Jun 2021 08:37:01 +0000 (10:37 +0200)] 
docs: fix typo in v2.37-ReleaseNotes

Signed-off-by: Karel Zak <kzak@redhat.com>
4 years agodocs: add uclampset to AUTHORS file
Karel Zak [Tue, 1 Jun 2021 08:31:49 +0000 (10:31 +0200)] 
docs: add uclampset to AUTHORS file

Signed-off-by: Karel Zak <kzak@redhat.com>
4 years agobuild-sys: release++ (v2.37) v2.37
Karel Zak [Tue, 1 Jun 2021 07:52:10 +0000 (09:52 +0200)] 
build-sys: release++ (v2.37)

Signed-off-by: Karel Zak <kzak@redhat.com>
4 years agodocs: update v2.37-ReleaseNotes
Karel Zak [Tue, 1 Jun 2021 07:46:40 +0000 (09:46 +0200)] 
docs: update v2.37-ReleaseNotes

Signed-off-by: Karel Zak <kzak@redhat.com>
4 years agodocs: update AUTHORS file
Karel Zak [Tue, 1 Jun 2021 07:45:03 +0000 (09:45 +0200)] 
docs: update AUTHORS file

Signed-off-by: Karel Zak <kzak@redhat.com>
4 years agopo: merge changes
Karel Zak [Mon, 31 May 2021 16:36:06 +0000 (18:36 +0200)] 
po: merge changes

Signed-off-by: Karel Zak <kzak@redhat.com>
4 years agopo: add ko.po (from translationproject.org)
Seong-ho Cho [Mon, 31 May 2021 16:20:33 +0000 (18:20 +0200)] 
po: add ko.po (from translationproject.org)

4 years agopo: update uk.po (from translationproject.org)
Yuri Chornoivan [Mon, 31 May 2021 16:20:33 +0000 (18:20 +0200)] 
po: update uk.po (from translationproject.org)

4 years agopo: update pt.po (from translationproject.org)
Pedro Albuquerque [Mon, 31 May 2021 16:20:33 +0000 (18:20 +0200)] 
po: update pt.po (from translationproject.org)

4 years agopo: update pl.po (from translationproject.org)
Jakub Bogusz [Mon, 31 May 2021 16:20:33 +0000 (18:20 +0200)] 
po: update pl.po (from translationproject.org)

4 years agopo: update hr.po (from translationproject.org)
Božidar Putanec [Mon, 31 May 2021 16:20:33 +0000 (18:20 +0200)] 
po: update hr.po (from translationproject.org)

4 years agopo: update fr.po (from translationproject.org)
Frédéric Marchal [Mon, 31 May 2021 16:20:33 +0000 (18:20 +0200)] 
po: update fr.po (from translationproject.org)

4 years agopo: update de.po (from translationproject.org)
Mario Blättermann [Mon, 31 May 2021 16:20:33 +0000 (18:20 +0200)] 
po: update de.po (from translationproject.org)

4 years agopo: update cs.po (from translationproject.org)
Petr Písař [Mon, 31 May 2021 16:20:33 +0000 (18:20 +0200)] 
po: update cs.po (from translationproject.org)

4 years agolibblkid: fix docs
Karel Zak [Mon, 31 May 2021 16:16:57 +0000 (18:16 +0200)] 
libblkid: fix docs

Signed-off-by: Karel Zak <kzak@redhat.com>
4 years agodocs: update copyright years
Karel Zak [Mon, 31 May 2021 16:12:07 +0000 (18:12 +0200)] 
docs: update copyright years

Signed-off-by: Karel Zak <kzak@redhat.com>
4 years agobuild-sys: remove with-cryptsetup from tools/config-gen.d/all.conf
Karel Zak [Mon, 31 May 2021 15:44:10 +0000 (17:44 +0200)] 
build-sys: remove with-cryptsetup from tools/config-gen.d/all.conf

Unfortunately libtools is not smart enough to link libblkid
dynamically if we link in-tree static libmount.a for libmount tests.
In this case libtools always uses also libblkid.a, but it's problem
for libcryptsetup which requires versioned symbols from libblkid.so

This is no problem for normal binaries, but for libmount tests only
(where we need static library to by-pass public library API).

Signed-off-by: Karel Zak <kzak@redhat.com>
4 years agolscpu: fix NVIDIA ARM hw implementer spelling case
Ville Skyttä [Sun, 30 May 2021 12:14:38 +0000 (15:14 +0300)] 
lscpu: fix NVIDIA ARM hw implementer spelling case

Ref respective vendor sites.

Signed-off-by: Ville Skyttä <ville.skytta@iki.fi>
Signed-off-by: Karel Zak <kzak@redhat.com>
4 years agolscpu: recognize more ARM implementers
Ville Skyttä [Sun, 30 May 2021 12:13:39 +0000 (15:13 +0300)] 
lscpu: recognize more ARM implementers

Add just the implementer string, no parts yet.

Refs https://developer.arm.com/documentation/ddi0595/2021-03/AArch64-Registers/MIDR-EL1--Main-ID-Register
Refs https://github.com/torvalds/linux/blob/b90e90f40b4ff23c753126008bf4713a42353af6/arch/arm64/include/asm/cputype.h#L54

Signed-off-by: Ville Skyttä <ville.skytta@iki.fi>
4 years agolscpu: use optional json values
Thomas Weißschuh [Wed, 26 May 2021 11:31:44 +0000 (13:31 +0200)] 
lscpu: use optional json values

Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
4 years agolibsmartcols: add support for optional boolean values
Thomas Weißschuh [Wed, 26 May 2021 11:30:31 +0000 (13:30 +0200)] 
libsmartcols: add support for optional boolean values

These default to `null` instead of `false`.

Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
4 years agolscpu: use json types
Thomas Weißschuh [Wed, 26 May 2021 11:08:16 +0000 (13:08 +0200)] 
lscpu: use json types

Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
4 years agopo: add xgettext hint for non-c-format string
Karel Zak [Thu, 27 May 2021 08:39:58 +0000 (10:39 +0200)] 
po: add xgettext hint for non-c-format string

Reported-by: Petr Pisar <petr.pisar@atlas.cz>
Signed-off-by: Karel Zak <kzak@redhat.com>
4 years agobuild-sys: add script to compare config.h from meson and autotools
Karel Zak [Wed, 26 May 2021 11:20:21 +0000 (13:20 +0200)] 
build-sys: add script to compare config.h from meson and autotools

Signed-off-by: Karel Zak <kzak@redhat.com>
4 years agomeson: add missing header files check
Karel Zak [Wed, 26 May 2021 11:12:31 +0000 (13:12 +0200)] 
meson: add missing header files check

Fixes: https://github.com/karelzak/util-linux/issues/1318
Signed-off-by: Karel Zak <kzak@redhat.com>
4 years agolscpu: cleanup tab vs. space
Karel Zak [Wed, 26 May 2021 09:54:47 +0000 (11:54 +0200)] 
lscpu: cleanup tab vs. space

Do not mix tab and space in structs initializations.

Signed-off-by: Karel Zak <kzak@redhat.com>
4 years agolscpu: Replace space with tabs
Bader Zaidan [Fri, 21 May 2021 22:55:17 +0000 (00:55 +0200)] 
lscpu: Replace space with tabs

Signed-off-by: Karel Zak <kzak@redhat.com>
4 years agodocs: update TODO
Karel Zak [Tue, 25 May 2021 11:45:24 +0000 (13:45 +0200)] 
docs: update TODO

Signed-off-by: Karel Zak <kzak@redhat.com>
4 years agotests: update lscpu outputs
Karel Zak [Tue, 25 May 2021 11:29:20 +0000 (13:29 +0200)] 
tests: update lscpu outputs

4 years agolscpu: read MHZ from /sys/.../cpufreq/scaling_cur_freq
Karel Zak [Tue, 25 May 2021 11:23:39 +0000 (13:23 +0200)] 
lscpu: read MHZ from /sys/.../cpufreq/scaling_cur_freq

This is more portable and provides more stable results than
/proc/cpuinfo.

Fixes: https://github.com/karelzak/util-linux/pull/1317
Co-Author: Thomas Weißschuh
Signed-off-by: Karel Zak <kzak@redhat.com>
4 years agolscpu: use locale-independent strtod() when read from kernel
Karel Zak [Tue, 25 May 2021 09:32:51 +0000 (11:32 +0200)] 
lscpu: use locale-independent strtod() when read from kernel

Reported-by: Thomas Weißschuh
Signed-off-by: Karel Zak <kzak@redhat.com>
4 years agolib/c_strtod; add locale independent strtod()
Karel Zak [Tue, 25 May 2021 09:31:08 +0000 (11:31 +0200)] 
lib/c_strtod; add locale independent strtod()

Signed-off-by: Karel Zak <kzak@redhat.com>
4 years agotests: update lscpu output
Karel Zak [Mon, 24 May 2021 11:43:02 +0000 (13:43 +0200)] 
tests: update lscpu output

Signed-off-by: Karel Zak <kzak@redhat.com>
4 years agolscpu: use MHZ as number to be locale sensitive
Karel Zak [Mon, 24 May 2021 11:19:47 +0000 (13:19 +0200)] 
lscpu: use MHZ as number to be locale sensitive

Fixes: https://github.com/karelzak/util-linux/issues/1316
Signed-off-by: Karel Zak <kzak@redhat.com>
4 years agolscpu: add SCALMHZ% and "CPU scaling MHz:"
Karel Zak [Mon, 24 May 2021 10:24:33 +0000 (12:24 +0200)] 
lscpu: add SCALMHZ% and "CPU scaling MHz:"

$ lscpu
...
  Model name:           Intel(R) Core(TM) i7-4790K CPU @ 4.00GHz
    CPU family:         6
    Model:              60
    Thread(s) per core: 2
    Core(s) per socket: 4
    Socket(s):          1
    Stepping:           3
    CPU(s) scaling MHz: 61%
    CPU max MHz:        4400.0000
    CPU min MHz:        800.0000
...

$ lscpu -e=CPU,MAXMHZ,MINMHZ,MHZ,SCALMHZ%
CPU    MAXMHZ   MINMHZ      MHZ SCALMHZ%
  0 4400.0000 800.0000 2800.000      64%
  1 4400.0000 800.0000 4000.146      91%
  2 4400.0000 800.0000 2800.000      64%
  3 4400.0000 800.0000 2800.000      64%
  4 4400.0000 800.0000 2800.000      64%
  5 4400.0000 800.0000 4400.000     100%
  6 4400.0000 800.0000  800.000      18%
  7 4400.0000 800.0000 2800.000      64%

Addresses: https://github.com/karelzak/util-linux/issues/1314
Signed-off-by: Karel Zak <kzak@redhat.com>
4 years agosulogin: fix whitespace error
Karel Zak [Tue, 18 May 2021 10:58:45 +0000 (12:58 +0200)] 
sulogin: fix whitespace error

Signed-off-by: Karel Zak <kzak@redhat.com>
4 years agosulogin: ignore none-existing console devices
Werner Fink [Mon, 17 May 2021 15:20:32 +0000 (17:20 +0200)] 
sulogin: ignore none-existing console devices

and also none-functional console devices. Redirect the error
messages to the appropiate console device.

Signed-off-by: Werner Fink <werner@suse.de>
4 years agolsns: fix old error message
Karel Zak [Mon, 3 May 2021 08:59:45 +0000 (10:59 +0200)] 
lsns: fix old error message

Signed-off-by: Karel Zak <kzak@redhat.com>
4 years agolsns: fix copy & past in man page
Karel Zak [Mon, 3 May 2021 08:51:06 +0000 (10:51 +0200)] 
lsns: fix copy & past in man page

Signed-off-by: Karel Zak <kzak@redhat.com>
4 years agolsns: fill UID and USER columns for interpolated namespaces
Masatake YAMATO [Fri, 30 Apr 2021 13:14:22 +0000 (22:14 +0900)] 
lsns: fill UID and USER columns for interpolated namespaces

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
4 years agofixup! lsns: interpolate missing namespaces for converting forests to a tree
Masatake YAMATO [Thu, 29 Apr 2021 17:44:12 +0000 (02:44 +0900)] 
fixup! lsns: interpolate missing namespaces for converting forests to a tree

4 years agolsns: interpolate missing namespaces for converting forests to a tree
Masatake YAMATO [Wed, 28 Apr 2021 20:49:33 +0000 (05:49 +0900)] 
lsns: interpolate missing namespaces for converting forests to a tree

The tree of *parent* and *owner* could be forests because *lsns*
cannot track a namespace having no process.

This change tries interpolating the missing namespaces by calling
ioctl(NS_GET_PARENT) and ioctl(NS_GET_USERNS) recursively.

The original output for -Tparent:

    # ./lsns -Tparent
    NS             TYPE   NPROCS   PID USER   COMMAND
    4026531837     user      404     1 root   /usr/lib/systemd/sy
    ├─4026532508   user        1 29376 yamato /usr/lib64/firefox/
    ...
    └─4026533513   user        1 24245 yamato /usr/lib64/firefox/
    ...
    4026533733     user        1 30839 yamato /opt/google/chrome-
    4026533734     user       15 10076 yamato /opt/google/chrome-

user namespaces 4026533733 and 4026533734 are orphans.
lsns could not find their parents.

With this change:

    # ./lsns-with-changes -Tparent
    NS               TYPE   NPROCS   PID USER   COMMAND
    4026531837       user      404     1 root   /usr/lib/systemd/
    ├─4026532508     user        1 29376 yamato /usr/lib64/firefo
    ...
    ├─4026532639     user        0
    │ ├─4026532637   user        0
    │ │ └─4026533733 user        1 30839 yamato /opt/google/chrom
    │ └─4026533734   user       14 10076 yamato /opt/google/chrom

Now user namespaces 4026533733 and 4026533734 are integrated to the
tree. lsns interpolates the missing namespace 4026532639 and
4026532637 for the integration.

The original output for -Towner:

    # ./lsns -Towner
    NS             TYPE   NPROCS   PID USER   COMMAND
    4026531837     user      405     1 root   /usr/lib/systemd/s
    ├─4026531835   cgroup    431     1 root   /usr/lib/systemd/s
    ...
    4026532638     pid         1 30839 yamato /opt/google/chrome
    4026532640     pid         2 30837 yamato /opt/google/chrome
    ...

pid namespaces 4026532638 and 4026532640 are orphans.
lsns could not find their owners.

With this change:

    # ./lsns-with-changes -Towner
    NS               TYPE   NPROCS   PID USER   COMMAND
    4026531837       user      403     1 root   /usr/lib/systemd
    ├─4026531835     cgroup    429     1 root   /usr/lib/systemd
    ...
    ├─4026532639     user        0
    ...
    │ ├─4026532637   user        0
    │ │ ├─4026532638 pid         1 30839 yamato /opt/google/chro
    │ │ ├─4026533638 net         1 30839 yamato /opt/google/chro
    │ │ └─4026533733 user        1 30839 yamato /opt/google/chro
    │ ├─4026532640   pid         2 30837 yamato /opt/google/chro

Now pid namespaces 4026532638 and 4026532640 are integrated to the
tree. lsns interpolates the missing namespace 4026532639 and
4026532637 for the integration.

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
4 years agolsns: reorganize members specifying other namespaces in lsns_namespace
Masatake YAMATO [Wed, 28 Apr 2021 19:39:13 +0000 (04:39 +0900)] 
lsns: reorganize members specifying other namespaces in lsns_namespace

This is a preparation change for planed "tree interpolation" patch.

parentid, ownerid, parentns, and ownerns were members of
lsns_namespace struct. When interpolating missing namespaces
for building a unified name space tree, duplicated functions
are needed; one is for parentid and parentns members, and
another is for ownerid and ownerns members. To avoid the
duplication, this change unifies the members as following:

 parentid and ownerid => related_id [2]
 parentns and ownerns => related_ns [2]

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
4 years agolsns: make namespace having no process printable
Masatake YAMATO [Thu, 22 Apr 2021 19:24:24 +0000 (04:24 +0900)] 
lsns: make namespace having no process printable

This is a preparation change for planed "tree interpolation" patch.

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
4 years agolibblkid: support zone reset for wipefs
Naohiro Aota [Mon, 26 Apr 2021 05:50:36 +0000 (14:50 +0900)] 
libblkid: support zone reset for wipefs

We cannot overwrite superblock magic in a sequential required zone. So,
wipefs cannot work as it is. Instead, this commit implements the wiping by
zone resetting.

Zone resetting must be done only for a sequential write zone. This is
checked by is_conventional().

Signed-off-by: Naohiro Aota <naohiro.aota@wdc.com>
4 years agolibblkid: add magic and probing for zoned btrfs
Naohiro Aota [Mon, 26 Apr 2021 05:50:35 +0000 (14:50 +0900)] 
libblkid: add magic and probing for zoned btrfs

This commit adds zone-aware magics and probing functions for zoned btrfs.

The superblock (and its copies) are the only data structure in btrfs with a
fixed location on a device. Since we cannot do overwrites in a sequential
write required zone, we cannot place the superblock in the zone.

Thus, zoned btrfs uses superblock log writing to update superblocks on
sequential write required zones. It uses two zones as a circular buffer to
write updated superblocks. Once the first zone is filled up, start writing
into the second buffer. When both zones are filled up, and before starting
to write to the first zone again, it reset the first zone.

We can determine the position of the latest superblock by reading the write
pointer information from a device. One corner case is when both zones are
full. For this situation, we read out the last superblock of each zone and
compare them to determine which zone is older.

The magics can detect a superblock magic ("_BHRfs_M") at the beginning of
zone #0 or zone #1 to see if it is zoned btrfs. When both zones are filled
up, zoned btrfs resets the first zone to write a new superblock. If btrfs
crashes at the moment, we do not see a superblock at zone #0. Thus, we need
to check not only zone #0 but also zone #1.

It also supports the temporary magic ("!BHRfS_M") in zone #0. Mkfs.btrfs
first writes the temporary superblock to the zone during the mkfs process.
It will survive there until the zones are filled up and reset. So, we also
need to detect this temporary magic.

Finally, this commit extends probe_btrfs() to load the latest superblock
determined by the write pointers.

Signed-off-by: Naohiro Aota <naohiro.aota@wdc.com>
4 years agolibblkid: implement zone-aware probing
Naohiro Aota [Mon, 26 Apr 2021 05:50:34 +0000 (14:50 +0900)] 
libblkid: implement zone-aware probing

This patch makes libblkid zone-aware. It can probe the magic located at
some offset from the beginning of some specific zone of a device.

This patch introduces some new fields to struct blkid_idmag. They indicate
the magic location is placed related to a zone and the offset in the zone.

Also, this commit introduces `zone_size` to struct blkid_struct_probe. It
stores the size of zones of a device.

Signed-off-by: Naohiro Aota <naohiro.aota@wdc.com>
4 years agolsns: make --tree default, update man-page
Karel Zak [Wed, 28 Apr 2021 11:04:16 +0000 (13:04 +0200)] 
lsns: make --tree default, update man-page

* make --tree=process default for 'lsns' and 'lsns <ns>'
* remove 'list' from struct lsns
* update man page

Addresses: https://github.com/karelzak/util-linux/pull/1281
Signed-off-by: Karel Zak <kzak@redhat.com>
4 years agolsns: fix passing wrong process lists when showing ownerns and parentns
Masatake YAMATO [Fri, 23 Apr 2021 10:55:46 +0000 (19:55 +0900)] 
lsns: fix passing wrong process lists when showing ownerns and parentns

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
4 years agolsns: unify the code and option for printing process based tree and namespace based...
Masatake YAMATO [Tue, 20 Apr 2021 08:09:02 +0000 (17:09 +0900)] 
lsns: unify the code and option for printing process based tree and namespace based trees

Suggested by Karel Zak.

`--tree` option is introduced as replacement for `--nstree`.
In addition to `parent` and `owner`, `--tree` take `process` as the
option argument.

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
4 years agolsns: print namespace tree based on the relationship (parent/child or owner/owned)
Masatake YAMATO [Thu, 15 Apr 2021 09:03:57 +0000 (18:03 +0900)] 
lsns: print namespace tree based on the relationship (parent/child or owner/owned)

Introduce new option -T[parent|owner]|--nstree[=parent|=owner].

With this change, lsns prints parent/child relationship tree if
"-T parent" is given and owner/owned relationship tree if "-T owner is given.

Passing only "-T" is same as passing "-Towner."

Example sessions:

    # ./lsns -Tparent -ons,type,pns| head -20
    NS             TYPE          PNS
    4026531837     user            0
    ├─4026532508   user   4026531837
    ├─4026532609   user   4026531837
    ├─4026532610   user   4026531837
    ├─4026532629   user   4026531837
    ├─4026532705   user   4026531837
    ├─4026532901   user   4026531837
    ├─4026533090   user   4026531837
    ├─4026533185   user   4026531837
    ├─4026533280   user   4026531837
    └─4026533468   user   4026531837
    4026531835     cgroup          0
    4026531836     pid             0
    └─4026533038   pid    4026531836
      ├─4026532934 pid    4026533038
      ├─4026533715 pid    4026533038
      ├─4026533716 pid    4026533038
      ...

    # ./lsns -Towner -ons,type,ons| head -20
    NS             TYPE          ONS
    4026531837     user            0
    ├─4026531835   cgroup 4026531837
    ├─4026531836   pid    4026531837
    ├─4026531838   uts    4026531837
    ├─4026531839   ipc    4026531837
    ├─4026531840   mnt    4026531837
    ├─4026531861   mnt    4026531837
    ├─4026532001   net    4026531837
    ├─4026532219   mnt    4026531837
    ├─4026532357   mnt    4026531837
    ├─4026532383   net    4026531837
    ├─4026532475   mnt    4026531837
    ├─4026532476   mnt    4026531837
    ├─4026532504   mnt    4026531837
    ├─4026532508   user   4026531837
    │ ├─4026532509 ipc    4026532508
    │ └─4026532511 net    4026532508
    ├─4026532573   mnt    4026531837
    ├─4026532574   mnt    4026531837

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
4 years agolscpu: add MHZ to the -e output
Karel Zak [Sun, 23 May 2021 21:52:00 +0000 (23:52 +0200)] 
lscpu: add MHZ to the -e output

Addresses: https://github.com/karelzak/util-linux/issues/1314
Signed-off-by: Karel Zak <kzak@redhat.com>
4 years agofstrim: do not start the timer in initrd
Zbigniew Jędrzejewski-Szmek [Fri, 21 May 2021 08:45:35 +0000 (10:45 +0200)] 
fstrim: do not start the timer in initrd

I'm working on building initramfs images directly from normal
packages, which means that the pristine system rpms should behave
correctly as much as possible also in the initrd. There usually isn't
enough time for the timer to actually fire, but starting it gives a
line on the console and generally looks confusing and sloppy. So let's
skip the timer if it ever ends up being enabled in the initrd.

Checking for /etc/initrd-release is the standard condition that
systemd's initrd units use.

4 years agoMerge branch 'more-floating-point' of https://github.com/kerolasa/util-linux
Karel Zak [Thu, 20 May 2021 07:32:53 +0000 (09:32 +0200)] 
Merge branch 'more-floating-point' of https://github.com/kerolasa/util-linux

* 'more-floating-point' of https://github.com/kerolasa/util-linux:
  more: fix floating point exception core dump

4 years agofstrim: fix paths comparison
Karel Zak [Thu, 20 May 2021 07:25:46 +0000 (09:25 +0200)] 
fstrim: fix paths comparison

Fix: https://github.com/karelzak/util-linux/issues/1312
Signed-off-by: Karel Zak <kzak@redhat.com>
4 years agomore: fix floating point exception core dump
Sami Kerola [Wed, 19 May 2021 19:23:48 +0000 (20:23 +0100)] 
more: fix floating point exception core dump

Make the code avoid divided by zero.  This can happen when file has content
but is zero in size.  Such files can be found from procfs, possibly some
other pseudo-filesystems.  To reproduce the issue run the following.

    $ more /proc/crypto
    ...
    Floating point exception (core dumped)

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
4 years agobuild-sys: fix po-man/ make check
Karel Zak [Thu, 13 May 2021 10:21:56 +0000 (12:21 +0200)] 
build-sys: fix po-man/ make check

Signed-off-by: Karel Zak <kzak@redhat.com>
4 years agoblkdiscard: do not probe for signatures on --force
Karel Zak [Thu, 13 May 2021 08:34:14 +0000 (10:34 +0200)] 
blkdiscard: do not probe for signatures on --force

The command-line option --force is defined as "disable all checks",
but the current code does not follow this idea. We need a way how to
disable read from the device (for example for dm-integrity devices).

Fixes: https://github.com/karelzak/util-linux/issues/1308
Signed-off-by: Karel Zak <kzak@redhat.com>
4 years agoMerge branch 'whitespace' of https://github.com/eworm-de/util-linux
Karel Zak [Thu, 13 May 2021 08:24:25 +0000 (10:24 +0200)] 
Merge branch 'whitespace' of https://github.com/eworm-de/util-linux

4 years agobuild-sys: update util-linux-man.pot on 'make dist'
Karel Zak [Thu, 13 May 2021 08:23:34 +0000 (10:23 +0200)] 
build-sys: update util-linux-man.pot on 'make dist'

Signed-off-by: Karel Zak <kzak@redhat.com>
4 years agofix whitespace issue in ducumentation
Christian Hesse [Mon, 10 May 2021 13:53:50 +0000 (15:53 +0200)] 
fix whitespace issue in ducumentation

This removes trailing whitespaces and fixes minor issues.

4 years agobuild-sys: release++ (v2.37-rc2) v2.37-rc2
Karel Zak [Mon, 10 May 2021 11:12:02 +0000 (13:12 +0200)] 
build-sys: release++ (v2.37-rc2)

Signed-off-by: Karel Zak <kzak@redhat.com>
4 years agodocs: update v2.37-ReleaseNotes
Karel Zak [Mon, 10 May 2021 11:10:21 +0000 (13:10 +0200)] 
docs: update v2.37-ReleaseNotes

Signed-off-by: Karel Zak <kzak@redhat.com>
4 years agodocs: update AUTHORS file
Karel Zak [Mon, 10 May 2021 11:09:13 +0000 (13:09 +0200)] 
docs: update AUTHORS file

Signed-off-by: Karel Zak <kzak@redhat.com>
4 years agopo: merge changes
Karel Zak [Mon, 10 May 2021 10:21:25 +0000 (12:21 +0200)] 
po: merge changes

Signed-off-by: Karel Zak <kzak@redhat.com>
4 years agopo: update sv.po (from translationproject.org)
Sebastian Rasmussen [Mon, 10 May 2021 10:15:03 +0000 (12:15 +0200)] 
po: update sv.po (from translationproject.org)

4 years agotests: update build tests
Karel Zak [Mon, 10 May 2021 10:13:09 +0000 (12:13 +0200)] 
tests: update build tests

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