]> git.ipfire.org Git - thirdparty/util-linux.git/log
thirdparty/util-linux.git
2 years agolsclocks: new util to interact with system clocks
Thomas Weißschuh [Sun, 25 Jun 2023 14:44:10 +0000 (16:44 +0200)] 
lsclocks: new util to interact with system clocks

Usecases:
* Compare current monotonic time to timestamps reported by systemd
* Validate time namespace operations
* Inspect clock resolutions

Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
2 years agolib/timeutils: implement timespec formatting
Thomas Weißschuh [Tue, 27 Jun 2023 06:57:09 +0000 (08:57 +0200)] 
lib/timeutils: implement timespec formatting

Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
2 years agolib/timeutils: implement nanosecond formatting
Thomas Weißschuh [Tue, 27 Jun 2023 06:53:56 +0000 (08:53 +0200)] 
lib/timeutils: implement nanosecond formatting

Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
2 years agolib/timeutils: constify some arguments
Thomas Weißschuh [Tue, 27 Jun 2023 10:41:06 +0000 (12:41 +0200)] 
lib/timeutils: constify some arguments

Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
2 years agoutmpdump: validate subsecond granularity
Thomas Weißschuh [Wed, 28 Jun 2023 05:21:38 +0000 (07:21 +0200)] 
utmpdump: validate subsecond granularity

tv_usec is only valid in the range [0, 999999].
If the file contains garbage data replace interpret it as "0" instead.

Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
2 years agoinclude/crc64: add missing license header
Karel Zak [Wed, 28 Jun 2023 10:41:08 +0000 (12:41 +0200)] 
include/crc64: add missing license header

Signed-off-by: Karel Zak <kzak@redhat.com>
2 years agonsenter: avoid NULL pointer dereference [coverity scan]
Karel Zak [Wed, 28 Jun 2023 08:19:34 +0000 (10:19 +0200)] 
nsenter: avoid NULL pointer dereference [coverity scan]

Signed-off-by: Karel Zak <kzak@redhat.com>
2 years agoMerge branch 'cal' of https://github.com/jwilk-forks/util-linux
Karel Zak [Tue, 27 Jun 2023 08:29:59 +0000 (10:29 +0200)] 
Merge branch 'cal' of https://github.com/jwilk-forks/util-linux

* 'cal' of https://github.com/jwilk-forks/util-linux:
  cal: fix long option name for -c
  cal: fix error message for bad -c argument

2 years agocal: fix long option name for -c
Jakub Wilk [Mon, 26 Jun 2023 19:02:13 +0000 (21:02 +0200)] 
cal: fix long option name for -c

2 years agocal: fix error message for bad -c argument
Jakub Wilk [Mon, 26 Jun 2023 18:58:21 +0000 (20:58 +0200)] 
cal: fix error message for bad -c argument

2 years agolib/strutils: fix typo
Jakub Wilk [Mon, 26 Jun 2023 18:00:43 +0000 (20:00 +0200)] 
lib/strutils: fix typo

2 years agoMerge branch 'nsenter-add-parent-ns-option' of https://github.com/igo95862/util-linux
Karel Zak [Mon, 26 Jun 2023 12:04:52 +0000 (14:04 +0200)] 
Merge branch 'nsenter-add-parent-ns-option' of https://github.com/igo95862/util-linux

* 'nsenter-add-parent-ns-option' of https://github.com/igo95862/util-linux:
  Add `--user-parent` option to nsenter

2 years agocfdisk: fix menu behavior after writing changes
Karel Zak [Mon, 26 Jun 2023 11:25:11 +0000 (13:25 +0200)] 
cfdisk: fix menu behavior after writing changes

Florian wrote:
  after a successful write, cfdisk remains on the "Write" cursor and
  furthermore when navigating to "Quit" will continue to  show
  "...without writing changes", despite there were writes. This patch
  addresses that.

Based on patch from Florian Zimmermann <florian.zimmermann@gmail.com>

Signed-off-by: Karel Zak <kzak@redhat.com>
2 years agodmesg: -r LOG_MAKEPRI needs fac << 3
Edward Chron [Fri, 23 Jun 2023 01:31:31 +0000 (18:31 -0700)] 
dmesg: -r LOG_MAKEPRI needs fac << 3

Submission to Project: util-linux
Open Incident: #2325 at github.com/util-linux/util-linux/issues/2325
Component: util-linux/sys-utils
File: dmesg.c
Code level patch applied against: 2.39 - latest code pulled from
           git.github.com:util-linux/util-linux.git

BUG: The facility field passed to macro from /usr/include/sys/syslog.h
     LOG_MAKEPRI(fac, pri) by dmesg -r needs to have fac argument
     shifted 3 bit to the left to return a valid raw valid. The lower
     3 bits for a raw value are used by the loglevel priority (pri)
     field, so the facility bits can only occupy the bits above the
     bits used to hold the pri field value.

The dmesg -r command produces the incorrect output for the raw value
for the or'ed combination of the facility | loglevel priority that gets
produced by the LOG_MAKEPRI macro. That macro is defined as:

    #define LOG_MAKEPRI(fac, pri) ((fac) | (pri))

which is defined in the current glibc code in /usr/include/sys/syslog.h
and is used only in the dmesg -r (raw output option) command to form the
raw value for facility or'ed with loglevel priority and displayed as:

    <#>[#######.######] ...

where the # in <#> contains the output from the LOG_MAKEPRI macro.

