]> git.ipfire.org Git - thirdparty/util-linux.git/log
thirdparty/util-linux.git
18 months agoscript: abort if unused arguments are given
Chris Hofstaedtler [Fri, 18 Nov 2022 13:23:37 +0000 (13:23 +0000)] 
script: abort if unused arguments are given

scripts uses either a free-standing "file" argument, or the value
passed as --log-out "file". Additional filenames are ignored.
They are also ignored if --log-in "file" is given, as it turns off
output logging by default (can still be overriden by adding --log-out).
Avoid surprises when passing multiple filenames by writing usage
message instead.

[kzak@redhat.com: - use errtryhelp() rather than usage()]

Signed-off-by: Chris Hofstaedtler <zeha@debian.org>
Reported-by: наб <nabijaczleweli@nabijaczleweli.xyz>
Bug-Debian: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1016193
Signed-off-by: Karel Zak <kzak@redhat.com>
18 months agoMerge branch 'meson/colors' of https://github.com/t-8ch/util-linux
Karel Zak [Mon, 21 Nov 2022 08:56:10 +0000 (09:56 +0100)] 
Merge branch 'meson/colors' of https://github.com/t-8ch/util-linux

* 'meson/colors' of https://github.com/t-8ch/util-linux:
  meson: implement colors-default

18 months agoMerge branch 'master' of https://github.com/rsaxvc/util-linux
Karel Zak [Mon, 21 Nov 2022 08:55:31 +0000 (09:55 +0100)] 
Merge branch 'master' of https://github.com/rsaxvc/util-linux

* 'master' of https://github.com/rsaxvc/util-linux:
  irqtop: improve delta-sort stability

18 months agoMerge branch 'exfat/fields' of https://github.com/t-8ch/util-linux
Karel Zak [Mon, 21 Nov 2022 08:54:36 +0000 (09:54 +0100)] 
Merge branch 'exfat/fields' of https://github.com/t-8ch/util-linux

* 'exfat/fields' of https://github.com/t-8ch/util-linux:
  libblkid: dos: ignore exfat superblocks
  libblkid: exfat: report filesystem size
  libblkid: exfat: validate more fields
  libblkid: exfat: rename superblocks fields to match specification

18 months agoinclude: don't use UL_NG_ prefix
Karel Zak [Mon, 21 Nov 2022 08:50:07 +0000 (09:50 +0100)] 
include: don't use UL_NG_ prefix

Signed-off-by: Karel Zak <kzak@redhat.com>
18 months agoMerge branch 'cifuzz-32-bit' of https://github.com/evverx/util-linux
Karel Zak [Mon, 21 Nov 2022 08:34:13 +0000 (09:34 +0100)] 
Merge branch 'cifuzz-32-bit' of https://github.com/evverx/util-linux

* 'cifuzz-32-bit' of https://github.com/evverx/util-linux:
  ci: run fuzz targets on i386 as well

18 months agoMerge branch 'alignment-check' of https://github.com/evverx/util-linux
Karel Zak [Mon, 21 Nov 2022 08:33:46 +0000 (09:33 +0100)] 
Merge branch 'alignment-check' of https://github.com/evverx/util-linux

* 'alignment-check' of https://github.com/evverx/util-linux:
  oss-fuzz: turn on the alignment check explicitly

18 months agoirqtop: improve delta-sort stability
Richard Allen [Sun, 20 Nov 2022 20:49:43 +0000 (14:49 -0600)] 
irqtop: improve delta-sort stability

When sorting irqs by delta, sort first by delta, then by name.
This helps interrupts occuring at the same rate reach a more
stable display ordering.

Signed-off-by: Richard Allen <rsaxvc@gmail.com>
18 months agomeson: implement colors-default
Thomas Weißschuh [Mon, 21 Nov 2022 01:49:40 +0000 (02:49 +0100)] 
meson: implement colors-default

18 months agolibblkid: dos: ignore exfat superblocks
Thomas Weißschuh [Sun, 20 Nov 2022 04:50:16 +0000 (05:50 +0100)] 
libblkid: dos: ignore exfat superblocks

18 months agolibblkid: exfat: report filesystem size
Thomas Weißschuh [Sat, 19 Nov 2022 19:53:11 +0000 (20:53 +0100)] 
libblkid: exfat: report filesystem size

18 months agolibblkid: exfat: validate more fields
Thomas Weißschuh [Sat, 19 Nov 2022 19:37:50 +0000 (20:37 +0100)] 
libblkid: exfat: validate more fields

18 months agolibblkid: exfat: rename superblocks fields to match specification
Thomas Weißschuh [Sat, 19 Nov 2022 19:32:30 +0000 (20:32 +0100)] 
libblkid: exfat: rename superblocks fields to match specification

Now that we have access to the official exFAT specification [0], let's
use its nomenclature.

[0] https://learn.microsoft.com/en-us/windows/win32/fileio/exfat-specification

