]> git.ipfire.org Git - thirdparty/util-linux.git/log
thirdparty/util-linux.git
11 months agoMerge branch 'lsclocks/relative-time' of https://github.com/t-8ch/util-linux
Karel Zak [Mon, 10 Jul 2023 09:54:48 +0000 (11:54 +0200)] 
Merge branch 'lsclocks/relative-time' of https://github.com/t-8ch/util-linux

* 'lsclocks/relative-time' of https://github.com/t-8ch/util-linux:
  lsclocks: add column RESOL for clock resolution
  lsclocks: rename column RESOLUTION to RESOL_RAW
  lsclocks: add relative time
  timeutils: add strtimespec_relative
  lib/timeutils: (tests) add test for formatting
  lib/timeutils: (tests) move to struct timespec
  lsclocks: trim default columns
  lsclocks: add --output-all

11 months agoMerge branch 'prlimit' of https://github.com/jwilk-forks/util-linux
Karel Zak [Mon, 10 Jul 2023 09:52:12 +0000 (11:52 +0200)] 
Merge branch 'prlimit' of https://github.com/jwilk-forks/util-linux

* 'prlimit' of https://github.com/jwilk-forks/util-linux:
  prlimit: (man) fix formatting

11 months agoMerge branch 'lslocks' of https://github.com/jwilk-forks/util-linux
Karel Zak [Mon, 10 Jul 2023 09:40:23 +0000 (11:40 +0200)] 
Merge branch 'lslocks' of https://github.com/jwilk-forks/util-linux

* 'lslocks' of https://github.com/jwilk-forks/util-linux:
  lslocks: don't attempt to open /proc/-1/fd/

11 months agolsclocks: add column RESOL for clock resolution
Thomas Weißschuh [Mon, 3 Jul 2023 16:02:31 +0000 (18:02 +0200)] 
lsclocks: add column RESOL for clock resolution

Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
11 months agolsclocks: rename column RESOLUTION to RESOL_RAW
Thomas Weißschuh [Mon, 3 Jul 2023 15:58:29 +0000 (17:58 +0200)] 
lsclocks: rename column RESOLUTION to RESOL_RAW

The new name is shorter and opens the path for a human readable version.

Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
11 months agolsclocks: add relative time
Thomas Weißschuh [Fri, 30 Jun 2023 12:58:42 +0000 (14:58 +0200)] 
lsclocks: add relative time

Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
11 months agotimeutils: add strtimespec_relative
Thomas Weißschuh [Tue, 4 Jul 2023 07:45:55 +0000 (09:45 +0200)] 
timeutils: add strtimespec_relative

Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
11 months agolib/timeutils: (tests) add test for formatting
Thomas Weißschuh [Tue, 4 Jul 2023 11:57:44 +0000 (13:57 +0200)] 
lib/timeutils: (tests) add test for formatting

Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
11 months agolib/timeutils: (tests) move to struct timespec
Thomas Weißschuh [Tue, 4 Jul 2023 07:44:42 +0000 (09:44 +0200)] 
lib/timeutils: (tests) move to struct timespec

Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
11 months agolsclocks: trim default columns
Thomas Weißschuh [Mon, 3 Jul 2023 15:55:45 +0000 (17:55 +0200)] 
lsclocks: trim default columns

Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
11 months agolsclocks: add --output-all
Thomas Weißschuh [Mon, 3 Jul 2023 15:55:40 +0000 (17:55 +0200)] 
lsclocks: add --output-all

Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
11 months agoprlimit: (man) fix formatting
Jakub Wilk [Mon, 3 Jul 2023 13:03:15 +0000 (15:03 +0200)] 
prlimit: (man) fix formatting

11 months agoMerge branch 'enosys/locale' of https://github.com/t-8ch/util-linux
Karel Zak [Mon, 3 Jul 2023 10:52:38 +0000 (12:52 +0200)] 
Merge branch 'enosys/locale' of https://github.com/t-8ch/util-linux

11 months agoMerge branch 'clock' of https://github.com/t-8ch/util-linux
Karel Zak [Mon, 3 Jul 2023 10:47:08 +0000 (12:47 +0200)] 
Merge branch 'clock' of https://github.com/t-8ch/util-linux

