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>
libblkid: add FSSIZE implementation for btrfs and ext
The implementation does not take into account complete metadata
overhead. The BTRFS one doesn't consider redundant data in RAID
configuration. The ext one doesn't take into account file system
overhead.
The name BLOCK_SIZE is unfortunate. This tag doesn't represent
commonly used file system block size but minimal block size
accessible by file system (sector size).
The FSBLOCKSIZE tag exposes file system block size in contrast to
the BLOCK_SIZE (unfortunate name) which returns minimal accessible
block size (sector size).
Hideki EIRAKU [Wed, 25 May 2022 03:23:16 +0000 (12:23 +0900)]
loopdev: set block_size when using LOOP_CONFIGURE
LOOP_CONFIGURE ioctl was introduced by commit d5fd456c88aba4fcf77d35fe38024a8d5c814686. Since the previous
implementation set partscan flag but did not set block_size with the
LOOP_CONFIGURE ioctl, an issue fixed by commit 422f0e9f206a145c59a71333dad20d38cbbfc0c4 was reappeared. Setting
block_size in the LOOP_CONFIGURE ioctl parameter fixes the issue.
Karel Zak [Thu, 26 May 2022 07:49:29 +0000 (09:49 +0200)]
Merge branch 'taskset-mistake' of https://github.com/csbo98/util-linux
* 'taskset-mistake' of https://github.com/csbo98/util-linux:
Maybe there is a little mistake in do_taskset() function in taskset.c. In the first call of sched_getaffinity(), if the call is failed we should use err_affinity(ts->pid, 0) other than err_affinity(ts->pid, 1).
csbo98 [Sun, 22 May 2022 06:47:13 +0000 (14:47 +0800)]
Maybe there is a little mistake in do_taskset() function in taskset.c.
In the first call of sched_getaffinity(), if the call is failed we should
use err_affinity(ts->pid, 0) other than err_affinity(ts->pid, 1).
pipesz is a utility to examine and adjust the size of pipe buffers.
It uses fctnl F_GETPIPE_SZ and F_SETPIPE_SZ to examine and resize
these buffers. This functionality is unique to Linux and was added in
version 2.6.35. Minor bugfixes were made in 4.9, but these do not
obviate the use of pipesz prior to that release.
Signed-off-by: Nathan Sharp <nwsharp@live.com> Signed-off-by: Karel Zak <kzak@redhat.com>