The lower 3 bits are reserved for the loglevel priority 0-7
and the bits above that are for the facility value, so the facility
index should be shifted to the left three bits and or'ed with the
loglevel priority.

In the glibc file: /usr/include/sys/syslog.h the macro LOG_MAKEPRI is
defined as:

        #define LOG_MAKEPRI(fac, pri) ((fac) | (pri)

and returns the wrong facility and loglevel priority values, ideally it
should be defined as:

        #define LOG_MAKEPRI(fac, pri) ((fac << 3) | (pri))

to return the correct raw value.

We checked with glibc developement and the LOG_MAKEPRI macro is correct
as is and can't be changed as it used by *BSD as is so the solution for
dmesg -r is to shift the facility index left by 3 bits as input to the
LOG_MAKEPRI macro. That is what glibc development recommended.
(For reference, see glibc bugzilla Bug 30563)

We can front end the LOG_MAKEPRI macro with a macro that shifts the
facility by the needed 3 bits which we've added to dmesg.c:

    #define LOG_RAW_FAC_PRI(fac, pri) LOG_MAKEPRI((fac << 3), (pri))

This has been tested and works correctly to produce the correct raw
mode value for Facility or'ed together with Loglevel priority.

You can verify that this fix works correctly.

We can test by adding several records to /dev/kmsg like this:

    echo "<14> Test Message Facility 8 Loglevel 6" >> /dev/kmsg
    echo "<15> Test Message Facility 8 Loglevel 7" >> /dev/kmsg
    echo "<30> Test Message Facility 24 Loglevel 6" >> /dev/kmsg
    echo "<31> Test Message Facility 24 Loglevel 7" >> /dev/kmsg

these commands add 4 records to the dmesg buffer. Then when we print the
records by cat'ing /dev/kmsg or using the dmesg command several ways:

    -bash-4.2# cat /dev/kmsg | grep "Test Message Facility"
    14,1114,495317239,-; Test Message Facility 8 Loglevel 6
    15,1115,503340779,-; Test Message Facility 8 Loglevel 7
    30,1116,643374764,-; Test Message Facility 24 Loglevel 6
    31,1117,657165117,-; Test Message Facility 24 Loglevel 7

    -bash-4.2# dmesg -x | grep "Test Message Facility"
    user  :info  : [  495.317239]  Test Message Facility 8 Loglevel 6
    user  :debug : [  503.340779]  Test Message Facility 8 Loglevel 7
    daemon:info  : [  643.374764]  Test Message Facility 24 Loglevel 6
    daemon:debug : [  657.165117]  Test Message Facility 24 Loglevel 7

    -bash-4.2# dmesg -S -x | grep "Test Message Facility"
    user  :info  : [  495.317239]  Test Message Facility 8 Loglevel 6
    user  :debug : [  503.340779]  Test Message Facility 8 Loglevel 7
    daemon:info  : [  643.374764]  Test Message Facility 24 Loglevel 6
    daemon:debug : [  657.165117]  Test Message Facility 24 Loglevel 7

   -bash-4.2# dmesg -S -r | grep "Test Message Facility"
   <14>[  495.317239]  Test Message Facility 8 Loglevel 6
   <15>[  503.340779]  Test Message Facility 8 Loglevel 7
   <30>[  643.374764]  Test Message Facility 24 Loglevel 6
   <31>[  657.165117]  Test Message Facility 24 Loglevel 7

All the above methods agree in their output as expected.
However, running dmesg -r does not agree.

dmesg -r erronously produces:
----------------------------

    -bash-4.2# dmesg -r | grep "Test Message Facility"
    <7>[  495.317239]  Test Message Facility 8 Loglevel 6
    <7>[  503.340779]  Test Message Facility 8 Loglevel 7
    <7>[  643.374764]  Test Message Facility 24 Loglevel 6
    <7>[  657.165117]  Test Message Facility 24 Loglevel 7

However, if we run the dmesg -r command using the new front end macro
LOG_RAW_FAC_PRI(fac, pri) we do get the correct output:

Here is the corrected dmesg -r output:
-------------------------------------

    -bash-4.2# dmesg -r | grep "Test Message Facility"
    <14>[  495.317239]  Test Message Facility 8 Loglevel 6
    <15>[  503.340779]  Test Message Facility 8 Loglevel 7
    <30>[  643.374764]  Test Message Facility 24 Loglevel 6
    <31>[  657.165117]  Test Message Facility 24 Loglevel 7

shifting the facility index value by 3 bits in the LOG_RAW_FAC_PRI macro
provides the correct ouput as shown. All the other commands produce the
same output so now they are all in agreement.

Signed-off-by: Ivan Delalande <colona@arista.com>
Signed-off-by: Edward Chron <echron@arista.com>
2 years agobuild-sys: don't call pkg-config --static if unnecessary
Karel Zak [Mon, 26 Jun 2023 10:46:15 +0000 (12:46 +0200)] 
build-sys: don't call pkg-config --static if unnecessary

Addresses: https://github.com/util-linux/util-linux/issues/2327
Signed-off-by: Karel Zak <kzak@redhat.com>
2 years agologger: initialize socket credentials contol union
Karel Zak [Mon, 26 Jun 2023 09:56:23 +0000 (11:56 +0200)] 
logger: initialize socket credentials contol union

