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
Masatake YAMATO [Wed, 8 Jun 2022 15:32:19 +0000 (00:32 +0900)]
lsfd: use constants defined in asm/fctl.h flags field of a fdinfo
Close #1709.
The original code decoded the field using constants defined in
/usr/include/fcntl.h. The constants defined in /usr/include/fcntl.h
was suitable for passing to the kernel as a part of arguments of
system calls like open(2). However, they were not suitable for
decoding the field.
With these constants, 0300000 is decoded as "directory,_tmpfile" or
"largefile,directory,_tmpfile".
Unexpectedly the decoded string has "_tmpfile".
It has "largefile" only when we define __USE_LARGEFILE64 when building
lsfd though it should have "largefile" always.
Quoted from /usr/include/asm-generic/fcntl.h:
#ifndef O_LARGEFILE
#define O_LARGEFILE 00100000
#endif
#ifndef O_DIRECTORY
#define O_DIRECTORY 00200000 /* must be a directory */
#endif
#ifndef __O_TMPFILE
#define __O_TMPFILE 020000000
#endif
The decoded string is "largefile,directory". It doesn't depend on
__USE_LARGEFILE64.
This change adds lsfd-decode-file-flags.c, a new small and isolated
source file, in which lsfd_decode_file_flags(), the function for
decoding the field is defined.
include/c.h includes /usr/include/fcntl.h. Almost all lsfd related
source files includes include/c.h indirectly. On the other hand,
lsfd-decode-file-flags.c includes only /usr/include/asm-generic/fcntl.h
or /usr/include/asm/fcntl.h. So the function can decode the field
expectedly.
Karel Zak [Wed, 8 Jun 2022 09:31:57 +0000 (11:31 +0200)]
column: improve --table-hide
This option affects list of visible columns, so it's better to apply
it before any other flags, because "-1" placeholder depends on visible
columns. For example:
echo "A B C D" | column --table --table-maxout --table-right -1 --table-hide 4
needs to hide column #4 (D) and align #3 (C) to the right.
Karel Zak [Tue, 7 Jun 2022 07:11:56 +0000 (09:11 +0200)]
lslogins: improve prefixes interpretation
It seems that for example 'passwd --lock' uses two exclamation marks
in password field. It seems better to assume arbitrary number of '!'
and '*' prefixes.
The patch also makes description of the PWD-EMPTY output field more
explicit.
Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=2093166 Signed-off-by: Karel Zak <kzak@redhat.com>
zhenwei pi [Fri, 3 Jun 2022 12:24:01 +0000 (20:24 +0800)]
lsblk: introduce 'MQ' column
Typically a modern block device supports mutil queues feature, count
queues by walking '$sysfs/mq' directory. If no '$sysfs/mq' exists, it
is a legacy single queue.
~# lsblk --nvme -o NAME,TYPE,MODEL,TRAN,RQ-SIZE,MQ
NAME TYPE MODEL TRAN RQ-SIZE MQ
nvme0n1 disk INTEL SSDPF2KX038TZ nvme 1023 135
nvme3n1 disk INTEL SSDPE2KX020T8 nvme 1023 128
nvme1n1 disk SAMSUNG MZQL23T8HCLS-00A07 nvme 1023 129
nvme2n2 disk RP2A03T8RK004LX nvme 1023 64
nvme2n3 disk RP2A03T8RK004LX nvme 1023 64
Signed-off-by: zhenwei pi <pizhenwei@bytedance.com>