* 'clock' of https://github.com/t-8ch/util-linux:
  lsclocks: new util to interact with system clocks
  lib/timeutils: implement timespec formatting
  lib/timeutils: implement nanosecond formatting
  lib/timeutils: constify some arguments
  utmpdump: validate subsecond granularity

11 months agoMerge branch 'lsfd--xmode' of https://github.com/masatake/util-linux
Karel Zak [Mon, 3 Jul 2023 10:41:04 +0000 (12:41 +0200)] 
Merge branch 'lsfd--xmode' of https://github.com/masatake/util-linux

* 'lsfd--xmode' of https://github.com/masatake/util-linux:
  lsfd: add 'D' flag for representing deleted files to XMODE column
  lsfd: introduce XMODE column, extensible variant of MODE
  test: (lsfd) add a subcase for testing NAME column for a deleted file
  test: (lsfd) add a case for testing DELETED column
  test: (mkfds) add "make-regular-file" factory

11 months agoMerge branch 'lsfd--misc-tun' of https://github.com/masatake/util-linux
Karel Zak [Mon, 3 Jul 2023 10:38:48 +0000 (12:38 +0200)] 
Merge branch 'lsfd--misc-tun' of https://github.com/masatake/util-linux

* 'lsfd--misc-tun' of https://github.com/masatake/util-linux:
  tests: (lsfd) add a case testing TUN.IFACE column
  tests: (mkfds) add a factor for opening tun device
  lsfd: add TUN.IFFACE, a column for interfaces behind tun devices
  lsfd: (refactor) move miscdev specific code to cdev_misc_ops
  lsfd: (refactor) make the way to handle character devices extensible
  lsfd: (refactor) introduce a content data type for char devices

11 months agoMerge branch 'patch-1' of https://github.com/diizzyy/util-linux
Karel Zak [Mon, 3 Jul 2023 10:36:07 +0000 (12:36 +0200)] 
Merge branch 'patch-1' of https://github.com/diizzyy/util-linux

* 'patch-1' of https://github.com/diizzyy/util-linux:
  include/bitops.h: Remove bswap* compatibility hack for FreeBSD

11 months agoMerge branch 'wip/rishi/libmount-src-hook-mount-move_setattr-typo' of https://github...
Karel Zak [Mon, 3 Jul 2023 10:32:42 +0000 (12:32 +0200)] 
Merge branch 'wip/rishi/libmount-src-hook-mount-move_setattr-typo' of https://github.com/debarshiray/util-linux

* 'wip/rishi/libmount-src-hook-mount-move_setattr-typo' of https://github.com/debarshiray/util-linux:
  libmount: fix typo

11 months agoMerge branch 'wip/rishi/libmount-src-libmount.h-MNT_ERR_APPLYFLAGS-docs' of https...
Karel Zak [Mon, 3 Jul 2023 10:30:43 +0000 (12:30 +0200)] 
Merge branch 'wip/rishi/libmount-src-libmount.h-MNT_ERR_APPLYFLAGS-docs' of https://github.com/debarshiray/util-linux

* 'wip/rishi/libmount-src-libmount.h-MNT_ERR_APPLYFLAGS-docs' of https://github.com/debarshiray/util-linux:
  libmount: update documentation for MNT_ERR_APPLYFLAGS

11 months agoMerge branch 'unshare/negative-time-offset' of https://github.com/t-8ch/util-linux
Karel Zak [Mon, 3 Jul 2023 10:28:54 +0000 (12:28 +0200)] 
Merge branch 'unshare/negative-time-offset' of https://github.com/t-8ch/util-linux

* 'unshare/negative-time-offset' of https://github.com/t-8ch/util-linux:
  unshare: allow negative time offsets

11 months agolslocks: don't attempt to open /proc/-1/fd/
Jakub Wilk [Mon, 3 Jul 2023 10:18:51 +0000 (12:18 +0200)] 
lslocks: don't attempt to open /proc/-1/fd/

Signed-off-by: Jakub Wilk <jwilk@jwilk.net>
11 months agounshare: allow negative time offsets
Thomas Weißschuh [Fri, 30 Jun 2023 20:36:06 +0000 (22:36 +0200)] 
unshare: allow negative time offsets

Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
11 months 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>
11 months agoprlimit: reject trailing junk in limits without ":"
Jakub Wilk [Thu, 29 Jun 2023 18:11:41 +0000 (20:11 +0200)] 
prlimit: reject trailing junk in limits without ":"