Addresses: https://github.com/util-linux/util-linux/issues/2336
Signed-off-by: Karel Zak <kzak@redhat.com>
2 years agoMerge branch 'unshare/time-msg' of https://github.com/t-8ch/util-linux
Karel Zak [Mon, 26 Jun 2023 09:50:02 +0000 (11:50 +0200)] 
Merge branch 'unshare/time-msg' of https://github.com/t-8ch/util-linux

* 'unshare/time-msg' of https://github.com/t-8ch/util-linux:
  unshare: fix error message for unexpected time offsets

2 years agoMerge branch 'test/builddir-pwd' of https://github.com/t-8ch/util-linux
Karel Zak [Mon, 26 Jun 2023 09:49:43 +0000 (11:49 +0200)] 
Merge branch 'test/builddir-pwd' of https://github.com/t-8ch/util-linux

* 'test/builddir-pwd' of https://github.com/t-8ch/util-linux:
  tests: (run.sh) detect builddir from working directory

2 years agoMerge branch 'losetup-errormsg' of https://github.com/t-8ch/util-linux
Karel Zak [Mon, 26 Jun 2023 09:49:20 +0000 (11:49 +0200)] 
Merge branch 'losetup-errormsg' of https://github.com/t-8ch/util-linux

* 'losetup-errormsg' of https://github.com/t-8ch/util-linux:
  losetup: deduplicate find_unused() logic
  lib/loopdev: consistently return error values from loopcxt_find_unused()
  lib/loopdev: document function return values

2 years agoMerge branch 'hardlink' of https://github.com/jwilk-forks/util-linux
Karel Zak [Mon, 26 Jun 2023 09:48:43 +0000 (11:48 +0200)] 
Merge branch 'hardlink' of https://github.com/jwilk-forks/util-linux

* 'hardlink' of https://github.com/jwilk-forks/util-linux:
  hardlink: (man) add missing comma

2 years agoMerge branch 'lsfd--fix-separators-for-json-output-cleanup' of https://github.com...
Karel Zak [Mon, 26 Jun 2023 09:48:24 +0000 (11:48 +0200)] 
Merge branch 'lsfd--fix-separators-for-json-output-cleanup' of https://github.com/masatake/util-linux

* 'lsfd--fix-separators-for-json-output-cleanup' of https://github.com/masatake/util-linux:
  lsfd: fix specifying wrong JSON typs when building the help message
  tests: (lsfd) add a case for verifying ENDPOINTS column output in JSON mode

2 years agoMerge branch 'PR/libmount-optstr-sync' of github.com:karelzak/util-linux-work
Karel Zak [Mon, 26 Jun 2023 09:45:50 +0000 (11:45 +0200)] 
Merge branch 'PR/libmount-optstr-sync' of github.com:karelzak/util-linux-work

* 'PR/libmount-optstr-sync' of github.com:karelzak/util-linux-work:
  libmount: add sample to test fs and context relation
  libmount: fix sync options between context and fs structs

2 years agounshare: fix error message for unexpected time offsets
Thomas Weißschuh [Sun, 25 Jun 2023 11:28:19 +0000 (13:28 +0200)] 
unshare: fix error message for unexpected time offsets

Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
2 years agolosetup: deduplicate find_unused() logic
Thomas Weißschuh [Sun, 25 Jun 2023 07:59:05 +0000 (09:59 +0200)] 
losetup: deduplicate find_unused() logic

Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
2 years agolib/loopdev: consistently return error values from loopcxt_find_unused()
Thomas Weißschuh [Sun, 25 Jun 2023 07:59:26 +0000 (09:59 +0200)] 
lib/loopdev: consistently return error values from loopcxt_find_unused()

Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
2 years agolib/loopdev: document function return values
Thomas Weißschuh [Sun, 25 Jun 2023 07:58:43 +0000 (09:58 +0200)] 
lib/loopdev: document function return values

Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
2 years agotests: (run.sh) detect builddir from working directory
Thomas Weißschuh [Wed, 21 Jun 2023 12:26:05 +0000 (14:26 +0200)] 
tests: (run.sh) detect builddir from working directory

This makes it easier to run test.sh from the build directory as
everything will work without any parameters irrespective of the build
directories name.

Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
2 years agohardlink: (man) add missing comma
Jakub Wilk [Sat, 24 Jun 2023 07:24:29 +0000 (09:24 +0200)] 
hardlink: (man) add missing comma

2 years agoAdd `--user-parent` option to nsenter
igo95862 [Sun, 26 Mar 2023 15:04:11 +0000 (21:04 +0600)] 
Add `--user-parent` option to nsenter

When this option is used nsenter will fetch the parent user
namespace from any namespace file descriptors available.

It can be combined with existing `--user` option in which case
the parent user namespace will be fetched from the user namespace
and replace it.

The usecase of this option is when a user namespace that owns
the other type namespaces we want to switch to is not actually
bound to any process. Without using ioctl it is impossible to
acquire namespace file descriptor. For example, bubblewrap
`bwrap` command creates unbinded user namespace when `--dev`
option is used.

2 years agolsfd: fix specifying wrong JSON typs when building the help message
Masatake YAMATO [Thu, 22 Jun 2023 16:10:04 +0000 (01:10 +0900)] 
lsfd: fix specifying wrong JSON typs when building the help message

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
2 years agotests: (lsfd) add a case for verifying ENDPOINTS column output in JSON mode
Masatake YAMATO [Thu, 22 Jun 2023 15:45:23 +0000 (00:45 +0900)] 
tests: (lsfd) add a case for verifying ENDPOINTS column output in JSON mode

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
2 years agoMerge branch 'lsfd--fix-separators-for-json-output' of https://github.com/masatake...
Karel Zak [Thu, 22 Jun 2023 12:26:09 +0000 (14:26 +0200)] 
Merge branch 'lsfd--fix-separators-for-json-output' of https://github.com/masatake/util-linux

