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>
Scott Shambarger [Thu, 12 May 2022 23:27:26 +0000 (16:27 -0700)]
fstrim: Remove all skipped entries before de-duplication
When processing fstab entries, de-duplication is performed based on the
source before all tests on the target have been checked, resulting in
some entries being skipped when a removed duplicate with a different
target would not have been.
The fix is to move all the target checks before the source
de-duplication.
Addresses: #1686 Signed-off-by: Scott Shambarger <devel@shambarger.net>
Karel Zak [Wed, 11 May 2022 08:21:34 +0000 (10:21 +0200)]
Merge branch 'hardlink-docs' of https://github.com/ferdnyc/util-linux
* 'hardlink-docs' of https://github.com/ferdnyc/util-linux:
hardlink: Fix man page docs for '-v/--verbose'
hardlink: Wrap -b to 80 cols, in --help
hardlink: Move reflink options in manpage
hardlink: Move -c option in --help
hardlink: Document '-c' option in manpage
The documentation for the --reflink and --skip-reflink options
felt sort of shoe-horned into the rest of the options, in the
man page. Reorder to match where they appear in the --help output.
Karel Zak [Thu, 5 May 2022 09:12:23 +0000 (11:12 +0200)]
Merge branch 'meson-fixups' of https://github.com/eli-schwartz/util-linux
* 'meson-fixups' of https://github.com/eli-schwartz/util-linux:
meson: fix error in processing version for pc files
meson: get the project version from the version-gen script
Put BLOCK_SIZE, FSSIZE and FSLASTBLOCK tags under one FSINFO flag.
These, and probably future ones, are read directly from the
superblock (with minor post-processing). These properties are
combined under one flag to escape adding a flag per superblock
member.