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.
Yuezhang Mo [Wed, 11 Oct 2023 10:42:11 +0000 (18:42 +0800)]
libblkid: exfat: fix fail to find volume label
Commit f98b56326 set the maximum number of iterations to 10000.
If the volume label is after the 10000th entry, the volume label
will not be found. So this commit sets the maximum number of
iterations to correct value 256×1024×1024/32.
Fixes: f98b56326 ("libblkid: [exfat] Limit maximum number of iterations in find_label") Signed-off-by: Yuezhang Mo <Yuezhang.Mo@sony.com> Reviewed-by: Andy Wu <Andy.Wu@sony.com> Reviewed-by: Aoyama Wataru <wataru.aoyama@sony.com>
Karel Zak [Mon, 9 Oct 2023 11:04:07 +0000 (13:04 +0200)]
Merge branch 'libmount/errormsg' of https://github.com/t-8ch/util-linux
* 'libmount/errormsg' of https://github.com/t-8ch/util-linux:
libmount: report all kernel messages for fd-based mount API
libmount: add helper to log mount messages as emitted by kernel
libmount: change syscall status macros to be functions
Karel Zak [Mon, 9 Oct 2023 10:26:37 +0000 (12:26 +0200)]
Merge branch 'lsfs--sockdiag-RW' of https://github.com/masatake/util-linux
* 'lsfs--sockdiag-RW' of https://github.com/masatake/util-linux:
lsfd: (man) update the description of ENDPOINTS column of UNIX-Stream sockets
tests: (lsfd) extend the mkfds-socketpair case to test ENDPOINTS with SOCK.SHUTDOWN info
lsfd: append SOCK.SHUTDOWN value to ENDPOINTS column of UNIX-STREAM sockets
tests: (lsfd) add a case for testing SOCK.SHUTDOWN column
tests: (test_mkfds::socketpair) add "halfclose" parameter
lsfd: don't capitalize the help strings for the columns
lsfd: (man) write about SOCK.SHUTDOWN column
lsfd: add SOCK.SHUTDOWN column
lsfd: call xinfo backend method before calling socket generic method when filling columns
tests: (lsfd) add a case for testing ENDPOINTS column of UNIX-STREAM sockets
tests: (lsfd::mkfds-socketpair) make a case for testing DGRAM a subtest and add a subtest for STREAM
lsfd: (man) document the ENDPOINT column for UNIX socket
lsfd: fill ENDPOINTS column of unix socket using UNIX_DIAG_PEER information
lsfd: make the sock_xinfo layer be able to prepare an ipc_class for a given socket
lsfd: initialize the ipc table before loading lists of unix socket peers via netlink diag
`conf` as configuration_data() object can contain any datatype.
For `HAVE_FOO` variables this will be a `1` int to generate
`#define HAVE_FOO 1` or a `false` bool to generate `#undef HAVE_FOO`
in `conf.h`.
When retrieving and testing `HAVE_FOO` from `conf` it can be both types.
Newer versions of meson are unhappy about comparisions of int with
non-int
../meson.build:734: DEPRECATION: Project uses feature that was always broken, and is now deprecated since '1.2.0': int operations with non-int. It is not commutative and only worked because of leaky Python abstractions.
WARNING: Broken features used:
* 1.2.0: {'int operations with non-int'}
As both `int` and `bool` support a `.to_string()` method, we can use
that to convert them into a well-known type and compare that.
Unfortunately meson does not implement a way to determine the type of a
value.
A method `int.to_int()` would also have worked but does not exist.
This broken feature was actually first recognized in util-linux.
See #2312 and https://github.com/mesonbuild/meson/pull/11879.
The function ul_prefix_fopen does not properly check for paths which are
too long. Since the only caller of ul_prefix_fopen can be easily
converted to ul_path_fopen, remove the function.
libmount: add helper to log mount messages as emitted by kernel
The kernel helpfully provides feedback about failed operations via the
filesystem descriptor. Read that information and expose it via libmounts
debug facilities.