Karel Zak [Fri, 4 Mar 2022 08:53:49 +0000 (09:53 +0100)]
Merge branch 'new-gpt-types' of https://github.com/gyakovlev/util-linux
* 'new-gpt-types' of https://github.com/gyakovlev/util-linux:
libfdisk: add new verity root and /usr part types
libfdisk: add new root and /usr part types
Karel Zak [Mon, 28 Feb 2022 10:25:30 +0000 (11:25 +0100)]
Merge branch 'lsfd-tests' of https://github.com/masatake/util-linux
* 'lsfd-tests' of https://github.com/masatake/util-linux:
tests: (lsfd) don't check an unused program
tests: (lsfd) don't use findmnt to verify device numbers
tests: (lsfd) improve the help messages of test_mkfds helper command
losetup: don't skip adding a new device if it already has a device node
Linux plans to deprecate the auto-creation of block devices based on
access to the device node starting from kernel 5.18. Without that feature
losetup will fail to create the loop device if a device node already
exists, but the loop device to back it in the kernel does not exist yet.
This is a scenario that should not happen in modern udev based
distributions, but apparently there still are various scripts around that
manually call the superfluous mknod.
Change losetup to unconditionally call loopcxt_add_device when a specific
device node is specified on the command line. If the loop device
already exists the LOOP_CTL_ADD ioctl will fail, but given that losetup
ignores the return value from loopcxt_add_device that failure has no
further effect.
Reported-by: Luis Chamberlain <mcgrof@kernel.org> Signed-off-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Chaitanya Kulkarni <kch@nvidia.com> Signed-off-by: Karel Zak <kzak@redhat.com>
Masatake YAMATO [Sat, 26 Feb 2022 18:42:09 +0000 (03:42 +0900)]
tests: (lsfd) don't use findmnt to verify device numbers
This change tries to fix the failures in testing reported in:
* https://lkml.org/lkml/2022/1/31/1333, and
* https://lkml.org/lkml/2022/2/2/171
The original test cases depended on a wrong assumption; if M and M'
are the same, D and D' are the same, too. Here, M is a mnt_id in
/proc/$pid/mountinfo. D is the device number for M in
/proc/$pid/mountinfo. M' is the mnt_id value in
/proc/$pid/fdinfo/$fd. D' is the device number reported by stat
syscall for /proc/$pid/fd/$fd.
The original test compared the device numbers reported by findmnt and
lsfd. findmnt retrieves a device number from /proc/$pid/mountinfo.
lsfd retrieves a device number from stat syscall.
This assumption is not correct for a file on an overlay file system
whose block devices behind lowerdir and upperdir are different.
Using findmnt is not suitable for comparing device numbers.
This change uses stat command instead of findmnt to retrieve the
device number.
Karel Zak [Mon, 21 Feb 2022 10:04:31 +0000 (11:04 +0100)]
Merge branch 'cdown/2022-02-15/dmesg_subsys_after_blank' of https://github.com/cdown/util-linux
* 'cdown/2022-02-15/dmesg_subsys_after_blank' of https://github.com/cdown/util-linux:
dmesg: Start colouring subsys delimiter only after trailing blank
Chris Down [Tue, 15 Feb 2022 13:39:57 +0000 (13:39 +0000)]
dmesg: Start colouring subsys delimiter only after trailing blank
This improves colouring when certain message levels are configured to
display a background colour using terminal-colors.d. Previously the
background colour starts at ":" on messages with a subsystem present,
which looks pretty odd. Now it starts from the remaining message after
the subsys (if there is one).
If one only uses foreground colours, this largely makes no difference:
the colon is now coloured with the same subsys colour, but there's no
difference for the blank.
Karel Zak [Mon, 14 Feb 2022 12:16:27 +0000 (13:16 +0100)]
Merge branch 'manpage-fixes' of https://github.com/mariobl/util-linux
* 'manpage-fixes' of https://github.com/mariobl/util-linux:
Fix several adoc files as reported by Helge Kreutzmann
eject.1.adoc: Fix markup
colors.adoc: format command name bold
Add missing *.adoc files to Makemodule.am
Add help-version.adoc to po4a configuration file
Add new *.adoc files to po4a configuration file
Fix markup and wording in colors.adoc
Karel Zak [Mon, 14 Feb 2022 12:14:51 +0000 (13:14 +0100)]
Merge branch 'lsfd-fix-wrong-fmt-str-and-cast-type' of https://github.com/masatake/util-linux
* 'lsfd-fix-wrong-fmt-str-and-cast-type' of https://github.com/masatake/util-linux:
lsfd: fix the way to print length of mmap area
lsfd: fix the way to print stat.st_nlink
lsfd: fix the way to print stat.st_size
Karel Zak [Thu, 10 Feb 2022 11:03:17 +0000 (12:03 +0100)]
chsh, chfn: remove readline support [CVE-2022-0563]
The readline library uses INPUTRC= environment variable to get a path
to the library config file. When the library cannot parse the
specified file, it prints an error message containing data from the
file.
Unfortunately, the library does not use secure_getenv() (or a similar
concept) to avoid vulnerabilities that could occur if set-user-ID or
set-group-ID programs.
Reported-by: Rory Mackie <rory.mackie@trailofbits.com> Signed-off-by: Karel Zak <kzak@redhat.com>
Karel Zak [Fri, 11 Feb 2022 11:06:41 +0000 (12:06 +0100)]
libsmartcols: change "export" behavior, add "shellvar" flag
In version 2.37 the "export" output format automatically modifies
column names to be compatible with shell's requirements for variable
names. This change was backwardly incompatible for people who use for
example "lsblk -P" in non-shell environment.
It's painful to modify this behavior again in v2.38, but it seems
better to add a way how to control this behavior independently on
output format as it seems attractive feature for more use-cases.
This commit introduces scols_table_enable_shellvar() function to
enable/disable this feature.
Masatake YAMATO [Thu, 10 Feb 2022 07:14:11 +0000 (16:14 +0900)]
lsfd: fix the way to print stat.st_nlink
The type used for casting the member was too small; for the
"%ju" format spec, we should use uintmax_t for the purpose.
This change may fix the bug reported in
https://github.com/util-linux/util-linux/issues/1511#issuecomment-1033697617
in GitHub#1511 by Anatoly Pugachev <matorola@gmail.com>. Signed-off-by: Masatake YAMATO <yamato@redhat.com>
Karel Zak [Mon, 7 Feb 2022 10:10:03 +0000 (11:10 +0100)]
misc: use everywhere mkstemp_cloexec() as fallback to mkostemp()
The function mkostemp() does not have to be available everywhere,
and for this reason, we have mkstemp_cloexec() as a fallback solution.
Unfortunately, some codes (usually fuzzy tests) do not use the
fallback. Let's fix it.
kill.1.adoc: clarify syntax of -SIG argument in synopsis
kill.1.adoc has this synopsis line
*kill* [-signal|*-s* _signal_]
For "-signal", the leading "-" should be typed literally, and the
"signal" suffix should be replaced by a signal name/number.
This means that according to GNU man(1), the "-" should render in
bold font whereas the "signal" placeholder should use italic (which
terminals often render with underscores).
Make it so. Use two askerisks because one is not enough for sub-word
markup [*].
mount.8.adoc: use bold font for literal text in synopsis
In a synopsis, *bold* text means "type exactly as shown" (see man(1)).
mount.8.adoc has *--make*-[*shared*|...] which is weird because
the middle dash is not in bold even though it's meant to be typed
literally. Make it bold like the surrounding text.
Signed-off-by: Johannes Altmanninger <aclopte@gmail.com>
Karel Zak [Mon, 7 Feb 2022 09:48:24 +0000 (10:48 +0100)]
Merge branch 'lsfd-refine-test-cases-0' of https://github.com/masatake/util-linux
* 'lsfd-refine-test-cases-0' of https://github.com/masatake/util-linux:
tests: (lsfd) delete "largefile" flag in the output before the comparison
tests: (lsfd) add a missing word to the test output
tests: (lsfd) refine the pattern for comparing the output of the commands
tests: (lsfd) print more information for debugging
Karel Zak [Mon, 7 Feb 2022 09:46:39 +0000 (10:46 +0100)]
Merge branch 'helpversion' of https://github.com/mariobl/util-linux
* 'helpversion' of https://github.com/mariobl/util-linux:
ldattach.8.adoc: Add missing standard options
man pages: unify output of --help and --version
Masatake YAMATO [Fri, 4 Feb 2022 17:40:10 +0000 (02:40 +0900)]
tests: (lsfd) delete "largefile" flag in the output before the comparison
The original code didn't considered that syscalls opening a directory
on mips64 GNU/Linux took O_LARGEFILE flag. This misconsideration made
the mkfds-directory test FAILED as reported in
https://github.com/util-linux/util-linux/issues/1511#issuecomment-1029968595.
Karel Zak [Mon, 31 Jan 2022 09:05:29 +0000 (10:05 +0100)]
hwclock: get/set param cleanup
* move all code to hwclock-rtc.c
* use ul_strtou64() to simplify code
* use base=0 for ul_strtou64() to handle 10 and 16 base
* allocate for strtok() (we keep command line options read-only)
Bastian Krause [Fri, 21 Jan 2022 15:09:43 +0000 (16:09 +0100)]
hwclock: add --param-set option
Implement the RTC_PARAM_SET RTC ioctl in hwclock. The ioctl interface was
introduced with [1], which went mainline in Kernel v5.16. The parameters
are independent of hardware/driver. This means we can read and set
parameters in a generic way.
The new --param-set hwclock function accepts aliases for parameters
currently existent (Kernel v5.16). They can be extended later on. As
fallback and for values, hexadecimal (if prefixed with 0x) and decimal
values, as defined in [2], are accepted.
Bastian Krause [Fri, 21 Jan 2022 15:09:35 +0000 (16:09 +0100)]
hwclock: add --param-get option
Implement the RTC_PARAM_GET RTC ioctl in hwclock. The ioctl interface was
introduced with [1], which went mainline in Kernel v5.16. The parameters
are independent of hardware/driver. This means we can read and set
parameters in a generic way.
The new --param-get hwclock function accepts aliases for parameters
currently existent (Kernel v5.16). They can be extended later on. As
fallback, hexadecimal (if prefixed with 0x) and decimal values, as
defined in [2], are accepted.