Thomas Weißschuh [Sun, 19 Nov 2023 16:27:40 +0000 (17:27 +0100)]
treewide: explicitly mark unused arguments
The autotools build used -Wno-unused-parameter to silence these warnings
for a few files. On meson however this configuration was not duplicated
leading to persistent warnings, preventing the usage of -Werror.
Instead of having to maintain the exceptions in two buildsystems, mark
the exceptions directly in the source code.
Afterward clean up autotools to not use -Wno-unused-parameter anymore.
libuuid: avoid truncate clocks.txt to improve performance
Instead of explicitly truncating clocks.txt file, pad with
whitespaces in the end of file.
This is done to improve performance of libuuid on xfs
filesystems. Instead of truncating the file, pad it with whitespaces.
This is anyways used as a failsafe method in case truncate fails.
The reason why this regression was introduced was because of: 869ae85dae64 ("xfs: flush new eof page on truncate to avoid post-eof corruption")
An attempt to move the clocks.txt to /run (tmpfs) has been attempted before
[1] and with commit ab2e7dd17 ("libuuid: move clock state file from
/var/lib to /var/run"). The latter was reverted.
Karel Zak [Mon, 13 Nov 2023 09:36:16 +0000 (10:36 +0100)]
Merge branch 'lslocks--per-process' of https://github.com/masatake/util-linux
* 'lslocks--per-process' of https://github.com/masatake/util-linux:
lslocks: (man) update the note about OFDLCK
lslocks: (test) add a case for OFDLCK type locks
lslocks: use information extracted from "locks: " column of /proc/$pid/fdinfo/*
lslocks: (refactor) lift up the code destroying the lock list for future extension
lslocks: rename functions for future extension
lslocks: refactor the code reading /proc/locks
lslocks: (refactor) remove 'pid' global variable
lslocks: (man) document LEASE type
lslocks: (test) add a case
Define cs_min through a define and not a const int to avoid the
following build failure with -O0 raised since version 2.39 and
https://github.com/util-linux/util-linux/commit/2fa4168c8bc9d5438bc1dfadda293c7c21b6fa59:
libuuid/src/gen_uuid.c: In function 'uuid_generate_time_generic':
libuuid/src/gen_uuid.c:536:33: error: initializer element is not constant
THREAD_LOCAL int cache_size = cs_min;
^~~~~~
For consistency, also use define for cs_max and cs_factor
Karel Zak [Wed, 8 Nov 2023 11:35:30 +0000 (12:35 +0100)]
Merge branch 'lsfd--tty' of https://github.com/masatake/util-linux
* 'lsfd--tty' of https://github.com/masatake/util-linux:
tests: (lsfd) add a case testing NAME, SOURCE, ENDPOINTS, and PTMX.TTY-INDEX columns of pts fds
tests: (test_mkfds::pty) add a new factory
lsfd: fill ENDPOINTS column for pty devices
lsfd: add attach_xinfo and get_ipc_class methods to cdev_ops
lsfd: add PTMX.TTY-INDEX column
lsfd: utilize /proc/tty/drivers for filling SOURCE column of tty devices
lsfd: make the order of calling finalize_* and initialize_* consistent
Karel Zak [Thu, 2 Nov 2023 09:41:03 +0000 (10:41 +0100)]
libmount: improve mnt_table_next_child_fs()
The function utilizes the struct libmnt_itr to iterate through the mountinfo file
but neglects the direction specified by the iterator. This a bug. The application
must manage the direction, as, for instance, umount(8) requires the children of
the mountpoint in reverse order.
Fixes: https://github.com/util-linux/util-linux/issues/2552 Signed-off-by: Karel Zak <kzak@redhat.com>
Karel Zak [Wed, 1 Nov 2023 13:47:41 +0000 (14:47 +0100)]
disk-utils: add SPDX and Copyright notices
Explicitly state the license (usually GPL-2.0-or-later; our default)
and include copyright statements in all files to prevent false positive
reports from license analysis tools. Add also add SPDX-License-Identifier
tag to all files.
Junxiao Bi [Wed, 25 Oct 2023 20:36:03 +0000 (13:36 -0700)]
loopdev: report lost loop devices
If a /dev/loopX is lost because someone might have removed it by mistake,
future losetup operations on that loop device will fail and losetup
--all and --list will not report the devices (although kernel still
uses it).
Since /sysfs still have the loop device intact, detect that and report it.
Changes:
* --list and --all add "(lost)" after device node path
# losetup
NAME SIZELIMIT OFFSET AUTOCLEAR RO BACK-FILE DIO LOG-SEC
/dev/loop0 (lost) 0 0 0 0 /root/l0.img 0 512
# losetup -a
/dev/loop0 (lost): []: (/root/l0.img)
* use /sys to get devno rather than stat()
* report warning after failed operation
# losetup -d /dev/loop0
losetup: /dev/loop0: detach failed: No such file or directory
losetup: device node /dev/loop0 (7:0) is lost. You may use mknod(1) to recover it.
* fix copy & past bugs in some API comments
Co-Author: Karel Zak <kzak@redhat.com> Signed-off-by: Junxiao Bi <junxiao.bi@oracle.com> Signed-off-by: Karel Zak <kzak@redhat.com>
Karel Zak [Wed, 25 Oct 2023 09:37:21 +0000 (11:37 +0200)]
Merge branch 'refine-the-choice-of-stream-related-functions-in-usage' of https://github.com/masatake/util-linux
* 'refine-the-choice-of-stream-related-functions-in-usage' of https://github.com/masatake/util-linux:
Make the ways of using output stream consistent in usage()
Use fputs instead of fprintf if possible
Karel Zak [Mon, 23 Oct 2023 12:47:35 +0000 (14:47 +0200)]
libsmartcols: add wrap-zero test
* modify samples/fromfile.c to use scols_wrapzero_nextchunk() callback
if "wrapzero" specified for the test colum
* add col-wrapzero and data-string-zero to define the column and zero
separated data
Karel Zak [Mon, 23 Oct 2023 12:35:21 +0000 (14:35 +0200)]
libsmartcols: support \x?? for data by samples/fromfile.c
The test (sample) binary already supports \n in strings to covert it
to the real line-break. It seem more generic to use \x?? (hex) to
support arbitrary byte in the column data.
Karel Zak [Thu, 12 Oct 2023 20:38:43 +0000 (22:38 +0200)]
libsmartcols: multi-line cells refactoring
* move data wrapping code to column.c
* do data wrapping on one place when copy cell data to buffer
* use table cursor in affected functions
* calculate tree ASCII-art to wrapped data
* mark wrap_chunksize() callback as deprecated; library calculates
the size itself from real data
Karel Zak [Thu, 12 Oct 2023 09:57:10 +0000 (11:57 +0200)]
libsmartcols: add table cursor
The cursor makes it simple for callbacks to access information about
the current cell, line and column. It will reduce number of necessary
arguments for callbacks.
Karel Zak [Mon, 23 Oct 2023 10:29:50 +0000 (12:29 +0200)]
Merge branch 'misc/fixes' of https://github.com/t-8ch/util-linux
* 'misc/fixes' of https://github.com/t-8ch/util-linux:
meson: don't try to build test_ca without libcap-ng
blkpr: store return value of getopt_long in int
Karel Zak [Mon, 23 Oct 2023 10:26:45 +0000 (12:26 +0200)]
Merge branch 'path' of https://github.com/stoeckmann/util-linux
* 'path' of https://github.com/stoeckmann/util-linux:
sys-utils/lscpu: Use ul_path_scanf where possible
lib/path: Set errno in case of fgets failure
lib/path: fix typos
lib/path: remove ul_prefix_fopen
lib/path: set errno in case of error
lib/path: fix possible out of boundary access
Thomas Weißschuh [Sat, 14 Oct 2023 10:14:42 +0000 (12:14 +0200)]
libblkid: (vxfs) add test files
The test files have been constructed manually from the prober.
While not providing a real test at least they make sure that the
existing logic stays stable.