Karel Zak [Fri, 19 Aug 2022 07:29:56 +0000 (09:29 +0200)]
Merge branch 'lsfd-pidfd' of https://github.com/masatake/util-linux
* 'lsfd-pidfd' of https://github.com/masatake/util-linux:
lsfd.1.adoc: write about how pidfds are represented in NAME column
lsfd: show pids targeted by pidfds in NAME column
lsfd: add a helper function to get 'struct proc' object for given pid
lsfd: introduce a method table for supporting various anon inodes
lsfd.1.adoc: write more about TYPE column
lsfd.1.adoc: fix a wrong formatting
lsfd.1.adoc: fix typos
lsfd.1.adoc: use monospace face instead of italic face
lsfd: delete __unused__ attr from a used parameter
Karel Zak [Mon, 8 Aug 2022 09:18:49 +0000 (11:18 +0200)]
Merge branch 'lsfd--testing-mmapped-packet-socket' of https://github.com/masatake/util-linux
* 'lsfd--testing-mmapped-packet-socket' of https://github.com/masatake/util-linux:
test: (lsfd) add a case for displaying PROTONAME column of mmap'ed AF_PACKET socket
Khem Raj [Sun, 7 Aug 2022 21:39:19 +0000 (14:39 -0700)]
check for sys/pidfd.h
This header in newer glibc defines the signatures of functions
pidfd_send_signal() and pidfd_open() and when these functions are
defined by libc then we need to include the relevant header to get
the definitions. Clang 15+ has started to error out when function
signatures are missing.
Fixes errors like
misc-utils/kill.c:402:6: error: call to undeclared function 'pidfd_send_signal'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
if (pidfd_send_signal(pfd, ctl->numsig, &info, 0) < 0)
Karel Zak [Wed, 20 Jul 2022 13:23:01 +0000 (15:23 +0200)]
lib/fileutils: fix compiler warning
lib/fileutils.c: In function ‘dup_fd_cloexec’:
lib/fileutils.c:75:35: warning: unused parameter ‘lowfd’ [-Wunused-parameter]
int dup_fd_cloexec(int oldfd, int lowfd)
^
Addresses: https://github.com/util-linux/util-linux/issues/1755 Signed-off-by: Karel Zak <kzak@redhat.com>
Kai Lüke [Thu, 14 Jul 2022 21:49:16 +0000 (23:49 +0200)]
meson: Install binaries to prefix
When compiled in Flatpak /usr is read-only and the /app prefix is used.
However, the binary installation did not use the prefix but had /usr
hardcoded.
Use the prefix instead of /usr when assembling the prefix/(s)bin paths.
The internal Apple model numbers for the SoCs are somewhat
confusing given that they are mostly similar and differ by only
one or two digits. Instead, use the public nomenclature for these
chips to avoid ambiguity and beautify the output.
Signed-off-by: James Calligeros <jcalligeros99@gmail.com>
Sol Boucher [Fri, 8 Jul 2022 16:09:13 +0000 (12:09 -0400)]
unshare: Fix "you (user xxxx) don't exist" error when uid differs from primary gid
This problem affected the --map-auto and --map-groups=auto command-line switches.
The root cause is that /etc/subgid is indexed by user or uid, not by group or gid;
therefore, we should be using the effective uid to find entries in this file, just
as we do for /etc/subuid.
Michael Trapp [Mon, 20 Jun 2022 15:10:36 +0000 (17:10 +0200)]
libuuid: Implement continuous clock handling for time based UUIDs
In a uuidd setup, the daemon is a singleton and can maintain it's own
resources for time based UUID generation. This requires a dedicated
'clock sequence range' but does not need any further lock/update of
the LIBUUID_CLOCK_FILE from uuidd. The range of available clock values
is extended by a continuous handling of the clock updates - instead of
updating the value to the current timestamp, it is incremented by
the number of requested UUIDs.
Philip Hazelden [Sun, 3 Jul 2022 21:46:16 +0000 (22:46 +0100)]
Rename: fix empty 'from' with / in filename.
Previously, if we did e.g.
rename '' _ ./foo.txt
it would try to rename to ._/foo.txt, because `string_replace` was
passed `s="/foo.txt"` and `from` would match at the front. Now we pass
`s="foo.txt"`.
This doesn't affect the case when `to` contains a slash. In that
situation we'll still place `to` at the very beginning of the path, e.g.
rename '' _/ ./foo.txt # rename to _/./foo.txt
rename '' /_ ./foo.txt # rename to /_./foo.txt
Karel Zak [Mon, 27 Jun 2022 10:40:29 +0000 (12:40 +0200)]
Merge branch 'dm_leaf_holders' of https://github.com/wjordan/util-linux
* 'dm_leaf_holders' of https://github.com/wjordan/util-linux:
Improve is_dm_leaf performance Read from `/holders` instead of `/slaves` to determine whether the device is a leaf node, eliminating a scan across all block devices in the system.
Will Jordan [Wed, 22 Jun 2022 22:13:11 +0000 (15:13 -0700)]
Improve is_dm_leaf performance
Read from `/holders` instead of `/slaves` to determine
whether the device is a leaf node, eliminating a scan
across all block devices in the system.
lishengyu [Thu, 23 Jun 2022 06:02:49 +0000 (14:02 +0800)]
lsns: fix the memory leak.
==28129== 96 bytes in 3 blocks are possibly lost in loss record 1 of 4
==28129== at 0x4837B65: calloc (vg_replace_malloc.c:752)
==28129== by 0x405C83: xcalloc (xalloc.h:60)
==28129== by 0x405C83: netnsid_cache_add (lsns.c:389)
==28129== by 0x405C83: get_netnsid (lsns.c:486)
==28129== by 0x405C83: read_process (lsns.c:549)
==28129== by 0x403FB4: read_processes (lsns.c:586)
==28129== by 0x403FB4: main (lsns.c:1417)
==28129==
==28129== 119,664 (384 direct, 119,280 indirect) bytes in 1 blocks are definitely lost in loss record 4 of 4
==28129== at 0x4837B65: calloc (vg_replace_malloc.c:752)
==28129== by 0x4055F5: xcalloc (xalloc.h:60)
==28129== by 0x4055F5: read_process (lsns.c:516)
==28129== by 0x403FB4: read_processes (lsns.c:586)
==28129== by 0x403FB4: main (lsns.c:1417)
Masatake YAMATO [Fri, 17 Jun 2022 15:28:38 +0000 (00:28 +0900)]
lsfd: try including asm/fcntl.h first for decoding flags of fdinfo
Close #1720
The original code tried including asm-generic/fcntl.h before trying
including asm/fcntl.h. This caused a bug in decoding flag of fdinfo
on Linux running on armv7l.
Karel Zak [Fri, 17 Jun 2022 11:42:11 +0000 (13:42 +0200)]
libmount: remove support for writable /etc/mtab
This commit removes --enable-libmount-support-mtab.
The classic /etc/mtab is broken by design. It does not support
namespaces, chroots, etc. The only sane way to keep track of
mounted filesystems is to ask the kernel. It's a bad idea to maintain
a mount table in userspace.
Masatake YAMATO [Thu, 16 Jun 2022 13:42:12 +0000 (22:42 +0900)]
test: (lsfd) ignore noatime mnt flag when testing a fd opening / directory
Close #1717.
If the file system where the target directory is is mounted with
"noatime" flag, Linux kernel may set O_NOATIME to the fd associated
with the target directory. As a result, mkfds-directory test failed.
With this change, mkfds-directory deletes "noatime" from the output
of lsfd before verifying the output if "noatime" mount flag is set
to the file system where the directory opened by mkfds-directory is.
Karel Zak [Wed, 15 Jun 2022 08:03:44 +0000 (10:03 +0200)]
more: restore exit-on-eof if POSIXLY_CORRECT is not set
In version 2.38, exit-on-eof has been disabled by default. This change
is annoying for users and forces many users to use 'alias more="more
-e"'. It seems better to force POSIX lovers to use POSIXLY_CORRECT
env. variable and stay backwardly compatible by default.
Addresses: https://github.com/util-linux/util-linux/issues/1703
Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=2088493 Signed-off-by: Karel Zak <kzak@redhat.com>
Karel Zak [Mon, 13 Jun 2022 09:17:35 +0000 (11:17 +0200)]
Merge branch 'change-default-comparison-method' of https://github.com/DrHyde/util-linux
* 'change-default-comparison-method' of https://github.com/DrHyde/util-linux:
change the default comparison method on Mac OS to suppress a warning that's going to fall back to memcmp