Before:

    $ prlimit --verbose --core=1x
    New CORE limit for pid 42: <1:1>

After:

    $ prlimit --verbose --core=1x
    prlimit: failed to parse CORE limit

Signed-off-by: Jakub Wilk <jwilk@jwilk.net>
11 months agolibmount: update documentation for MNT_ERR_APPLYFLAGS
Debarshi Ray [Thu, 29 Jun 2023 11:04:41 +0000 (13:04 +0200)] 
libmount: update documentation for MNT_ERR_APPLYFLAGS

The implementation using the new FD based mount kernel API (ie.,
fsconfig/fsopen) uses MNT_ERR_APPLYFLAGS for failed mount_setattr(2)
calls, which involves more mount attributes (eg., MOUNT_ATTR_RDONLY,
MOUNT_ATTR_NOSUID, etc.) in addition to the MS_PROPAGATION flags (eg.,
MS_SHARED, MS_UNBINDABLE, etc.).

Note that mount_setattr(2) is part of the new FD based mount kernel API,
and is not used by the classic mount(2) based version.

Fallout from 987d844cdbc0f91ca81de3c1e5d0628a60eb458f

Signed-off-by: Debarshi Ray <rishi@fedoraproject.org>
11 months agolibmount: fix typo
Debarshi Ray [Thu, 29 Jun 2023 10:21:07 +0000 (12:21 +0200)] 
libmount: fix typo

Similar to e80f8e46127e45907db25b4ffd58c699fdf4c35f and fallout from
6753e6f6912658e836966a6316df956e1af5fcae

Signed-off-by: Debarshi Ray <rishi@fedoraproject.org>
11 months 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>
11 months 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>
11 months 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>
11 months 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>
11 months 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>
11 months 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>
11 months agoenosys: enable locale handling
Thomas Weißschuh [Tue, 27 Jun 2023 09:24:21 +0000 (11:24 +0200)] 
enosys: enable locale handling

Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
11 months 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

11 months agotests: (lsfd) add a case testing TUN.IFACE column
Masatake YAMATO [Mon, 26 Jun 2023 16:16:45 +0000 (01:16 +0900)] 
tests: (lsfd) add a case testing TUN.IFACE column

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
11 months 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

11 months 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

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

11 months agoinclude/bitops.h: Remove bswap* compatibility hack for FreeBSD
Daniel Engberg [Mon, 26 Jun 2023 17:22:16 +0000 (19:22 +0200)] 
include/bitops.h: Remove bswap* compatibility hack for FreeBSD

This is no longer needed on supported versions of FreeBSD and causes build failures

11 months agotests: (mkfds) add a factor for opening tun device
Masatake YAMATO [Mon, 26 Jun 2023 16:15:04 +0000 (01:15 +0900)] 
tests: (mkfds) add a factor for opening tun device

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
11 months agolsfd: add TUN.IFFACE, a column for interfaces behind tun devices
Masatake YAMATO [Sun, 25 Jun 2023 17:41:33 +0000 (02:41 +0900)] 
lsfd: add TUN.IFFACE, a column for interfaces behind tun devices