* 'lsfd--fix-separators-for-json-output' of https://github.com/masatake/util-linux:
  lsfd.1.adoc: fix a typo
  lsfd: use ARRAY_STRING and ARRAY_NUMBER json types in some columns
  lsfd: use \n as the separator in INOTIFY.INODES and INOTIFY.INODES.RAW columns
  lsfd: use \n as the separator in EVENTPOLL.TFDS column
  lsfd: (filter) weakly support ARRAY_STRING and ARRAY_NUMBER json types

2 years agoMerge branch 'coverage-tweaks' of https://github.com/mrc0mmand/util-linux
Karel Zak [Thu, 22 Jun 2023 12:19:07 +0000 (14:19 +0200)] 
Merge branch 'coverage-tweaks' of https://github.com/mrc0mmand/util-linux

* 'coverage-tweaks' of https://github.com/mrc0mmand/util-linux:
  ci: collect coverage on _exit() as well
  ci: hide coverage-related stuff begind --enable-coverage
  ci: tweak build dir's ACL when collecting coverage
  ci: fix indentation

2 years agoMerge branch 'cancel-jobs-on-push' of https://github.com/mrc0mmand/util-linux
Karel Zak [Thu, 22 Jun 2023 12:15:46 +0000 (14:15 +0200)] 
Merge branch 'cancel-jobs-on-push' of https://github.com/mrc0mmand/util-linux

* 'cancel-jobs-on-push' of https://github.com/mrc0mmand/util-linux:
  ci: cancel running jobs on push

2 years agolibmount: add sample to test fs and context relation
Karel Zak [Thu, 22 Jun 2023 12:00:46 +0000 (14:00 +0200)] 
libmount: add sample to test fs and context relation

Reerences: https://github.com/util-linux/util-linux/issues/2326
Signed-off-by: Karel Zak <kzak@redhat.com>
2 years agolibmount: fix sync options between context and fs structs
Karel Zak [Thu, 22 Jun 2023 11:11:57 +0000 (13:11 +0200)] 
libmount: fix sync options between context and fs structs

Since v2.39 libmount prefers "struct libmnt_optlist" to keep mount options
rather than the original "struct libmnt_fs". This is problem if the
"fs" struct is defined and maintained outside the context.

The library has already a way how to sync "fs" and "optlist", but this
needs to be improved and used more widely. Changes:

* force "fs" from context to always read options from "optlist"

* copy options from "fs" to "optlist" in mnt_context_set_fs()

* internally redirect mnt_fs_* API for options to "optlist" if optlist
  defined

* add simple test to make sure options from different sources are
  always merged together

Addresses: https://github.com/util-linux/util-linux/issues/2326
Signed-off-by: Karel Zak <kzak@redhat.com>
2 years agoci: cancel running jobs on push
Frantisek Sumsal [Thu, 22 Jun 2023 10:33:12 +0000 (12:33 +0200)] 
ci: cancel running jobs on push

Let's cancel already running GH Actions jobs when a PR is (force) pushed
to conserve resources and make the CI runs faster thanks to the freed up
queue.

2 years agoci: collect coverage on _exit() as well
Frantisek Sumsal [Tue, 20 Jun 2023 21:01:35 +0000 (23:01 +0200)] 
ci: collect coverage on _exit() as well

_exit() skips the gcov hooks, so we lose all coverage collected up to
that point. Let's work around this by intercepting _exit() with our
wrapper that calls __gcov_dump() just before _exit().

2 years agoci: hide coverage-related stuff begind --enable-coverage
Frantisek Sumsal [Tue, 20 Jun 2023 21:00:28 +0000 (23:00 +0200)] 
ci: hide coverage-related stuff begind --enable-coverage

2 years agoci: tweak build dir's ACL when collecting coverage
Frantisek Sumsal [Tue, 20 Jun 2023 14:25:07 +0000 (16:25 +0200)] 
ci: tweak build dir's ACL when collecting coverage

So gcov can create necessary directories/.gcda files even with dropped
privileges.

2 years agohwclock: add --vl-read, --vl-clear documentation and bash-completion
Rasmus Villemoes [Wed, 21 Jun 2023 20:18:23 +0000 (22:18 +0200)] 
hwclock: add --vl-read, --vl-clear documentation and bash-completion

Signed-off-by: Rasmus Villemoes <rasmus.villemoes@prevas.dk>
2 years agohwclock: add support for RTC_VL_READ/RTC_VL_CLR ioctls
Rasmus Villemoes [Tue, 13 Jun 2023 10:14:28 +0000 (12:14 +0200)] 
hwclock: add support for RTC_VL_READ/RTC_VL_CLR ioctls

Implement a way for userspace to query the status of the backup
battery, if supported by the hardware and driver.

The RTC_VL_* bits are a somewhat recent addition (3431ca4837bf, but
really only from b0efe0281234) to the uapi header,
so provide our own definition if the build host's header doesn't.