18 months agoci: run fuzz targets on i386 as well
Evgeny Vereshchagin [Fri, 18 Nov 2022 07:37:29 +0000 (07:37 +0000)] 
ci: run fuzz targets on i386 as well

18 months agooss-fuzz: turn on the alignment check explicitly
Evgeny Vereshchagin [Fri, 18 Nov 2022 07:09:30 +0000 (07:09 +0000)] 
oss-fuzz: turn on the alignment check explicitly

to somewhat cover architectures where unaligned access can lead to
crashes and make it possible for OSS-Fuzz to catch issues like
https://github.com/util-linux/util-linux/pull/1906.

With this patch applied the libblkid fuzz target built with the OSS-Fuzz
toolchain triggers "runtime error: load of misaligned address" in `probe_exfat`
so it seems to be working.

18 months agomeson: enable warnings
Thomas Weißschuh [Wed, 2 Nov 2022 03:38:07 +0000 (04:38 +0100)] 
meson: enable warnings

18 months agoscript: fix use of utempter
Karel Zak [Wed, 16 Nov 2022 08:19:18 +0000 (09:19 +0100)] 
script: fix use of utempter

libutempter uses SIGCHLD, but script(1) pty implementation completely
control all signals by signalfd and utempter does not work.

The solution is to setup signalfd later (after libutempter use).

Fixes: https://github.com/util-linux/util-linux/issues/1904
Signed-off-by: Karel Zak <kzak@redhat.com>
18 months agollib/pty-session: split PTY and signalfd setup
Karel Zak [Wed, 16 Nov 2022 08:17:52 +0000 (09:17 +0100)] 
llib/pty-session: split PTY and signalfd setup

In some cases applications need to use PTY before signalfd is enabled.

Signed-off-by: Karel Zak <kzak@redhat.com>
18 months agobash-completion: add --zero to rev module
Karel Zak [Wed, 16 Nov 2022 07:48:43 +0000 (08:48 +0100)] 
bash-completion: add --zero to rev module

Addresses: https://github.com/util-linux/util-linux/pull/1900
Signed-off-by: Karel Zak <kzak@redhat.com>
18 months agoMerge branch 'rev0' of https://github.com/t-8ch/util-linux
Karel Zak [Wed, 16 Nov 2022 07:46:29 +0000 (08:46 +0100)] 
Merge branch 'rev0' of https://github.com/t-8ch/util-linux

* 'rev0' of https://github.com/t-8ch/util-linux:
  rev: allow zero-byte as separator
  rev: make separator configurable
  rev: use pointer-size-pairs instead of C-string

18 months agoMerge branch 'oss-fuzz' of https://github.com/t-8ch/util-linux
Karel Zak [Wed, 16 Nov 2022 07:36:19 +0000 (08:36 +0100)] 
Merge branch 'oss-fuzz' of https://github.com/t-8ch/util-linux

* 'oss-fuzz' of https://github.com/t-8ch/util-linux:
  libblkid: iso9660: allocate enough space for UTF16 decoding
  libblkid: ntfs: avoid UB in signed shift

18 months agolibblkid: iso9660: allocate enough space for UTF16 decoding
Thomas Weißschuh [Thu, 10 Nov 2022 18:48:20 +0000 (19:48 +0100)] 
libblkid: iso9660: allocate enough space for UTF16 decoding

When merge_utf16be_ascii() encounters high-codepoint surrogate pairs it
emits four bytes of output for one byte of ascii input.
In addition with the remaining ascii characters from the second loop we
need up to 5 * sizeof(input) / 2 bytes as output buffer.

As we decode up to 128 ascii characters with merge_utf16be_ascii() we
need 320 bytes of buffer available.

Furthermore adapt merge_utf16be_ascii() to not write paste the output
buffer end.