An example output:

  # ./lsfd -Q '(SOURCE == "misc:tun")'  -o+TUN.IFACE
  COMMAND             PID       USER ASSOC MODE TYPE   SOURCE MNTID INODE NAME          TUN.IFACE
  qemu-system-x86 2846033       qemu    48  rw-  CHR misc:tun    23   306 iface=vnet89     vnet89
  qemu-system-x86 2865022       qemu    56  rw-  CHR misc:tun    23   306 iface=vnet103   vnet103
  openvpn         3113730 nm-openvpn     7  rw-  CHR misc:tun   588   306 iface=tun0         tun0
  qemu-system-x86 3608136       qemu    36  rw-  CHR misc:tun    23   306 iface=vnet104   vnet104
  qemu-system-x86 3608136       qemu    39  rw-  CHR misc:tun    23   306 iface=vnet105   vnet105
  qemu-system-x86 3608238       qemu    40  rw-  CHR misc:tun    23   306 iface=vnet106   vnet106
  qemu-system-x86 3608238       qemu    43  rw-  CHR misc:tun    23   306 iface=vnet107   vnet107
  qemu-system-x86 3608338       qemu    54  rw-  CHR misc:tun    23   306 iface=vnet108   vnet108
  qemu-system-x86 3608338       qemu    60  rw-  CHR misc:tun    23   306 iface=vnet109   vnet109

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
11 months agolsfd: (refactor) move miscdev specific code to cdev_misc_ops
Masatake YAMATO [Sun, 25 Jun 2023 16:52:27 +0000 (01:52 +0900)] 
lsfd: (refactor) move miscdev specific code to cdev_misc_ops

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
11 months agolsfd: (refactor) make the way to handle character devices extensible
Masatake YAMATO [Sun, 25 Jun 2023 16:10:57 +0000 (01:10 +0900)] 
lsfd: (refactor) make the way to handle character devices extensible

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
11 months agolsfd: (refactor) introduce a content data type for char devices
Masatake YAMATO [Sun, 25 Jun 2023 10:00:39 +0000 (19:00 +0900)] 
lsfd: (refactor) introduce a content data type for char devices

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
11 months 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

11 months 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>
11 months 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>
11 months 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>
11 months 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>
11 months 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

11 months 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

11 months 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

11 months 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

11 months 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

11 months 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

11 months 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>
11 months 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>
11 months 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>
11 months 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>
11 months 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>
11 months agohardlink: (man) add missing comma
Jakub Wilk [Sat, 24 Jun 2023 07:24:29 +0000 (09:24 +0200)] 
hardlink: (man) add missing comma

11 months 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.

11 months 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>
11 months 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>
11 months 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

11 months 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

11 months 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

11 months 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>
11 months 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>
11 months 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.

11 months 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().

11 months 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

11 months 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.

11 months 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>
11 months 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>
11 months 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>
11 months 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>
11 months 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>
11 months 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>
11 months 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>
11 months agolsfd: add 'D' flag for representing deleted files to XMODE column
Masatake YAMATO [Sun, 11 Jun 2023 07:36:03 +0000 (16:36 +0900)] 
lsfd: add 'D' flag for representing deleted files to XMODE column

Now NAME column doesn't print "(deleted)" markers at the end of
file name.

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
11 months agolsfd: introduce XMODE column, extensible variant of MODE
Masatake YAMATO [Fri, 9 Jun 2023 12:35:55 +0000 (21:35 +0900)] 
lsfd: introduce XMODE column, extensible variant of MODE

The original MODE column comes from three letters (rwx) may not be
enough for representing various aspects of file descriptors and memory
mappings. We want to add more items in the future.

However, the description of MODE in lsfd(1) doesn't wrote about its
extensibility. Adding more letters to the column can break
compatibility in someone's use case.

This change introduces XMODE column. Unlike MODE, XMODE is declared as
an extensible column in lsfd(1). Currently, it shows the same items as
the MODE column does.

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
11 months agotest: (lsfd) add a subcase for testing NAME column for a deleted file
Masatake YAMATO [Sun, 18 Jun 2023 14:40:01 +0000 (23:40 +0900)] 
test: (lsfd) add a subcase for testing NAME column for a deleted file

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
11 months agotest: (lsfd) add a case for testing DELETED column
Masatake YAMATO [Sun, 18 Jun 2023 09:08:47 +0000 (18:08 +0900)] 
test: (lsfd) add a case for testing DELETED column

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
11 months agotest: (mkfds) add "make-regular-file" factory
Masatake YAMATO [Sun, 18 Jun 2023 08:47:49 +0000 (17:47 +0900)] 
test: (mkfds) add "make-regular-file" factory

With "delete" boolean parameter, you can delete the file just
after making it.

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
11 months 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>
11 months agoci: fix indentation
Frantisek Sumsal [Tue, 20 Jun 2023 14:19:42 +0000 (16:19 +0200)] 
ci: fix indentation

11 months 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>
11 months 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>
11 months 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>
11 months 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>
11 months 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>
11 months 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>
11 months 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>
12 months 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

12 months 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

12 months 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

12 months 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

12 months 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

12 months 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