Signed-off-by: Rasmus Villemoes <rasmus.villemoes@prevas.dk>
2 years agolsfd.1.adoc: fix a typo
Masatake YAMATO [Thu, 22 Jun 2023 06:07:49 +0000 (15:07 +0900)] 
lsfd.1.adoc: fix a typo

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
2 years agolsfd: use ARRAY_STRING and ARRAY_NUMBER json types in some columns
Masatake YAMATO [Thu, 22 Jun 2023 05:42:34 +0000 (14:42 +0900)] 
lsfd: use ARRAY_STRING and ARRAY_NUMBER json types in some columns

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
2 years agolsfd: use \n as the separator in INOTIFY.INODES and INOTIFY.INODES.RAW columns
Masatake YAMATO [Sun, 18 Jun 2023 21:40:50 +0000 (06:40 +0900)] 
lsfd: use \n as the separator in INOTIFY.INODES and INOTIFY.INODES.RAW columns

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
2 years agolsfd: use \n as the separator in EVENTPOLL.TFDS column
Masatake YAMATO [Sun, 18 Jun 2023 21:25:37 +0000 (06:25 +0900)] 
lsfd: use \n as the separator in EVENTPOLL.TFDS column

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
2 years agolsfd: (filter) weakly support ARRAY_STRING and ARRAY_NUMBER json types
Masatake YAMATO [Thu, 22 Jun 2023 02:28:47 +0000 (11:28 +0900)] 
lsfd: (filter) weakly support ARRAY_STRING and ARRAY_NUMBER json types

We will have operators for array types in the future.  Till having
them, we treat the types as STRING. So we can use string operators for
the column having types.

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
2 years agosfdisk: add hint about duplicate UUIDs when use dump
Karel Zak [Wed, 21 Jun 2023 08:57:37 +0000 (10:57 +0200)] 
sfdisk: add hint about duplicate UUIDs when use dump

Signed-off-by: Karel Zak <kzak@redhat.com>
2 years agoci: fix indentation
Frantisek Sumsal [Tue, 20 Jun 2023 14:19:42 +0000 (16:19 +0200)] 
ci: fix indentation

2 years agolib: remove pager.c from libcommon
Karel Zak [Tue, 20 Jun 2023 11:15:45 +0000 (13:15 +0200)] 
lib: remove pager.c from libcommon

The libcommon is a binary archive to keep compilation and maintenance
simple. The library is not linked as shared or so. The unused symbols
are removed from binaries (for example, by "make install-strip").

But it isn't evident for license analyzers (and some humans) that the
library uses GPL and non-GPL stuff simultaneously. Let's avoid doubts
and keep pager.c (with GPL license) out of the archive

Signed-off-by: Karel Zak <kzak@redhat.com>
2 years agolib/ include/: cleanup licence headers
Karel Zak [Tue, 20 Jun 2023 10:52:35 +0000 (12:52 +0200)] 
lib/ include/: cleanup licence headers

This patch does not change any license of the affected files. Changes:

* add missing SPDX-License-Identifier lines for LGPL

* copy missing license lines from code (lib/) to header files (include/)

* use the same comment formatting

Signed-off-by: Karel Zak <kzak@redhat.com>
2 years agolib/color-names: fix licence header
Karel Zak [Tue, 20 Jun 2023 10:49:26 +0000 (12:49 +0200)] 
lib/color-names: fix licence header

The header file and code uses a different license. Let's use (public
domain) license from code also for the header file.

Signed-off-by: Karel Zak <kzak@redhat.com>
2 years agosys-utils: fix SELinux context example in mount.8
Todd Zullinger [Sun, 18 Jun 2023 21:29:11 +0000 (17:29 -0400)] 
sys-utils: fix SELinux context example in mount.8

In the description of the context option, the example which shows how to
properly quote is displayed incorrectly on terminals > 80 columns.  This
leaves a seemingly needless '\' in the command, e.g.:

    mount -t tmpfs none /mnt -o \ 'context="system_u:...'

The intent is to display the command properly on terminals <= 80
columns.  Use a literal block to ensure the code is displayed
consistently, regardless of the terminal width.

Connect the blockquote to the previous indented items in the context
option description to ensure it is properly indented.

Signed-off-by: Todd Zullinger <tmz@pobox.com>
2 years agotests: add omitted files
Karel Zak [Mon, 19 Jun 2023 12:59:15 +0000 (14:59 +0200)] 
tests: add omitted files

Sorry, forgot in the previous commit ...

Signed-off-by: Karel Zak <kzak@redhat.com>
2 years agotests: add user and user=name mount test
Karel Zak [Mon, 19 Jun 2023 11:45:06 +0000 (13:45 +0200)] 
tests: add user and user=name mount test

Signed-off-by: Karel Zak <kzak@redhat.com>
2 years agolibmount: always ignore user=<name>
Karel Zak [Mon, 19 Jun 2023 11:29:42 +0000 (13:29 +0200)] 
libmount: always ignore user=<name>

The library (on mount) cares about "user", but has to ignore
"user=name". It works as expected, but only for non-root users. We
need to ignore it also root to be compatible with /sbin/mount.cifs
where some people still use "user=" (rather than "username=").

References: fe0b1e793c9017edba72768e2e0b4c769c204604
Addresses: https://github.com/util-linux/util-linux/issues/2315
Signed-off-by: Karel Zak <kzak@redhat.com>
2 years agoMerge pull request #2317 from eworm-de/meson-langinfo
Karel Zak [Sat, 17 Jun 2023 09:56:48 +0000 (11:56 +0200)] 
Merge pull request #2317 from eworm-de/meson-langinfo

meson: check for _NL_TIME_WEEK_1STDAY in langinfo.h

