Masatake YAMATO [Fri, 5 Jan 2024 08:54:36 +0000 (17:54 +0900)]
tests: (lsfd::mkfds-inotify) use findmnt(1) instead of stat(1) to get bdev numbers
Close #2349
stat(2) on some filesystems including btrfs reports a block device
number (bdev number) with a offset. On the other hand, "inotify wd"
field of /proc/$pid/fdinfo/$fd for an inotify file reports bdev
numbers without offsets.
The offset caused the failure of lsfd::mkfds-inotify test case on
btrfs. Unlike stat(2), findmnt can report bdev numbers without
offsets.
Karel Zak [Thu, 4 Jan 2024 10:51:40 +0000 (11:51 +0100)]
Merge branch 'wipefs/improvements' of https://github.com/t-8ch/util-linux
* 'wipefs/improvements' of https://github.com/t-8ch/util-linux:
wipefs: allow storage of backups in specific location
wipefs: (tests) remove necessity of root permissions
Karel Zak [Thu, 4 Jan 2024 10:50:19 +0000 (11:50 +0100)]
Merge branch 'PR/dmesg-timestamps' of github.com:karelzak/util-linux-work
* 'PR/dmesg-timestamps' of github.com:karelzak/util-linux-work:
Dividing tests into subtest based on recommendation from review
util-linux/sys-utils test dmesg support for additional human-readable timestamp
dmesg: man and coding style changes
dmesg: support for additional human readable timestamp
Eric Badger [Wed, 3 Jan 2024 21:11:43 +0000 (13:11 -0800)]
hwclock: Improve set error in the face of jitter
set_hardware_clock_exact() spins in a loop, trying to exit when we are
`delay` seconds from an integer time on the system clock. However, there
might be jitter which causes an exit a little bit later than ideal.
The prior code could cause a relatively small error in loop exit time to
produce a relatively large error in the RTC.
For example, suppose upon exit from the loop, we have:
And in slightly less than `delay` seconds, the system clock will be 1704239207 while the RTC will be approximately 1704239208, about 1
second of error.
We are better off rounding in this case. The RTC will be behind the
system clock, but only very slightly:
Karel Zak [Wed, 3 Jan 2024 13:13:28 +0000 (14:13 +0100)]
libmount: introduce /run/mount/utab.event
The mnt_monitor_...() API uses /run/mount/utab.lock to monitor utab
changes. The same file is used to control access to the utab file.
The utab can be updated more than once during one mount(8) call, for
example, one update is done in /sbin/mount.nfs and next in mount(8).
This situation triggers two (e.g. inotify) events when monitoring is
based on the lock file.
It seems better to introduce separate file to trigger the event and do
not trigger this event in /sbin/mount.<type> helpers.
Karel Zak [Tue, 2 Jan 2024 10:15:57 +0000 (11:15 +0100)]
Merge branch 'fixes' of https://github.com/t-8ch/util-linux
* 'fixes' of https://github.com/t-8ch/util-linux:
libmount: (context) avoid dead store
libmount: (utils) avoid dead store
pipesz: avoid dead store
fileeq: optimize size of ul_fileeq_method
sha1: properly wipe variables
libfdisk: (sgi): use strncpy over strcpy
libfdisk: (sun) properly initialize partition data
libmount: (tests) fix --filesystems crash on invalid argument
libmount: (tests) fix --filesystems test argument parsing
libmount: (veritydev) use asprintf to build string
libsmartcols: (samples/fromfile) properly handle return value from getline()
libuuid: (test_uuid) make reading UUIDs from file more robust
libblkid: (dev) use strdup to duplicate string
pg: use snprintf to build string
hexdump: use xasprintf to build string
readprofile: use xasprintf to build string
cal: avoid out of bound write
logger: use strncpy instead of strcpy
exec_shell: use xasprintf
strv: make strv_new_api static
Karel Zak [Sun, 31 Dec 2023 10:23:39 +0000 (11:23 +0100)]
Merge branch 'patch-12' of https://github.com/mariobl/util-linux
* 'patch-12' of https://github.com/mariobl/util-linux:
Update po4a.cfg to assign exch.1 correctly to misc-utils
exch: Add man page to po4a.cfg to make it translatable
Rishabh Thukral [Sat, 23 Dec 2023 23:13:36 +0000 (15:13 -0800)]
util-linux/sys-utils test dmesg support for additional human-readable timestamp
This commit adds tests for new functionality in dmesg to support multiple timestamp formats.
The user can specify multiple timestamp formats with --time-format option and dmesg prints all the logs with desired timestamp formats in the sequence of user-provided formats.
This test verifies that output contains multiple formats in the sequence of input and it also tests for the special case where the user specifies delta format along with either ctime or raw.
Karel Zak [Thu, 14 Dec 2023 08:43:54 +0000 (09:43 +0100)]
Merge branch 'PR/libsmartcols-cell-data' of github.com:karelzak/util-linux-work
* 'PR/libsmartcols-cell-data' of github.com:karelzak/util-linux-work:
libsmartcols: fix memory leak on filter parser error
libsmartcols: free after error in filter sample
libsmartcols: make cell data printing more robust
Rishabh Thukral [Tue, 5 Dec 2023 19:53:33 +0000 (11:53 -0800)]
dmesg: support for additional human readable timestamp
The dmesg logs have timestamps in seconds since boot format which can
be converted to other formats. However, there is no option to include
both the original timestamp as present in the buffer along with the
converted timestamp in the specified format.
This change updates the --time-format option in dmesg to enable the
user to specify it multiple times with different formats with each
input providing a timestamp format among the currently supported
choices. This enables seeing the dmesg logs in both seconds since boot
and human readable format simultaneously in each row of the log output.
The sequence of timestamp format follows the order
in which the user provides the desired formats.
Karel Zak [Tue, 12 Dec 2023 09:21:19 +0000 (10:21 +0100)]
Merge branch 'dmesg/tests' of https://github.com/t-8ch/util-linux
* 'dmesg/tests' of https://github.com/t-8ch/util-linux:
dmesg: use symbolic defines for second conversions
dmesg: add support for reserved and local facilities
dmesg: (tests) validate json output
dmesg: only write one message to json
jsonwrt: add ul_jsonwrt_value_s_sized
dmesg: open-code LOG_MAKEPRI
dmesg: correctly print all supported facility names
dmesg: error out instead of silently ignoring force_prefix