Fix OSS-Fuzz issue 53149 ( #1887 )

18 months agoMerge branch 'widestring-check' of https://github.com/t-8ch/util-linux
Karel Zak [Tue, 15 Nov 2022 13:42:47 +0000 (14:42 +0100)] 
Merge branch 'widestring-check' of https://github.com/t-8ch/util-linux

* 'widestring-check' of https://github.com/t-8ch/util-linux:
  tests: properly check for widestring functionality

18 months agoMerge branch 'blkid_fuzz' of https://github.com/t-8ch/util-linux
Karel Zak [Tue, 15 Nov 2022 13:39:03 +0000 (14:39 +0100)] 
Merge branch 'blkid_fuzz' of https://github.com/t-8ch/util-linux

* 'blkid_fuzz' of https://github.com/t-8ch/util-linux:
  test_blkid_fuzz: fix test execution

18 months agoMerge branch 'unaligned-access' of https://github.com/t-8ch/util-linux
Karel Zak [Tue, 15 Nov 2022 13:32:36 +0000 (14:32 +0100)] 
Merge branch 'unaligned-access' of https://github.com/t-8ch/util-linux

* 'unaligned-access' of https://github.com/t-8ch/util-linux:
  libblkid: f2fs: fix unaligned access
  libblkid: bitlocker: fix unaligned access

19 months agoMerge branch 'lsns--timens' of https://github.com/masatake/util-linux
Karel Zak [Mon, 14 Nov 2022 12:13:55 +0000 (13:13 +0100)] 
Merge branch 'lsns--timens' of https://github.com/masatake/util-linux

* 'lsns--timens' of https://github.com/masatake/util-linux:
  lsns: add TIMENS to the map from CLONE_* to LSNS_ID_*

19 months agosfdisk: (man) fix man page move example
Karel Zak [Mon, 14 Nov 2022 12:12:53 +0000 (13:12 +0100)] 
sfdisk: (man) fix man page move example

Fixes: #1902
Signed-off-by: Karel Zak <kzak@redhat.com>
19 months agolibblkid: f2fs: fix unaligned access
Thomas Weißschuh [Mon, 14 Nov 2022 03:19:34 +0000 (04:19 +0100)] 
libblkid: f2fs: fix unaligned access

19 months agolibblkid: bitlocker: fix unaligned access
Thomas Weißschuh [Mon, 14 Nov 2022 03:18:57 +0000 (04:18 +0100)] 
libblkid: bitlocker: fix unaligned access

Value of 64 has been chose arbitrarily

19 months agorev: allow zero-byte as separator
Thomas Weißschuh [Sat, 12 Nov 2022 04:32:33 +0000 (05:32 +0100)] 
rev: allow zero-byte as separator

Fixes #1868

19 months agotests: properly check for widestring functionality
Thomas Weißschuh [Sun, 13 Nov 2022 01:38:40 +0000 (02:38 +0100)] 
tests: properly check for widestring functionality

Instead of blindly disabling those test under qemu-user use proper
feature-tests.

19 months agorev: make separator configurable
Thomas Weißschuh [Sat, 12 Nov 2022 19:30:59 +0000 (20:30 +0100)] 
rev: make separator configurable

19 months agorev: use pointer-size-pairs instead of C-string
Thomas Weißschuh [Sat, 12 Nov 2022 04:09:38 +0000 (05:09 +0100)] 
rev: use pointer-size-pairs instead of C-string

This allows us to properly handle zero-bytes

19 months agotest_blkid_fuzz: fix test execution
Thomas Weißschuh [Sat, 12 Nov 2022 14:16:32 +0000 (15:16 +0100)] 
test_blkid_fuzz: fix test execution

19 months agolibblkid: ntfs: avoid UB in signed shift
Thomas Weißschuh [Thu, 10 Nov 2022 17:35:00 +0000 (18:35 +0100)] 
libblkid: ntfs: avoid UB in signed shift

Fix OSS-Fuzz issue 53142 ( #1886 )
Fix OSS-Fuzz issue 53160 ( #1888 )

19 months agolsns: add TIMENS to the map from CLONE_* to LSNS_ID_*
Masatake YAMATO [Thu, 10 Nov 2022 21:25:03 +0000 (06:25 +0900)] 
lsns: add TIMENS to the map from CLONE_* to LSNS_ID_*

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
19 months agoMerge branch 'meson/fixes' of https://github.com/t-8ch/util-linux
Karel Zak [Thu, 10 Nov 2022 08:49:20 +0000 (09:49 +0100)] 
Merge branch 'meson/fixes' of https://github.com/t-8ch/util-linux

* 'meson/fixes' of https://github.com/t-8ch/util-linux:
  meson: libmount: compile test helpers
  pylibmount: properly mark initialization function
  meson: define USE_LIBMOUNT_SUPPORT_NAMESPACES
  dmesg: move fallthrough comment to correct place
  meson: use -Wno-cast-function-type for libmount python bindings
  meson: fix test for HAVE_LANGINFO_H

19 months agomore: update basic command description
Karel Zak [Thu, 10 Nov 2022 08:39:47 +0000 (09:39 +0100)] 
more: update basic command  description

Fixes: https://github.com/util-linux/util-linux/discussions/1891
Signed-off-by: Karel Zak <kzak@redhat.com>
19 months agofdisk: make it more obvious that DOS means MBR
Karel Zak [Thu, 10 Nov 2022 08:24:23 +0000 (09:24 +0100)] 
fdisk: make it more obvious that DOS means MBR

Fixes: https://github.com/util-linux/util-linux/issues/1890
Signed-off-by: Karel Zak <kzak@redhat.com>
19 months agomeson: libmount: compile test helpers
Thomas Weißschuh [Thu, 3 Nov 2022 15:47:36 +0000 (16:47 +0100)] 
meson: libmount: compile test helpers

19 months agopylibmount: properly mark initialization function
Thomas Weißschuh [Thu, 10 Nov 2022 03:05:30 +0000 (04:05 +0100)] 
pylibmount: properly mark initialization function

The module initialization function is supposed to only public function
in a module.
Newer versions of meson use -fvisibility=hidden and expected this
function to be marked with PyMODINIT_FUNC [0].

As this does not hurt on autotools either, let's use it everywhere.

[0] https://mesonbuild.com/Release-notes-for-0-63-0.html#python-extension-modules-now-build-with-hidden-visibility

19 months agomeson: define USE_LIBMOUNT_SUPPORT_NAMESPACES
Thomas Weißschuh [Wed, 2 Nov 2022 04:19:19 +0000 (05:19 +0100)] 
meson: define USE_LIBMOUNT_SUPPORT_NAMESPACES

This works around warnings about unused parameters.
To be correct we should be checking for the setns syscall, but so far we
don't have logic for this in meson.

19 months agodmesg: move fallthrough comment to correct place
Thomas Weißschuh [Wed, 2 Nov 2022 04:19:11 +0000 (05:19 +0100)] 
dmesg: move fallthrough comment to correct place

For some reason the existing location is accepted by the autotools build
but not by meson.

19 months agomeson: use -Wno-cast-function-type for libmount python bindings
Thomas Weißschuh [Wed, 2 Nov 2022 04:19:03 +0000 (05:19 +0100)] 
meson: use -Wno-cast-function-type for libmount python bindings

The same way it is done by autotools.

19 months agomeson: fix test for HAVE_LANGINFO_H
Thomas Weißschuh [Wed, 2 Nov 2022 03:38:12 +0000 (04:38 +0100)] 
meson: fix test for HAVE_LANGINFO_H

19 months agoMerge branch 'fix/rfkill-bash-completion-toggle' of https://github.com/dpeukert/util...
Karel Zak [Wed, 9 Nov 2022 11:24:44 +0000 (12:24 +0100)] 
Merge branch 'fix/rfkill-bash-completion-toggle' of https://github.com/dpeukert/util-linux

* 'fix/rfkill-bash-completion-toggle' of https://github.com/dpeukert/util-linux:
  rfkill: add toggle to bash completion

19 months agoskip btrfs tests if kernel support for btrfs is missing
Anatoly Pugachev [Wed, 9 Nov 2022 09:00:12 +0000 (12:00 +0300)] 
skip btrfs tests if kernel support for btrfs is missing

19 months agorfkill: add toggle to bash completion
Daniel Peukert [Tue, 8 Nov 2022 18:48:08 +0000 (19:48 +0100)] 
rfkill: add toggle to bash completion

Signed-off-by: Daniel Peukert <daniel@peukert.cc>
19 months agoMerge branch 'blkid_fuzzing' of https://github.com/xflord/util-linux
Karel Zak [Tue, 8 Nov 2022 09:56:18 +0000 (10:56 +0100)] 
Merge branch 'blkid_fuzzing' of https://github.com/xflord/util-linux

* 'blkid_fuzzing' of https://github.com/xflord/util-linux:
  libblkid: new fuzz target

19 months agobash-completion: update lsns
Karel Zak [Tue, 8 Nov 2022 09:11:57 +0000 (10:11 +0100)] 
bash-completion: update lsns

Signed-off-by: Karel Zak <kzak@redhat.com>
19 months agolsns: show persistent namespace, add --persistent
Karel Zak [Tue, 8 Nov 2022 09:09:28 +0000 (10:09 +0100)] 
lsns: show persistent namespace, add --persistent

* show persistent namespaces (without processes) by default
* add option --persistent only these namespaces

Fixes: https://github.com/util-linux/util-linux/issues/1881
Signed-off-by: Karel Zak <kzak@redhat.com>
19 months agolibblkid: new fuzz target
David Flor [Fri, 28 Oct 2022 15:31:03 +0000 (17:31 +0200)] 
libblkid: new fuzz target

* Added new fuzz target calling blkid_do_safeprobe(), mainly based off of how libblkid is used in the cryptsetup project (same flags used etc.)
* Added the fuzz target to the Makemodule and all relevant scripts.
* Made as part of my upcoming bachelor thesis.

Signed-off-by: David Flor <493294@muni.cz>
19 months agoMerge branch 'fix-use-https' of https://github.com/mbroz/util-linux
Karel Zak [Mon, 7 Nov 2022 11:24:43 +0000 (12:24 +0100)] 
Merge branch 'fix-use-https' of https://github.com/mbroz/util-linux

* 'fix-use-https' of https://github.com/mbroz/util-linux:
  Use https for project-related documentation.

19 months agoMerge branch 'fix-fs-block-size' of https://github.com/mbroz/util-linux
Karel Zak [Mon, 7 Nov 2022 11:23:38 +0000 (12:23 +0100)] 
Merge branch 'fix-fs-block-size' of https://github.com/mbroz/util-linux

* 'fix-fs-block-size' of https://github.com/mbroz/util-linux:
  libblkid: fix regression in setting BLOCK_SIZE value

19 months agoUse https for project-related documentation.
Milan Broz [Sat, 5 Nov 2022 09:43:49 +0000 (10:43 +0100)] 
Use https for project-related documentation.

Some browsers already force https use, fix links
for sites that can be easily redirected.

Signed-off-by: Milan Broz <gmazyland@gmail.com>
19 months agolibblkid: fix regression in setting BLOCK_SIZE value
Milan Broz [Sat, 5 Nov 2022 09:17:48 +0000 (10:17 +0100)] 
libblkid: fix regression in setting BLOCK_SIZE value

In the stable version, the BLOCK_SIZE attribute is
unconditionally set when probing the device.

Commit c9b2297eb1f357d9bc9989aacc874f218081fcb8 added
a new FSINFO flag and conditionally set the BLOCK_SIZE
attribute only when it is used.

This breaks the ABI interface. Cryptsetup reencrypt code
depends on checking the minimal accessible FS block
to prevent the destruction of the filesystem if a user
requests reencryption to a larger sector than
the filesystem can handle.

This patch removes the condition to make ABI compatible
again (as we cannot add FSINFO bit retrospectively).

Signed-off-by: Milan Broz <gmazyland@gmail.com>
19 months agolibblkid: ext: add checksum support
Thomas Weißschuh [Sat, 5 Nov 2022 01:21:27 +0000 (02:21 +0100)] 
libblkid: ext: add checksum support

19 months agolibblkid: ext4: add test
Thomas Weißschuh [Sat, 5 Nov 2022 00:37:09 +0000 (01:37 +0100)] 
libblkid: ext4: add test

19 months agoagetty: always pass user name to login with --
dana [Wed, 2 Nov 2022 19:15:00 +0000 (14:15 -0500)] 
agetty: always pass user name to login with --

19 months agologger: always update header when read from stdin
Karel Zak [Tue, 1 Nov 2022 09:30:06 +0000 (10:30 +0100)] 
logger: always update header when read from stdin

The current code updates the header only when the priority has been
changed. It's incorrect because wanted is a valid header or each entry
(don't forget that logger for stdin use-case is used in pipe to log
long-time running processes).

This patch also fixes the initial timestamp; it was originally generated
on logger startup, it now generates the header on the first message.

$ (sleep 2; date; sleep 2; date; sleep 2; date) | logger --stderr --no-act

old:
<13>Nov  1 10:42:14 kzak: Tue Nov  1 10:42:16 AM CET 2022
<13>Nov  1 10:42:14 kzak: Tue Nov  1 10:42:18 AM CET 2022
<13>Nov  1 10:42:14 kzak: Tue Nov  1 10:42:20 AM CET 2022

new:
<13>Nov  1 10:19:02 kzak: Tue Nov  1 10:19:02 AM CET 2022
<13>Nov  1 10:19:04 kzak: Tue Nov  1 10:19:04 AM CET 2022
<13>Nov  1 10:19:06 kzak: Tue Nov  1 10:19:06 AM CET 2022

Fixes: https://github.com/util-linux/util-linux/issues/1866
Signed-off-by: Karel Zak <kzak@redhat.com>
19 months agoMerge branch 'lscpu/architecture' of https://github.com/t-8ch/util-linux
Karel Zak [Tue, 1 Nov 2022 08:09:32 +0000 (09:09 +0100)] 
Merge branch 'lscpu/architecture' of https://github.com/t-8ch/util-linux

* 'lscpu/architecture' of https://github.com/t-8ch/util-linux:
  lscpu: always create Architecture section

19 months agolibblkid: cleanup romfs prober
Karel Zak [Tue, 1 Nov 2022 08:05:48 +0000 (09:05 +0100)] 
libblkid: cleanup romfs prober

* make sure blkid_probe_get_sb_buffer() returns data
* define variables at the beginning of function

Signed-off-by: Karel Zak <kzak@redhat.com>
19 months agoMerge branch 'romfs/checksum' of https://github.com/t-8ch/util-linux
Karel Zak [Tue, 1 Nov 2022 07:52:29 +0000 (08:52 +0100)] 
Merge branch 'romfs/checksum' of https://github.com/t-8ch/util-linux

* 'romfs/checksum' of https://github.com/t-8ch/util-linux:
  libblkid: romfs: report fssize
  libblkid: romfs: add checksum support

19 months agolscpu: always create Architecture section
Thomas Weißschuh [Sun, 30 Oct 2022 15:10:31 +0000 (16:10 +0100)] 
lscpu: always create Architecture section

cxt->arch can never be NULL.

19 months agoMerge branch 'cdown/2022-10-26/check_handler' of https://github.com/cdown/util-linux
Karel Zak [Mon, 31 Oct 2022 13:03:41 +0000 (14:03 +0100)] 
Merge branch 'cdown/2022-10-26/check_handler' of https://github.com/cdown/util-linux

* 'cdown/2022-10-26/check_handler' of https://github.com/cdown/util-linux:
  kill: Support mandating the presence of a userspace signal handler

19 months agoMerge branch 'lsfd-s390-proc-net-L3' of https://github.com/masatake/util-linux
Karel Zak [Mon, 31 Oct 2022 12:54:45 +0000 (13:54 +0100)] 
Merge branch 'lsfd-s390-proc-net-L3' of https://github.com/masatake/util-linux

* 'lsfd-s390-proc-net-L3' of https://github.com/masatake/util-linux:
  lsfd: unify the code for reading /proc/net/tcp and udp
  lsfd: make the logic for verifying the initial line of /proc/net/{tcp,udp} more flexible

19 months agoMerge branch '1' of https://github.com/neheb/util-linux
Karel Zak [Mon, 31 Oct 2022 12:19:34 +0000 (13:19 +0100)] 
Merge branch '1' of https://github.com/neheb/util-linux

* '1' of https://github.com/neheb/util-linux:
  meson: remove some unused variables
  meson: fix array issue

19 months agoMerge branch 'fadvise-meson-build' of https://github.com/masatake/util-linux
Karel Zak [Mon, 31 Oct 2022 12:09:20 +0000 (13:09 +0100)] 
Merge branch 'fadvise-meson-build' of https://github.com/masatake/util-linux

* 'fadvise-meson-build' of https://github.com/masatake/util-linux:
  meson: build fadvise

19 months agoMerge branch 'fix-jfs' of https://github.com/mbroz/util-linux
Karel Zak [Mon, 31 Oct 2022 12:01:36 +0000 (13:01 +0100)] 
Merge branch 'fix-jfs' of https://github.com/mbroz/util-linux

* 'fix-jfs' of https://github.com/mbroz/util-linux:
  libblkid: jfs - avoid undefined shift

19 months agolibblkid: use blkid_probe_set_value() in more consistent way
Karel Zak [Mon, 31 Oct 2022 11:55:14 +0000 (12:55 +0100)] 
libblkid: use blkid_probe_set_value() in more consistent way

* use it if snprintf unnecessary
* use "const char" to be consistent

Signed-off-by: Karel Zak <kzak@redhat.com>
19 months agoMerge branch 'fs-endianess' of https://github.com/t-8ch/util-linux
Karel Zak [Mon, 31 Oct 2022 11:40:34 +0000 (12:40 +0100)] 
Merge branch 'fs-endianess' of https://github.com/t-8ch/util-linux

* 'fs-endianess' of https://github.com/t-8ch/util-linux:
  libblkid: squashfs3: report endianness
  libblkid: zfs: report endianness
  libblkid: ufs: report endianness
  libblkid: minix: report endianness
  libblkid: cramfs: report endianness
  libblkid: befs: report endianness
  libblkid: add blkid_probe_set_fsendianness()
  libblkid: squashfs: add testcase
  libblkid: squashfs3: add testcase

19 months agolibsmartcols: fix divide by zero [coverity]
Karel Zak [Mon, 31 Oct 2022 08:33:24 +0000 (09:33 +0100)] 
libsmartcols: fix divide by zero [coverity]

Signed-off-by: Karel Zak <kzak@redhat.com>
19 months agomeson: build fadvise
Masatake YAMATO [Sun, 30 Oct 2022 01:33:57 +0000 (10:33 +0900)] 
meson: build fadvise

Reported-by: Rosen Penev <rosenp@gmail.com>
Signed-off-by: Masatake YAMATO <yamato@redhat.com>
19 months agomeson: remove some unused variables
Rosen Penev [Fri, 28 Oct 2022 23:58:25 +0000 (16:58 -0700)] 
meson: remove some unused variables

Found with muon's analyze.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
19 months agomeson: fix array issue
Rosen Penev [Fri, 28 Oct 2022 23:47:57 +0000 (16:47 -0700)] 
meson: fix array issue

+= cannot be used with a dep. Found with muon's analyze:

meson.build:643:5: error expected type dict|disabler|int|list|str, got
dep

Signed-off-by: Rosen Penev <rosenp@gmail.com>
19 months agolibblkid: jfs - avoid undefined shift
Milan Broz [Thu, 27 Oct 2022 14:05:35 +0000 (16:05 +0200)] 
libblkid: jfs - avoid undefined shift

JFS probe can use undefined shift if stored log2 of block
size is a bogus value. Avoid this by limiting shift size.

Reproducer found with OSS-Fuzz (issue 52643) running over
cryptsetup project (blkid is used in header init).

Signed-off-by: Milan Broz <gmazyland@gmail.com>
19 months agokill: Support mandating the presence of a userspace signal handler
Chris Down [Wed, 26 Oct 2022 14:47:36 +0000 (15:47 +0100)] 
kill: Support mandating the presence of a userspace signal handler

In production we've had several incidents over the years where a process
has a signal handler registered for SIGHUP or one of the SIGUSR signals
which can be used to signal a request to reload configs, rotate log
files, and the like. While this may seem harmless enough, what we've
seen happen repeatedly is something like the following:

1. A process is using SIGHUP/SIGUSR[12] to request some
   application-handled state change -- reloading configs, rotating a log
   file, etc;
2. This kind of request is deprecated and removed, so the signal handler
   is removed. However, a site where the signal might be sent from is
   missed (often logrotate or a service manager);
3. Because the default disposition of these signals is terminal, sooner
   or later these applications are going to be sent SIGHUP or similar
   and end up unexpectedly killed.

I know for a fact that we're not the only organistion experiencing this:
in general, signal use is pretty tricky to reason about and safely
remove because of the fairly aggressive SIG_DFL behaviour for some
common signals, especially for SIGHUP which has a particularly ambiguous
meaning. Especially in a large, highly interconnected codebase,
reasoning about signal interactions between system configuration and
applications can be highly complex, and it's inevitable that on occasion
a callsite will be missed.

In some cases the right call to avoid this will be to migrate services
towards other forms of IPC for this purpose, but inevitably there will
be some services which must continue using signals, so we need a safe
way to support them.

This patch adds support for the -r/--require-handler flag, which checks
if a userspace handler is present for the signal being sent. If it is
not, the process will be skipped.

With this flag we can enforce that all SIGHUP reload cases and SIGUSR
equivalents use --require-handler. This effectively mitigates the case
we've seen time and time again where SIGHUP is used to rotate log files
or reload configs, but the sending site is mistakenly left present after
the removal of signal handler, resulting in unintended termination of
the process.

Signed-off-by: Chris Down <chris@chrisdown.name>
19 months agolibblkid: squashfs3: report endianness
Thomas Weißschuh [Wed, 26 Oct 2022 14:32:08 +0000 (16:32 +0200)] 
libblkid: squashfs3: report endianness

19 months agolibblkid: zfs: report endianness
Thomas Weißschuh [Wed, 26 Oct 2022 14:19:04 +0000 (16:19 +0200)] 
libblkid: zfs: report endianness

19 months agolibblkid: ufs: report endianness
Thomas Weißschuh [Wed, 26 Oct 2022 14:17:48 +0000 (16:17 +0200)] 
libblkid: ufs: report endianness

19 months agolibblkid: minix: report endianness
Thomas Weißschuh [Wed, 26 Oct 2022 14:16:05 +0000 (16:16 +0200)] 
libblkid: minix: report endianness

19 months agolibblkid: cramfs: report endianness
Thomas Weißschuh [Wed, 26 Oct 2022 14:07:44 +0000 (16:07 +0200)] 
libblkid: cramfs: report endianness

19 months agolibblkid: befs: report endianness
Thomas Weißschuh [Wed, 26 Oct 2022 14:07:35 +0000 (16:07 +0200)] 
libblkid: befs: report endianness

19 months agolibblkid: add blkid_probe_set_fsendianness()
Thomas Weißschuh [Wed, 26 Oct 2022 14:04:27 +0000 (16:04 +0200)] 
libblkid: add blkid_probe_set_fsendianness()

19 months agolibblkid: squashfs: add testcase
Thomas Weißschuh [Wed, 26 Oct 2022 14:31:29 +0000 (16:31 +0200)] 
libblkid: squashfs: add testcase

19 months agolibblkid: squashfs3: add testcase
Thomas Weißschuh [Wed, 26 Oct 2022 14:31:17 +0000 (16:31 +0200)] 
libblkid: squashfs3: add testcase

19 months agolibmount: Reuse the guessed root device
Viktor Rosendahl (BMW) [Mon, 24 Oct 2022 09:36:03 +0000 (11:36 +0200)] 
libmount: Reuse the guessed root device

Inside a container, the file /proc/self/mountinfo may contain many lines
with /dev/root. It is also quite likely that /dev/root is not visible
inside the container. This may cause mnt_guess_system_root() to try to use
libblkid before giving up, through mnt_resolve_spec() and
mnt_resolve_tag(), which calls blkid_evaluate_tag(). The call to
blkid_evaluate_tag() may trigger a scan of all block devices, which is
expensive.

For this reason, it doesn't make any sense for kernel_fs_postparse()
to call mnt_guess_system_root() more than once for every call to
mnt_table_parse_stream. Instead, save the result from the first call and
reuse it for all subsequent calls to kernel_fs_postparse(), so that there
is at most one call to mnt_guess_system_root() for every call
to mnt_table_parse_stream().

[kzak@redhat.com: - use sysroot_ prefix for the cached variables
  - simplify code logic in kernel_fs_postparse()
  - add free() to parser_cleanup()]

Signed-off-by: Viktor Rosendahl (BMW) <viktor.rosendahl@gmail.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
19 months agoMerge branch 'cramfs/endianess-mismatch' of https://github.com/t-8ch/util-linux
Karel Zak [Wed, 26 Oct 2022 07:41:29 +0000 (09:41 +0200)] 
Merge branch 'cramfs/endianess-mismatch' of https://github.com/t-8ch/util-linux

* 'cramfs/endianess-mismatch' of https://github.com/t-8ch/util-linux:
  libblkid: cramfs: report version
  libblkid: cramfs: report filesystem size
  libblkid: test big endian cramfs image
  libblkid: cramfs: handle cross-endianess for checksums

19 months agolsfd: unify the code for reading /proc/net/tcp and udp
Masatake YAMATO [Wed, 26 Oct 2022 03:01:37 +0000 (12:01 +0900)] 
lsfd: unify the code for reading /proc/net/tcp and udp

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
19 months agolsfd: make the logic for verifying the initial line of /proc/net/{tcp,udp} more flexible
Masatake YAMATO [Wed, 26 Oct 2022 02:56:00 +0000 (11:56 +0900)] 
lsfd: make the logic for verifying the initial line of /proc/net/{tcp,udp} more flexible

The format of /proc/net/udp was changed in
6c25449e1a32 ("net: udp: fix alignment problem in udp4_seq_show()").
This kind of change can be applied to /proc/net/tcp, too.

Co-Authored-by: Thomas Weißschuh <thomas@t-8ch.de>
Co-Authored-by: Masatake YAMATO <yamato@redhat.com>
19 months agolibblkid: cramfs: report version
Thomas Weißschuh [Mon, 24 Oct 2022 21:34:04 +0000 (23:34 +0200)] 
libblkid: cramfs: report version

19 months agolibsmartcols: make columns reduction more backward compatible
Karel Zak [Tue, 25 Oct 2022 10:35:38 +0000 (12:35 +0200)] 
libsmartcols: make columns reduction more backward compatible

The original version truncates only columns with extreme and truncate
flags.

Signed-off-by: Karel Zak <kzak@redhat.com>
19 months agolibsmartcols: improve columns reduction
Karel Zak [Fri, 14 Oct 2022 09:18:40 +0000 (11:18 +0200)] 
libsmartcols: improve columns reduction

Signed-off-by: Karel Zak <kzak@redhat.com>
19 months agolibsmartcols: truncate by one char
Karel Zak [Thu, 13 Oct 2022 09:56:20 +0000 (11:56 +0200)] 
libsmartcols: truncate by one char

Signed-off-by: Karel Zak <kzak@redhat.com>
19 months agolibsmartcols: use local sqrt() implemenation
Karel Zak [Thu, 13 Oct 2022 08:25:25 +0000 (10:25 +0200)] 
libsmartcols: use local sqrt() implemenation

We do not need any powerful and precise sqrt implementation, so
let's use local code rather than depend on an external library.

Signed-off-by: Karel Zak <kzak@redhat.com>
19 months agolibsmartcols: use standard deviation to optimize columns width
Karel Zak [Wed, 12 Oct 2022 07:46:56 +0000 (09:46 +0200)] 
libsmartcols: use standard deviation to optimize columns width

The standard deviation together with mean (average) of the data width
can be used to detect "problematic" columns and to calculate optimal
width.

The idea is to sort column by avg+deviation and start columns width
reduction from the column with the most wide and variable width. The
width reduction is also optimized by 68–95–99 rule (aka empirical
rule, avg+n*deviation; where n={1,2,3}) to cover 95% or 68% data in
the column.

The disadvantage is we need to link libsmartcols with -lm (math) due
to sqrt() function.

Signed-off-by: Karel Zak <kzak@redhat.com>
19 months agolosetup: improve backing-file column formatting
Karel Zak [Wed, 12 Oct 2022 07:43:17 +0000 (09:43 +0200)] 
losetup: improve backing-file column formatting

Let's mark the column by no-extreme libsmartcols flag. It makes
output more compact if there is too long mount path.

Signed-off-by: Karel Zak <kzak@redhat.com>
19 months agolsblk: improve mountpoint columns formatting
Karel Zak [Wed, 12 Oct 2022 07:43:17 +0000 (09:43 +0200)] 
lsblk: improve mountpoint columns formatting

Let's mark the columns by no-extreme libsmartcols flag. It makes
output more compact if there are too long mount paths.

Signed-off-by: Karel Zak <kzak@redhat.com>
19 months agolibsmartcols: improve debug messages
Karel Zak [Wed, 12 Oct 2022 07:40:43 +0000 (09:40 +0200)] 
libsmartcols: improve debug messages

* disable debug for tree-wall; it generates to many messages

* fix way how library prints column flags, 0x<hex> is more redable

Signed-off-by: Karel Zak <kzak@redhat.com>
19 months agotests: don't print mount hins on terminal
Karel Zak [Tue, 25 Oct 2022 09:04:20 +0000 (11:04 +0200)] 
tests: don't print mount hins on terminal

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