2 years agoMerge pull request #2318 from mariobl/patch-11
Karel Zak [Sat, 17 Jun 2023 09:52:11 +0000 (11:52 +0200)] 
Merge pull request #2318 from mariobl/patch-11

[man] Fix typo in irqtop.1.adoc

2 years ago[man] Fix typo in irqtop.1.adoc
Mario Blättermann [Fri, 16 Jun 2023 14:31:47 +0000 (16:31 +0200)] 
[man] Fix typo in irqtop.1.adoc

2 years agomeson: check for _NL_TIME_WEEK_1STDAY in langinfo.h
Christian Hesse [Fri, 16 Jun 2023 09:52:10 +0000 (11:52 +0200)] 
meson: check for _NL_TIME_WEEK_1STDAY in langinfo.h

... which is required for `cal`.

Fixes GH-2316

2 years agoMerge branch 'ci/gcc-13' of https://github.com/t-8ch/util-linux
Karel Zak [Wed, 14 Jun 2023 07:54:25 +0000 (09:54 +0200)] 
Merge branch 'ci/gcc-13' of https://github.com/t-8ch/util-linux

* 'ci/gcc-13' of https://github.com/t-8ch/util-linux:
  ci: use clang 16
  ci: build with GCC 13/11

2 years agoMerge branch 'lsfd--inotify' of https://github.com/masatake/util-linux
Karel Zak [Wed, 14 Jun 2023 07:53:04 +0000 (09:53 +0200)] 
Merge branch 'lsfd--inotify' of https://github.com/masatake/util-linux

* 'lsfd--inotify' of https://github.com/masatake/util-linux:
  lsfd: use xstrdup instead of xasprintf(...\"%s\"
  tests: (lsfd) add a case for testing INOTIFY.INODES.RAW column
  tests: (mkfds) add / and /etc/fstab as the monitoring targets to inotify
  lsfd: fill NAME column of inotify files with the information about their monitoring targets
  lsdf: make the code for filling SOURCE, PARTITION, and MAJMIN reusable

2 years agoMerge branch 'meson-more-conditions' of https://github.com/keszybz/util-linux
Karel Zak [Wed, 14 Jun 2023 07:51:12 +0000 (09:51 +0200)] 
Merge branch 'meson-more-conditions' of https://github.com/keszybz/util-linux

* 'meson-more-conditions' of https://github.com/keszybz/util-linux:
  meson: conditionalize waitpid
  meson: add conditionalization for test progs
  meson: implement HAVE_PTY

2 years agomeson: conditionalize waitpid
Zbigniew Jędrzejewski-Szmek [Tue, 13 Jun 2023 08:15:39 +0000 (10:15 +0200)] 
meson: conditionalize waitpid

I *think* this mirros what configure.ac does, except that the configuration
option is not implemented.

2 years agomeson: add conditionalization for test progs
Zbigniew Jędrzejewski-Szmek [Tue, 13 Jun 2023 08:01:52 +0000 (10:01 +0200)] 
meson: add conditionalization for test progs

This just mirrors what the autotools setup is doing.

2 years agomeson: implement HAVE_PTY
Zbigniew Jędrzejewski-Szmek [Tue, 13 Jun 2023 07:55:22 +0000 (09:55 +0200)] 
meson: implement HAVE_PTY

This conditional was never implemented in the meson config. Under
autotools, it is guarded by availability of headers and an option. I
didn't implement the option here.

Fixes #2310.

'!= false' is used because 'x == 1' is rejected by meson if 'x' is
false. OTOH, 'x != false' seems to work if 'x' is 1.

2 years agolsfd: use xstrdup instead of xasprintf(...\"%s\"
Masatake YAMATO [Tue, 13 Jun 2023 10:21:33 +0000 (19:21 +0900)] 
lsfd: use xstrdup instead of xasprintf(...\"%s\"

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
2 years agotests: (lsfd) add a case for testing INOTIFY.INODES.RAW column
Masatake YAMATO [Fri, 9 Jun 2023 10:03:48 +0000 (19:03 +0900)] 
tests: (lsfd) add a case for testing INOTIFY.INODES.RAW column

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
2 years agotests: (mkfds) add / and /etc/fstab as the monitoring targets to inotify
Masatake YAMATO [Fri, 9 Jun 2023 10:02:25 +0000 (19:02 +0900)] 
tests: (mkfds) add / and /etc/fstab as the monitoring targets to inotify

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
2 years agolsfd: fill NAME column of inotify files with the information about their monitoring...
Masatake YAMATO [Fri, 9 Jun 2023 05:55:05 +0000 (14:55 +0900)] 
lsfd: fill NAME column of inotify files with the information about their monitoring targets

    # ./lsfd  -p 1  -Q '(TYPE == "inotify") and (FD > 7)'
    COMMAND PID USER ASSOC MODE    TYPE       SOURCE MNTID INODE NAME
    systemd   1 root    11  r-- inotify anon_inodefs    15  1060 inodes=116@dm-0
    systemd   1 root    13  r-- inotify anon_inodefs    15  1060 inodes=299@tmpfs
    systemd   1 root    19  r-- inotify anon_inodefs    15  1060 inodes=41@tmpfs,2@tmpfs,1@tmpfs,96@dm-0
    systemd   1 root    21  r-- inotify anon_inodefs    15  1060 inodes=41@tmpfs,2@tmpfs,1@tmpfs,96@dm-0

In addition, INOTIFY.INODES and INOTIFY.INODES.RAW column are added.

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
2 years agolsdf: make the code for filling SOURCE, PARTITION, and MAJMIN reusable
Masatake YAMATO [Fri, 9 Jun 2023 05:52:18 +0000 (14:52 +0900)] 
lsdf: make the code for filling SOURCE, PARTITION, and MAJMIN reusable

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
2 years agolibmount: (tests) add helper for option list splitting
Thomas Weißschuh [Tue, 13 Jun 2023 06:27:48 +0000 (08:27 +0200)] 
libmount: (tests) add helper for option list splitting

Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
2 years agomeson: build test_mount_optlist
Thomas Weißschuh [Tue, 13 Jun 2023 06:19:55 +0000 (08:19 +0200)] 
meson: build test_mount_optlist

Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
2 years agobuild-sys: add enosys and syscalls.h to gitignore
Enze Li [Fri, 9 Jun 2023 01:37:04 +0000 (09:37 +0800)] 
build-sys: add enosys and syscalls.h to gitignore

After compiling enosys, the syscalls.h file and the executable enosys are
generated, let's add these two files to the .gitignore file.

Signed-off-by: Enze Li <lienze@kylinos.cn>
2 years agobuild-sys: rearrange gitignore in alphabetical order
Enze Li [Fri, 9 Jun 2023 01:37:03 +0000 (09:37 +0800)] 
build-sys: rearrange gitignore in alphabetical order

Signed-off-by: Enze Li <lienze@kylinos.cn>
2 years agocfdisk: add hint about labels for bootable flag
Karel Zak [Mon, 12 Jun 2023 10:33:01 +0000 (12:33 +0200)] 
cfdisk: add hint about labels for bootable flag

Addresses: https://github.com/util-linux/util-linux/discussions/2220
Signed-off-by: Karel Zak <kzak@redhat.com>
2 years agoMerge branch 'libmount/loop-rw' of https://github.com/t-8ch/util-linux
Karel Zak [Mon, 12 Jun 2023 10:22:02 +0000 (12:22 +0200)] 
Merge branch 'libmount/loop-rw' of https://github.com/t-8ch/util-linux

* 'libmount/loop-rw' of https://github.com/t-8ch/util-linux:
  libmount: (optlist) correctly detect ro status

2 years agoMerge branch 'lsfd--refactor' of https://github.com/masatake/util-linux
Karel Zak [Mon, 12 Jun 2023 10:18:50 +0000 (12:18 +0200)] 
Merge branch 'lsfd--refactor' of https://github.com/masatake/util-linux

* 'lsfd--refactor' of https://github.com/masatake/util-linux:
  timeutils: add an inline funciton, is_timespecset()
  lsfd: use scols_table_get_column_by_name

2 years agoMerge branch 'setuid' of https://github.com/eworm-de/util-linux
Karel Zak [Mon, 12 Jun 2023 10:16:27 +0000 (12:16 +0200)] 
Merge branch 'setuid' of https://github.com/eworm-de/util-linux

* 'setuid' of https://github.com/eworm-de/util-linux:
  meson: install write setgid
  meson: install wall setgid
  meson: install umount setuid
  meson: install mount setuid
  meson: install newgrp setuid
  meson: install su setuid
  meson: install chsh setuid
  meson: install chfn setuid

2 years agoMerge branch 'lsfd--signalfd' of https://github.com/masatake/util-linux
Karel Zak [Mon, 12 Jun 2023 10:15:41 +0000 (12:15 +0200)] 
Merge branch 'lsfd--signalfd' of https://github.com/masatake/util-linux

* 'lsfd--signalfd' of https://github.com/masatake/util-linux:
  tests: (lsfd) add a case for testing signalfd related columns
  tests: (mkfds) add a factory to make a signalfd
  lsfd.1.adoc: update for signalfds
  lsfd: print the masks specified in signalfds

2 years agolibmount: (optlist) correctly detect ro status
Thomas Weißschuh [Sun, 11 Jun 2023 09:49:54 +0000 (11:49 +0200)] 
libmount: (optlist) correctly detect ro status

Fixes #2305

Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
2 years agotimeutils: add an inline funciton, is_timespecset()
Masatake YAMATO [Sat, 10 Jun 2023 15:31:46 +0000 (00:31 +0900)] 
timeutils: add an inline funciton, is_timespecset()

Close #2300.

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
2 years agolsfd: use scols_table_get_column_by_name
Masatake YAMATO [Fri, 9 Jun 2023 16:47:16 +0000 (01:47 +0900)] 
lsfd: use scols_table_get_column_by_name

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
2 years agomeson: install write setgid
Christian Hesse [Fri, 9 Jun 2023 13:04:00 +0000 (15:04 +0200)] 
meson: install write setgid

... as this requires elevated privileges.

2 years agomeson: install wall setgid
Christian Hesse [Fri, 9 Jun 2023 13:02:57 +0000 (15:02 +0200)] 
meson: install wall setgid

... as this requires elevated privileges.

2 years agomeson: install umount setuid
Christian Hesse [Fri, 9 Jun 2023 12:09:02 +0000 (14:09 +0200)] 
meson: install umount setuid

... as this requires elevated privileges.

2 years agomeson: install mount setuid
Christian Hesse [Fri, 9 Jun 2023 12:09:02 +0000 (14:09 +0200)] 
meson: install mount setuid

... as this requires elevated privileges.

2 years agomeson: install newgrp setuid
Christian Hesse [Fri, 9 Jun 2023 12:09:02 +0000 (14:09 +0200)] 
meson: install newgrp setuid

... as this requires elevated privileges.

2 years agomeson: install su setuid
Christian Hesse [Fri, 9 Jun 2023 12:09:02 +0000 (14:09 +0200)] 
meson: install su setuid

... as this requires elevated privileges.

2 years agomeson: install chsh setuid
Christian Hesse [Fri, 9 Jun 2023 12:09:02 +0000 (14:09 +0200)] 
meson: install chsh setuid

... as this requires elevated privileges.

2 years agomeson: install chfn setuid
Christian Hesse [Fri, 9 Jun 2023 12:09:02 +0000 (14:09 +0200)] 
meson: install chfn setuid

... as this requires elevated privileges.

2 years agoMerge branch 'PR/libmount-force-mount2' of github.com:karelzak/util-linux-work
Karel Zak [Fri, 9 Jun 2023 09:50:23 +0000 (11:50 +0200)] 
Merge branch 'PR/libmount-force-mount2' of github.com:karelzak/util-linux-work

* 'PR/libmount-force-mount2' of github.com:karelzak/util-linux-work:
  libmount: introduce LIBMOUNT_FORCE_MOUNT2={always,never,auto}

2 years agotests: (lsfd) add a case for testing signalfd related columns
Masatake YAMATO [Tue, 6 Jun 2023 23:01:40 +0000 (08:01 +0900)] 
tests: (lsfd) add a case for testing signalfd related columns

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
2 years agotests: (mkfds) add a factory to make a signalfd
Masatake YAMATO [Tue, 6 Jun 2023 22:55:09 +0000 (07:55 +0900)] 
tests: (mkfds) add a factory to make a signalfd

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
2 years agolsfd.1.adoc: update for signalfds
Masatake YAMATO [Tue, 6 Jun 2023 22:40:45 +0000 (07:40 +0900)] 
lsfd.1.adoc: update for signalfds

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
2 years agolsfd: print the masks specified in signalfds
Masatake YAMATO [Tue, 6 Jun 2023 22:30:06 +0000 (07:30 +0900)] 
lsfd: print the masks specified in signalfds

An example output:

    # ./lsfd -p "$(pidof systemd-journald)" -Q '(TYPE == "signalfd")'

    COMMAND             PID USER ASSOC MODE     TYPE       SOURCE MNTID INODE NAME
    systemd-journal 2382709 root   238  rw- signalfd anon_inodefs    15  1060 mask=USR1,USR2
    systemd-journal 2382709 root   239  rw- signalfd anon_inodefs    15  1060 mask=INT,TERM
    systemd-journal 2382709 root   240  rw- signalfd anon_inodefs    15  1060 mask=35

Using signum_to_signame is suggested by Karel Zak <kzak@redhat.com>.
Signed-off-by: Masatake YAMATO <yamato@redhat.com>
2 years agolibmount: introduce LIBMOUNT_FORCE_MOUNT2={always,never,auto}
Karel Zak [Mon, 5 Jun 2023 11:21:11 +0000 (13:21 +0200)] 
libmount: introduce LIBMOUNT_FORCE_MOUNT2={always,never,auto}

Let's introduce a stable workaround for use cases where new kernel API
is not ready to use.

The patch does not use "goto enosys" to exit as nothing in the hookset
is initialized yet.

Addresses: https://github.com/util-linux/util-linux/issues/1992
Addresses: https://github.com/util-linux/util-linux/issues/2283
Signed-off-by: Karel Zak <kzak@redhat.com>
2 years agoMerge branch 'pr/libmount-5.12.0' of github.com:karelzak/util-linux-work
Karel Zak [Tue, 6 Jun 2023 08:47:35 +0000 (10:47 +0200)] 
Merge branch 'pr/libmount-5.12.0' of github.com:karelzak/util-linux-work

* 'pr/libmount-5.12.0' of github.com:karelzak/util-linux-work:
  libmount: use mount(2) for remount on Linux < 5.14

2 years agoMerge branch 'lsfd--misc-fix' of https://github.com/masatake/util-linux
Karel Zak [Tue, 6 Jun 2023 08:46:19 +0000 (10:46 +0200)] 
Merge branch 'lsfd--misc-fix' of https://github.com/masatake/util-linux

* 'lsfd--misc-fix' of https://github.com/masatake/util-linux:
  lsfd: assign a class to the file in new_file()
  lsfd: don't check the value returned from new_file()

2 years agoMerge branch 'lsfd--timerfd' of https://github.com/masatake/util-linux
Karel Zak [Tue, 6 Jun 2023 08:45:17 +0000 (10:45 +0200)] 
Merge branch 'lsfd--timerfd' of https://github.com/masatake/util-linux

* 'lsfd--timerfd' of https://github.com/masatake/util-linux:
  tests: (lsfd/filter) add a case for comparing floating point numbers
  tests: (lsfd) add a case for testing timerfd related columns
  tests: add ts_skip_capability
  tests: (mkfds) add a factory to make a timerfd
  lsfd.1.adoc: write about timerfd
  lsfd: print the detail of the timer associated with a timerfd
  lsfd: (filter) accept floating point numbers in expressions
  lsfd: (filter) support floating point number used in columns
  lsfd: (filter) reduce duplicated code in macro definitions
  lsfd: (filter) improve error message
  lsfd.1.adoc: revise type names for columns
  lsfd.1.adoc: fix typos
  lsfd: adjust coding style
  lsfd: fix a sentence in comment