]> git.ipfire.org Git - thirdparty/util-linux.git/log
thirdparty/util-linux.git
15 months agolsfd: align --help output
Karel Zak [Wed, 1 Mar 2023 11:55:18 +0000 (12:55 +0100)] 
lsfd: align --help output

Signed-off-by: Karel Zak <kzak@redhat.com>
15 months agoMerge branch 'lsfd--inet-option' of https://github.com/masatake/util-linux
Karel Zak [Wed, 1 Mar 2023 11:53:02 +0000 (12:53 +0100)] 
Merge branch 'lsfd--inet-option' of https://github.com/masatake/util-linux

* 'lsfd--inet-option' of https://github.com/masatake/util-linux:
  tests: (lsfd) add a case for testing -i/--inet options
  lsfd: implement -i/--inet option
  lsfd: adjust whitespaces in the help message

15 months agotests: (lsfd) add a case for testing -i/--inet options
Masatake YAMATO [Tue, 28 Feb 2023 15:14:18 +0000 (00:14 +0900)] 
tests: (lsfd) add a case for testing -i/--inet options

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
15 months agolsfd: implement -i/--inet option
Masatake YAMATO [Tue, 28 Feb 2023 13:56:57 +0000 (22:56 +0900)] 
lsfd: implement -i/--inet option

Reviewed-by: Thomas Weißschuh <thomas@t-8ch.de>
Signed-off-by: Masatake YAMATO <yamato@redhat.com>
15 months agolsfd: adjust whitespaces in the help message
Masatake YAMATO [Tue, 28 Feb 2023 13:55:53 +0000 (22:55 +0900)] 
lsfd: adjust whitespaces in the help message

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
15 months agokill: fix buffer overflow
Karel Zak [Tue, 28 Feb 2023 12:11:05 +0000 (13:11 +0100)] 
kill: fix buffer overflow

Signed-off-by: Karel Zak <kzak@redhat.com>
15 months agolibmount: treat comma as terminator in mnt_match_options()
Karel Zak [Tue, 28 Feb 2023 10:56:44 +0000 (11:56 +0100)] 
libmount: treat comma as terminator in mnt_match_options()

An alone "no" in the pattern is interpreted as an error; it should be also
valid in case the keyword is followed by a comma, e.g.

mnt_match_options("bla", "no,,");

Suggested-by: Sören Tempel <soeren@soeren-tempel.net>
Signed-off-by: Karel Zak <kzak@redhat.com>
15 months agoagetty: support simplified color sequences in \e{name}
Karel Zak [Mon, 27 Feb 2023 16:52:45 +0000 (17:52 +0100)] 
agetty: support simplified color sequences in \e{name}

Signed-off-by: Karel Zak <kzak@redhat.com>
15 months agolibsmartcols: support simplified color sequences
Karel Zak [Mon, 27 Feb 2023 16:50:39 +0000 (17:50 +0100)] 
libsmartcols: support simplified color sequences

Signed-off-by: Karel Zak <kzak@redhat.com>
15 months agolib/colors: move colors canonicalization to lib/color-names.c
Karel Zak [Mon, 27 Feb 2023 16:43:11 +0000 (17:43 +0100)] 
lib/colors: move colors canonicalization to lib/color-names.c

* let's make simplified sequences (e.g. "35;4")  used without
  lib/colors.c (without color schemes)

* add function to detect already usable esc sequence

* support this new feature in "test_colors --color <name|seq|...>"

  ./test_colors --color "red"
  ./test_colors --color "35;5"

Signed-off-by: Karel Zak <kzak@redhat.com>
15 months agoMerge branch 'lsfd-more-inet-1' of https://github.com/masatake/util-linux
Karel Zak [Mon, 27 Feb 2023 13:51:39 +0000 (14:51 +0100)] 
Merge branch 'lsfd-more-inet-1' of https://github.com/masatake/util-linux

* 'lsfd-more-inet-1' of https://github.com/masatake/util-linux: (26 commits)
  tests: (lsfd) skip if the platform doesn't permit to use ioctl(fd, SIOCGSKNS)
  tests: (lsfd) skip if the platform doesn't permit to use unshare(2)
  tests: (lsfd) skip if the platform doesn't attach a buffer to a packet socket
  tests: (lsfd) skip if the platform doesn't provide pidfd_open(2)
  tests: (mkfds) introduce constants representing the limitation of the test environment
  tests: (lsfd) send a signal only if the target PID is know
  tests: (lsfd) add comments about the reason using ts_skip_qemu_user()
  tests: (mkfds) fix minor typo in comment
  tests: (lsfd) add a case for PING and PINGv6 sockets
  lsfd: use extra information loaded from /proc/net/icmp6
  lsfd: use extra information loaded from /proc/net/icmp
  tests: (mkfds) add ping and ping6 factories
  tests: (lsfd) add a case for UDPLITEv6 sockets
  tests: (lsfd) add a case for UDP-Lite sockets
  lsfd: use extra information loaded from /proc/net/udplite6
  lsfd: use extra information loaded from /proc/net/udplite
  tests: (mkfds) add "lite" parameter to udp and udp6 factories
  tests: (lsfd) add a case for RAWv6 sockets
  tests: (mkfds) add raw6 factory
  lsfd: use extra information loaded from /proc/net/raw6
  ...

15 months agolibmount: make mnt_match_options() more robust
Karel Zak [Mon, 27 Feb 2023 10:33:54 +0000 (11:33 +0100)] 
libmount: make mnt_match_options() more robust

* don't allocate and use a buffer for the pattern if the pattern is empty

* make it more obvious how empty pattern and empty optstr is evaluated

* add regression test

Reported-by: Sören Tempel <soeren@soeren-tempel.net>
Signed-off-by: Karel Zak <kzak@redhat.com>
15 months agotests: (lsfd) skip if the platform doesn't permit to use ioctl(fd, SIOCGSKNS)
Masatake YAMATO [Sat, 25 Feb 2023 17:44:49 +0000 (02:44 +0900)] 
tests: (lsfd) skip if the platform doesn't permit to use ioctl(fd, SIOCGSKNS)

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
15 months agotests: (lsfd) skip if the platform doesn't permit to use unshare(2)
Masatake YAMATO [Sat, 25 Feb 2023 17:35:13 +0000 (02:35 +0900)] 
tests: (lsfd) skip if the platform doesn't permit to use unshare(2)

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
15 months agotests: (lsfd) skip if the platform doesn't attach a buffer to a packet socket
Masatake YAMATO [Sat, 25 Feb 2023 16:33:17 +0000 (01:33 +0900)] 
tests: (lsfd) skip if the platform doesn't attach a buffer to a packet socket

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
15 months agotests: (lsfd) skip if the platform doesn't provide pidfd_open(2)
Masatake YAMATO [Sat, 25 Feb 2023 15:58:47 +0000 (00:58 +0900)] 
tests: (lsfd) skip if the platform doesn't provide pidfd_open(2)

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
15 months agotests: (mkfds) introduce constants representing the limitation of the test environment
Masatake YAMATO [Thu, 13 Oct 2022 06:23:26 +0000 (15:23 +0900)] 
tests: (mkfds) introduce constants representing the limitation of the test environment

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
15 months agotests: (lsfd) send a signal only if the target PID is know
Masatake YAMATO [Wed, 26 Oct 2022 15:23:58 +0000 (00:23 +0900)] 
tests: (lsfd) send a signal only if the target PID is know

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
15 months agotests: (lsfd) add comments about the reason using ts_skip_qemu_user()
Masatake YAMATO [Wed, 26 Oct 2022 17:14:27 +0000 (02:14 +0900)] 
tests: (lsfd) add comments about the reason using ts_skip_qemu_user()

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
15 months agotests: (mkfds) fix minor typo in comment
Masatake YAMATO [Fri, 24 Feb 2023 17:22:04 +0000 (02:22 +0900)] 
tests: (mkfds) fix minor typo in comment

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
15 months agotests: (lsfd) add a case for PING and PINGv6 sockets
Masatake YAMATO [Fri, 24 Feb 2023 17:24:51 +0000 (02:24 +0900)] 
tests: (lsfd) add a case for PING and PINGv6 sockets

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
15 months agolsfd: use extra information loaded from /proc/net/icmp6
Masatake YAMATO [Thu, 23 Feb 2023 15:21:48 +0000 (00:21 +0900)] 
lsfd: use extra information loaded from /proc/net/icmp6

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
15 months agolsfd: use extra information loaded from /proc/net/icmp
Masatake YAMATO [Thu, 23 Feb 2023 15:09:54 +0000 (00:09 +0900)] 
lsfd: use extra information loaded from /proc/net/icmp

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
15 months agotests: (mkfds) add ping and ping6 factories
Masatake YAMATO [Thu, 23 Feb 2023 13:29:36 +0000 (22:29 +0900)] 
tests: (mkfds) add ping and ping6 factories

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
15 months agotests: (lsfd) add a case for UDPLITEv6 sockets
Masatake YAMATO [Wed, 22 Feb 2023 17:03:23 +0000 (02:03 +0900)] 
tests: (lsfd) add a case for UDPLITEv6 sockets

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
15 months agotests: (lsfd) add a case for UDP-Lite sockets
Masatake YAMATO [Wed, 22 Feb 2023 16:46:15 +0000 (01:46 +0900)] 
tests: (lsfd) add a case for UDP-Lite sockets

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
15 months agolsfd: use extra information loaded from /proc/net/udplite6
Masatake YAMATO [Tue, 21 Feb 2023 15:05:00 +0000 (00:05 +0900)] 
lsfd: use extra information loaded from /proc/net/udplite6

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
15 months agolsfd: use extra information loaded from /proc/net/udplite
Masatake YAMATO [Tue, 21 Feb 2023 14:56:18 +0000 (23:56 +0900)] 
lsfd: use extra information loaded from /proc/net/udplite

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
15 months agotests: (mkfds) add "lite" parameter to udp and udp6 factories
Masatake YAMATO [Tue, 21 Feb 2023 14:58:37 +0000 (23:58 +0900)] 
tests: (mkfds) add "lite" parameter to udp and udp6 factories

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
15 months agotests: (lsfd) add a case for RAWv6 sockets
Masatake YAMATO [Sat, 18 Feb 2023 20:10:43 +0000 (05:10 +0900)] 
tests: (lsfd) add a case for RAWv6 sockets

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
15 months agotests: (mkfds) add raw6 factory
Masatake YAMATO [Sat, 18 Feb 2023 20:01:26 +0000 (05:01 +0900)] 
tests: (mkfds) add raw6 factory

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
15 months agolsfd: use extra information loaded from /proc/net/raw6
Masatake YAMATO [Fri, 3 Feb 2023 05:23:04 +0000 (14:23 +0900)] 
lsfd: use extra information loaded from /proc/net/raw6

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
15 months agotests: (lsfd) add a case for UDPv6 sockets
Masatake YAMATO [Sat, 18 Feb 2023 15:53:05 +0000 (00:53 +0900)] 
tests: (lsfd) add a case for UDPv6 sockets

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
15 months agotests: (mkfds) add udp6 factory
Masatake YAMATO [Sat, 18 Feb 2023 15:52:27 +0000 (00:52 +0900)] 
tests: (mkfds) add udp6 factory

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
15 months agolsfd: use extra information loaded from /proc/net/udp6
Masatake YAMATO [Thu, 2 Feb 2023 01:28:48 +0000 (10:28 +0900)] 
lsfd: use extra information loaded from /proc/net/udp6

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
15 months agolsfd: revise the comment for UNIX_LINE_LEN
Masatake YAMATO [Sat, 18 Feb 2023 15:11:45 +0000 (00:11 +0900)] 
lsfd: revise the comment for UNIX_LINE_LEN

The orignal comment was not understandable.

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
15 months agotests: (lsfd) delete an unused variable
Masatake YAMATO [Sat, 18 Feb 2023 15:40:19 +0000 (00:40 +0900)] 
tests: (lsfd) delete an unused variable

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
15 months agolsfd: delete an unnecessary cast operation
Masatake YAMATO [Mon, 20 Feb 2023 15:10:53 +0000 (00:10 +0900)] 
lsfd: delete an unnecessary cast operation

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
15 months agodmesg: (tests) prevent loading of custom colorscheme
Thomas Weißschuh [Thu, 23 Feb 2023 02:30:36 +0000 (02:30 +0000)] 
dmesg: (tests) prevent loading of custom colorscheme

Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
15 months agocal: (tests) prevent loading of custom colorschemes
Thomas Weißschuh [Thu, 23 Feb 2023 02:28:23 +0000 (02:28 +0000)] 
cal: (tests) prevent loading of custom colorschemes

Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
15 months agotests: add function to inhibit loading of custom colorschemes
Thomas Weißschuh [Thu, 23 Feb 2023 02:37:55 +0000 (02:37 +0000)] 
tests: add function to inhibit loading of custom colorschemes

Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
15 months agolib/colors: ensure fallback to system directory
Thomas Weißschuh [Thu, 23 Feb 2023 02:20:28 +0000 (02:20 +0000)] 
lib/colors: ensure fallback to system directory

The return value from colors_readdir(homedir) is used to determine if
the system directory should be searched.
Previously the mere existence of `~/.config/terminal-colors.d/` would
inhibit all lookups in `/etc/terminal-colors.d`.

Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
15 months agolib/randutils: drop unnecessary fcntl() in random_get_fd()
Thomas Haller [Wed, 22 Feb 2023 15:32:03 +0000 (16:32 +0100)] 
lib/randutils: drop unnecessary fcntl() in random_get_fd()

We already pass O_CLOEXEC flag to open(), no need to modify
the file descriptor with FD_CLOEXEC afterwards.

This was a left over from commit b1fa3e2234fa ('lib: use O_CLOEXEC in
libcommon').

Signed-off-by: Thomas Haller <thaller@redhat.com>
15 months agolibmount: move selinux stuff to hook module
Karel Zak [Wed, 22 Feb 2023 20:26:11 +0000 (21:26 +0100)] 
libmount: move selinux stuff to hook module

 * convert selinux contexts to raw format during "prep-options" stage

 * convert rootcontext=@target to raw context when final mountpoint
   path is available (after mkdir).

Signed-off-by: Karel Zak <kzak@redhat.com>
15 months agolibmount: make it possible to define order of hooks
Karel Zak [Wed, 22 Feb 2023 20:22:32 +0000 (21:22 +0100)] 
libmount: make it possible to define order of hooks

In some cases we have more hooks in the same stage and it's necessary
to call some hooks after another.

Signed-off-by: Karel Zak <kzak@redhat.com>
15 months agolibmount: create a hook to set rootcontext=@target
Karel Zak [Wed, 22 Feb 2023 12:00:29 +0000 (13:00 +0100)] 
libmount: create a hook to set rootcontext=@target

The final target (mountpoint) depends on others libmount functionality
(X-mount.mkdir or --target-prefix). It means we cannot assume target
when the library calls fix_opts() and translates selinux contexts.

The solution is extra hook executed after mkdir.

Signed-off-by: Karel Zak <kzak@redhat.com>
15 months agoMerge branch 'auto_rootcontext' of https://github.com/cgzones/util-linux
Karel Zak [Wed, 22 Feb 2023 10:42:17 +0000 (11:42 +0100)] 
Merge branch 'auto_rootcontext' of https://github.com/cgzones/util-linux

* 'auto_rootcontext' of https://github.com/cgzones/util-linux:
  mount: add rootcontext=@target
  libmount: declare array of LSM options const

15 months agoMerge branch 'test_mkfds_getopt' of https://github.com/masatake/util-linux
Karel Zak [Wed, 22 Feb 2023 10:39:52 +0000 (11:39 +0100)] 
Merge branch 'test_mkfds_getopt' of https://github.com/masatake/util-linux

* 'test_mkfds_getopt' of https://github.com/masatake/util-linux:
  test_mkfds: add missing terminator of the option spec list

15 months agolslogins: (man) reorder login statuses
Karel Zak [Wed, 22 Feb 2023 10:36:03 +0000 (11:36 +0100)] 
lslogins: (man) reorder login statuses

It's better to keep the order in the man page the same as used in the lslogins output.

Reported-by: Radka Skvarilova <rskvaril@redhat.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
15 months agoMerge branch 'blkid_opal_io' of https://github.com/bluca/util-linux
Karel Zak [Wed, 22 Feb 2023 10:32:05 +0000 (11:32 +0100)] 
Merge branch 'blkid_opal_io' of https://github.com/bluca/util-linux

* 'blkid_opal_io' of https://github.com/bluca/util-linux:
  libblkid: try LUKS2 first when probing
  libblkid: check if device is OPAL locked on I/O error

15 months agolibblkid: try LUKS2 first when probing
Luca Boccassi [Thu, 9 Feb 2023 01:21:07 +0000 (01:21 +0000)] 
libblkid: try LUKS2 first when probing

If a device is locked with OPAL we'll get an I/O error when probing
past the LUKS2 header. Try it first to avoid this issue. It is
useful regardless, as when we find a LUKS superblock we stop there
anyway, no need to check futher.

Signed-off-by: Luca Boccassi <bluca@debian.org>
15 months agolibblkid: check if device is OPAL locked on I/O error
Luca Boccassi [Wed, 22 Feb 2023 01:33:36 +0000 (01:33 +0000)] 
libblkid: check if device is OPAL locked on I/O error

Use the appropriate ioctl, if available, to check if a device is locked
when we get an I/O error. Save the information so that we don't have to
repeat the ioctl.

Before:

LIBBLKID_DEBUG=all blkid -p /dev/sdd2
206326: libblkid:     INIT: library debug mask: 0xffff
206326: libblkid:     INIT: library version: 2.38.1 [04-Aug-2022]
Available "LIBBLKID_DEBUG=<name>[,...]|<mask>" debug masks:
   all      [0xffff] : info about all subsystems
   cache    [0x0004] : blkid tags cache
   config   [0x0008] : config file utils
   dev      [0x0010] : device utils
   devname  [0x0020] : /proc/partitions evaluation
   devno    [0x0040] : conversions to device name
   evaluate [0x0080] : tags resolving
   help     [0x0001] : this help
   lowprobe [0x0100] : superblock/raids/partitions probing
   buffer   [0x2000] : low-probing buffers
   probe    [0x0200] : devices verification
   read     [0x0400] : cache parsing
   save     [0x0800] : cache writing
   tag      [0x1000] : tags utils
206326: libblkid: LOWPROBE: allocate a new probe
206326: libblkid: LOWPROBE: zeroize wiper
206326: libblkid: LOWPROBE: ready for low-probing, offset=0, size=234584276992, zonesize=0
206326: libblkid: LOWPROBE: whole-disk: NO, regfile: NO
206326: libblkid: LOWPROBE: start probe
206326: libblkid: LOWPROBE: zeroize wiper
206326: libblkid: LOWPROBE: chain safeprobe superblocks ENABLED
206326: libblkid: LOWPROBE: --> starting probing loop [SUBLKS idx=-1]
206326: libblkid: LOWPROBE: [0] linux_raid_member:
206326: libblkid: LOWPROBE:  call probefunc()
206326: libblkid: LOWPROBE:  read: off=234584211456 len=64
206326: libblkid: LOWPROBE:  read failed: Input/output error
206326: libblkid: LOWPROBE: <-- leaving probing loop (failed=-5) [SUBLKS idx=0]
206326: libblkid: LOWPROBE: freeing values list
206326: libblkid: LOWPROBE: end probe
206326: libblkid: LOWPROBE: zeroize wiper
206326: libblkid: LOWPROBE: free probe

After:

LIBBLKID_DEBUG=all blkid -p /dev/sdd2
206221: libblkid:     INIT: library debug mask: 0xffff
206221: libblkid:     INIT: library version: 2.38.1119 [28-Mar-2022]
Available "LIBBLKID_DEBUG=<name>[,...]|<mask>" debug masks:
   all      [0x00ffff] : info about all subsystems
   cache    [0x000004] : blkid tags cache
   config   [0x000008] : config file utils
   dev      [0x000010] : device utils
   devname  [0x000020] : /proc/partitions evaluation
   devno    [0x000040] : conversions to device name
   evaluate [0x000080] : tags resolving
   help     [0x000001] : this help
   lowprobe [0x000100] : superblock/raids/partitions probing
   buffer   [0x002000] : low-probing buffers
   probe    [0x000200] : devices verification
   read     [0x000400] : cache parsing
   save     [0x000800] : cache writing
   tag      [0x001000] : tags utils
206221: libblkid: LOWPROBE: allocate a new probe
206221: libblkid: LOWPROBE: zeroize wiper
206221: libblkid: LOWPROBE: ready for low-probing, offset=0, size=234584276992, zonesize=0
206221: libblkid: LOWPROBE: whole-disk: NO, regfile: NO
206221: libblkid: LOWPROBE: start probe
206221: libblkid: LOWPROBE: zeroize wiper
206221: libblkid: LOWPROBE: chain safeprobe superblocks ENABLED
206221: libblkid: LOWPROBE: --> starting probing loop [SUBLKS idx=-1]
206221: libblkid: LOWPROBE: [0] linux_raid_member:
206221: libblkid: LOWPROBE:  call probefunc()
206221: libblkid: LOWPROBE:  read: off=234584211456 len=64
206221: libblkid: LOWPROBE:  read failed: Input/output error
206221: libblkid: LOWPROBE:  read: off=234584268800 len=256
206221: libblkid: LOWPROBE:  read failed: Input/output error
206221: libblkid: LOWPROBE:  read: off=0 len=256
206221: libblkid: LOWPROBE:  read: off=4096 len=256
206221: libblkid: LOWPROBE: [1] ddf_raid_member:
206221: libblkid: LOWPROBE:  call probefunc()
206221: libblkid: LOWPROBE:  read: off=234584276480 len=512
206221: libblkid: LOWPROBE:  read failed: Input/output error
206221: libblkid: LOWPROBE: [2] isw_raid_member:
206221: libblkid: LOWPROBE:  call probefunc()
206221: libblkid: LOWPROBE: [3] lsi_mega_raid_member:
206221: libblkid: LOWPROBE:  call probefunc()
206221: libblkid: LOWPROBE: [4] via_raid_member:
206221: libblkid: LOWPROBE:  call probefunc()
206221: libblkid: LOWPROBE: [5] silicon_medley_raid_member:
206221: libblkid: LOWPROBE:  call probefunc()
206221: libblkid: LOWPROBE: [6] nvidia_raid_member:
206221: libblkid: LOWPROBE:  call probefunc()
206221: libblkid: LOWPROBE: [7] promise_fasttrack_raid_member:
206221: libblkid: LOWPROBE:  call probefunc()
206221: libblkid: LOWPROBE: [8] hpt45x_raid_member:
206221: libblkid: LOWPROBE:  call probefunc()
206221: libblkid: LOWPROBE: [9] hpt37x_raid_member:
206221: libblkid: LOWPROBE:  read: off=4096 len=1024
206221: libblkid:   BUFFER:  reuse: off=4096 len=1024 (for off=4096 len=1024)
206221: libblkid: LOWPROBE: [10] adaptec_raid_member:
206221: libblkid: LOWPROBE:  call probefunc()
206221: libblkid: LOWPROBE: [11] jmicron_raid_member:
206221: libblkid: LOWPROBE:  call probefunc()
206221: libblkid: LOWPROBE: [12] bcache:
206221: libblkid:   BUFFER:  reuse: off=4096 len=1024 (for off=4096 len=1024)
206221: libblkid: LOWPROBE: [13] bcachefs:
206221: libblkid:   BUFFER:  reuse: off=4096 len=1024 (for off=4096 len=1024)
206221: libblkid:   BUFFER:  reuse: off=4096 len=1024 (for off=4096 len=1024)
206221: libblkid: LOWPROBE: [14] ceph_bluestore:
206221: libblkid: LOWPROBE:  read: off=0 len=1024
206221: libblkid: LOWPROBE: [15] drbd:
206221: libblkid: LOWPROBE:  call probefunc()
206221: libblkid: LOWPROBE:  read: off=234584272896 len=104
206221: libblkid: LOWPROBE:  read failed: Input/output error
206221: libblkid: LOWPROBE:  read: off=234584272896 len=1392
206221: libblkid: LOWPROBE:  read failed: Input/output error
206221: libblkid: LOWPROBE: [16] drbdmanage_control_volume:
206221: libblkid:   BUFFER:  reuse: off=0 len=1024 (for off=0 len=1024)
206221: libblkid: LOWPROBE: [17] drbdproxy_datalog:
206221: libblkid:   BUFFER:  reuse: off=0 len=1024 (for off=0 len=1024)
206221: libblkid: LOWPROBE: [18] LVM2_member:
206221: libblkid:   BUFFER:  reuse: off=0 len=1024 (for off=0 len=1024)
206221: libblkid:   BUFFER:  reuse: off=0 len=1024 (for off=0 len=1024)
206221: libblkid: LOWPROBE:  read: off=1024 len=1024
206221: libblkid:   BUFFER:  reuse: off=1024 len=1024 (for off=1024 len=1024)
206221: libblkid: LOWPROBE: [19] LVM1_member:
206221: libblkid:   BUFFER:  reuse: off=0 len=1024 (for off=0 len=1024)
206221: libblkid: LOWPROBE: [20] DM_snapshot_cow:
206221: libblkid:   BUFFER:  reuse: off=0 len=1024 (for off=0 len=1024)
206221: libblkid: LOWPROBE: [21] DM_verity_hash:
206221: libblkid:   BUFFER:  reuse: off=0 len=1024 (for off=0 len=1024)
206221: libblkid: LOWPROBE: [22] DM_integrity:
206221: libblkid:   BUFFER:  reuse: off=0 len=1024 (for off=0 len=1024)
206221: libblkid: LOWPROBE: [23] crypto_LUKS:
206221: libblkid: LOWPROBE:  call probefunc()
206221: libblkid:   BUFFER:  reuse: off=0 len=1024 (for off=0 len=512)
206221: libblkid: LOWPROBE: assigning VERSION [superblocks]
206221: libblkid: LOWPROBE: assigning UUID [superblocks]
206221: libblkid: LOWPROBE: assigning LABEL [superblocks]
206221: libblkid: LOWPROBE:  free value LABEL
206221: libblkid: LOWPROBE: assigning SUBSYSTEM [superblocks]
206221: libblkid: LOWPROBE: assigning TYPE [superblocks]
206221: libblkid: LOWPROBE: assigning USAGE [superblocks]
206221: libblkid: LOWPROBE: <-- leaving probing loop (type=crypto_LUKS) [SUBLKS idx=23]
206221: libblkid: LOWPROBE: freeing values list
206221: libblkid: LOWPROBE: chain safeprobe topology DISABLED
206221: libblkid: LOWPROBE: chain safeprobe partitions ENABLED
206221: libblkid: LOWPROBE: Resetting partitions values
206221: libblkid: LOWPROBE: --> starting probing loop [PARTS idx=-1]
206221: libblkid:   BUFFER:  reuse: off=0 len=1024 (for off=0 len=1024)
206221: libblkid:   BUFFER:  reuse: off=0 len=1024 (for off=0 len=1024)
206221: libblkid:   BUFFER:  reuse: off=0 len=1024 (for off=0 len=1024)
206221: libblkid:   BUFFER:  reuse: off=0 len=1024 (for off=0 len=1024)
206221: libblkid: LOWPROBE: gpt: ---> call probefunc()
206221: libblkid:   BUFFER:  reuse: off=0 len=1024 (for off=0 len=512)
206221: libblkid: LOWPROBE: gpt: <--- (rc = 1)
206221: libblkid:   BUFFER:  reuse: off=0 len=1024 (for off=0 len=1024)
206221: libblkid:   BUFFER:  reuse: off=0 len=1024 (for off=0 len=1024)
206221: libblkid: LOWPROBE: ultrix: ---> call probefunc()
206221: libblkid: LOWPROBE:  read: off=15872 len=512
206221: libblkid: LOWPROBE: ultrix: <--- (rc = 1)
206221: libblkid:   BUFFER:  reuse: off=0 len=1024 (for off=0 len=1024)
206221: libblkid:   BUFFER:  reuse: off=0 len=1024 (for off=0 len=1024)
206221: libblkid:   BUFFER:  reuse: off=0 len=1024 (for off=0 len=1024)
206221: libblkid: LOWPROBE:  read: off=28672 len=1024
206221: libblkid:   BUFFER:  reuse: off=0 len=1024 (for off=0 len=1024)
206221: libblkid:   BUFFER:  reuse: off=0 len=1024 (for off=0 len=1024)
206221: libblkid: LOWPROBE: atari: ---> call probefunc()
206221: libblkid:   BUFFER:  reuse: off=0 len=1024 (for off=0 len=512)
206221: libblkid: LOWPROBE: atari: <--- (rc = 1)
206221: libblkid: LOWPROBE: <-- leaving probing loop (failed=1) [PARTS idx=12]
206221: libblkid: LOWPROBE: parts: start probing for partition entry
206221: libblkid:    DEVNO: found devno 0x0830 as /dev/sdd
206221: libblkid: LOWPROBE: allocate a wholedisk probe
206221: libblkid: LOWPROBE: allocate a new probe
206221: libblkid: LOWPROBE: zeroize wiper
206221: libblkid: LOWPROBE: ready for low-probing, offset=0, size=256060514304, zonesize=0
206221: libblkid: LOWPROBE: whole-disk: YES, regfile: NO
206221: libblkid: LOWPROBE: partlist reset
206221: libblkid: LOWPROBE: parts: initialized partitions list (size=0)
206221: libblkid: LOWPROBE: --> starting probing loop [PARTS idx=-1]
206221: libblkid: LOWPROBE:  read: off=0 len=1024
206221: libblkid:   BUFFER:  reuse: off=0 len=1024 (for off=0 len=1024)
206221: libblkid:   BUFFER:  reuse: off=0 len=1024 (for off=0 len=1024)
206221: libblkid:   BUFFER:  reuse: off=0 len=1024 (for off=0 len=1024)
206221: libblkid: LOWPROBE:  magic sboff=510, kboff=0
206221: libblkid: LOWPROBE: dos: ---> call probefunc()
206221: libblkid:   BUFFER:  reuse: off=0 len=1024 (for off=0 len=512)
206221: libblkid: LOWPROBE: probably GPT -- ignore
206221: libblkid: LOWPROBE: dos: <--- (rc = 1)
206221: libblkid: LOWPROBE: gpt: ---> call probefunc()
206221: libblkid:   BUFFER:  reuse: off=0 len=1024 (for off=0 len=512)
206221: libblkid: LOWPROBE:  #1 valid PMBR partition
206221: libblkid: LOWPROBE:  checking for GPT header at 1
206221: libblkid:   BUFFER:  reuse: off=0 len=1024 (for off=512 len=512)
206221: libblkid: LOWPROBE:  read: off=1024 len=16384
206221: libblkid: LOWPROBE: parts: create a new partition table (type=gpt, offset=512)
206221: libblkid: LOWPROBE: parts: add partition (start=2048, size=41943040)
206221: libblkid: LOWPROBE: parts: add partition (start=41945088, size=458172416)
206221: libblkid: LOWPROBE: gpt: <--- (rc = 0)
206221: libblkid: LOWPROBE: <-- leaving probing loop (type=gpt) [PARTS idx=4]
206221: libblkid: LOWPROBE: partitions probe done [rc=0]
206221: libblkid: LOWPROBE: returning partitions binary data
206221: libblkid: LOWPROBE: trying to convert devno 0x832 to partition
206221: libblkid: LOWPROBE: searching by offset/size
206221: libblkid: LOWPROBE: assigning PART_ENTRY_SCHEME [partitions]
206221: libblkid: LOWPROBE: assigning PART_ENTRY_UUID [partitions]
206221: libblkid: LOWPROBE: assigning PART_ENTRY_TYPE [partitions]
206221: libblkid: LOWPROBE: assigning PART_ENTRY_NUMBER [partitions]
206221: libblkid: LOWPROBE: assigning PART_ENTRY_OFFSET [partitions]
206221: libblkid: LOWPROBE: assigning PART_ENTRY_SIZE [partitions]
206221: libblkid: LOWPROBE: assigning PART_ENTRY_DISK [partitions]
206221: libblkid: LOWPROBE: parts: end probing for partition entry [success]
206221: libblkid: LOWPROBE: partitions probe done [rc=0]
206221: libblkid: LOWPROBE: end probe
206221: libblkid: LOWPROBE: zeroize wiper
206221: libblkid: LOWPROBE: returning VERSION value
206221: libblkid: LOWPROBE: returning UUID value
206221: libblkid: LOWPROBE: returning SUBSYSTEM value
206221: libblkid: LOWPROBE: returning TYPE value
206221: libblkid: LOWPROBE: returning USAGE value
206221: libblkid: LOWPROBE: returning PART_ENTRY_SCHEME value
206221: libblkid: LOWPROBE: returning PART_ENTRY_UUID value
206221: libblkid: LOWPROBE: returning PART_ENTRY_TYPE value
206221: libblkid: LOWPROBE: returning PART_ENTRY_NUMBER value
206221: libblkid: LOWPROBE: returning PART_ENTRY_OFFSET value
206221: libblkid: LOWPROBE: returning PART_ENTRY_SIZE value
206221: libblkid: LOWPROBE: returning PART_ENTRY_DISK value
/dev/sdd2: VERSION="2" UUID="a918f1d0-f1de-44f5-9d93-ce9dc15cc2c7" SUBSYSTEM="HW-OPAL" TYPE="crypto_LUKS" USAGE="crypto" PART_ENTRY_SCHEME="gpt" PART_ENTRY_UUID="39ed5135-46e4-ca44-837e-da3c0781367b" PART_ENTRY_TYPE="0fc63daf-8483-4772-8e79-3d69d8477de4" PART_ENTRY_NUMBER="2" PART_ENTRY_OFFSET="41945088" PART_ENTRY_SIZE="458172416" PART_ENTRY_DISK="8:48"
206221: libblkid:   BUFFER: Resetting probing buffers
206221: libblkid:   BUFFER:  remove buffer: [off=0, len=256]
206221: libblkid:   BUFFER:  remove buffer: [off=4096, len=256]
206221: libblkid:   BUFFER:  remove buffer: [off=4096, len=1024]
206221: libblkid:   BUFFER:  remove buffer: [off=0, len=1024]
206221: libblkid:   BUFFER:  remove buffer: [off=1024, len=1024]
206221: libblkid:   BUFFER:  remove buffer: [off=15872, len=512]
206221: libblkid:   BUFFER:  remove buffer: [off=28672, len=1024]
206221: libblkid: LOWPROBE:  buffers summary: 5120 bytes by 7 read() calls
206221: libblkid: LOWPROBE: resetting results
206221: libblkid: LOWPROBE:  free value VERSION
206221: libblkid: LOWPROBE:  free value UUID
206221: libblkid: LOWPROBE:  free value SUBSYSTEM
206221: libblkid: LOWPROBE:  free value TYPE
206221: libblkid: LOWPROBE:  free value USAGE
206221: libblkid: LOWPROBE:  free value PART_ENTRY_SCHEME
206221: libblkid: LOWPROBE:  free value PART_ENTRY_UUID
206221: libblkid: LOWPROBE:  free value PART_ENTRY_TYPE
206221: libblkid: LOWPROBE:  free value PART_ENTRY_NUMBER
206221: libblkid: LOWPROBE:  free value PART_ENTRY_OFFSET
206221: libblkid: LOWPROBE:  free value PART_ENTRY_SIZE
206221: libblkid: LOWPROBE:  free value PART_ENTRY_DISK
206221: libblkid:   BUFFER: Resetting probing buffers
206221: libblkid:   BUFFER:  remove buffer: [off=0, len=1024]
206221: libblkid:   BUFFER:  remove buffer: [off=1024, len=16384]
206221: libblkid: LOWPROBE:  buffers summary: 17408 bytes by 2 read() calls
206221: libblkid: LOWPROBE: free probe
206221: libblkid: LOWPROBE: free probe

Signed-off-by: Luca Boccassi <bluca@debian.org>
16 months agomount: add rootcontext=@target
Christian Göttsche [Tue, 21 Feb 2023 14:29:59 +0000 (15:29 +0100)] 
mount: add rootcontext=@target

Add a special value for rootcontext=, namely `@target`, to set the root
context of the new filesystem to the current context of the target
mountpoint.  Useful for in-memory filesystems, like tmpfs and ramfs.

Closes: #1830
16 months agolibmount: declare array of LSM options const
Christian Göttsche [Tue, 21 Feb 2023 14:28:45 +0000 (15:28 +0100)] 
libmount: declare array of LSM options const

16 months agoMerge branch 'lsfd-tcp6' of https://github.com/masatake/util-linux
Karel Zak [Tue, 21 Feb 2023 12:01:47 +0000 (13:01 +0100)] 
Merge branch 'lsfd-tcp6' of https://github.com/masatake/util-linux

* 'lsfd-tcp6' of https://github.com/masatake/util-linux:
  lsfd: use PRIu16 instead of SCNu16 in xasprintf
  lsfd: specify variables instead of types in sizeof operator
  lsfd: (test) add a case for TCPv6 sockets
  tests: (mkfds) add tcp6 factory
  lsfd: (man) write about TCP6 related columns
  lsfd: use extra information loaded from /proc/net/tcp6
  lsfd: (man) fix typos

16 months agolsfd: use PRIu16 instead of SCNu16 in xasprintf
Masatake YAMATO [Mon, 20 Feb 2023 15:19:19 +0000 (00:19 +0900)] 
lsfd: use PRIu16 instead of SCNu16 in xasprintf

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
16 months agoMerge branch 'rpmatch' of https://github.com/t-8ch/util-linux
Karel Zak [Mon, 20 Feb 2023 12:42:23 +0000 (13:42 +0100)] 
Merge branch 'rpmatch' of https://github.com/t-8ch/util-linux

* 'rpmatch' of https://github.com/t-8ch/util-linux:
  fdisk: document expected answers to quit message
  more: drop unused #include "rpmatch.h"

16 months agocal: (man) add example for colors
Karel Zak [Mon, 20 Feb 2023 12:41:07 +0000 (13:41 +0100)] 
cal: (man) add example for colors

Signed-off-by: Karel Zak <kzak@redhat.com>
16 months agoMerge branch 'cal-colors-man' of https://github.com/t-8ch/util-linux
Karel Zak [Mon, 20 Feb 2023 12:31:16 +0000 (13:31 +0100)] 
Merge branch 'cal-colors-man' of https://github.com/t-8ch/util-linux

* 'cal-colors-man' of https://github.com/t-8ch/util-linux:
  cal: (man) document colorscheme

16 months agowhereis: (man) mark example section
Karel Zak [Mon, 20 Feb 2023 12:30:07 +0000 (13:30 +0100)] 
whereis: (man) mark example section

Signed-off-by: Karel Zak <kzak@redhat.com>
16 months agofdisk: document expected answers to quit message
Thomas Weißschuh [Sun, 19 Feb 2023 16:09:43 +0000 (16:09 +0000)] 
fdisk: document expected answers to quit message

Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
16 months agomore: drop unused #include "rpmatch.h"
Thomas Weißschuh [Sun, 19 Feb 2023 16:09:11 +0000 (16:09 +0000)] 
more: drop unused #include "rpmatch.h"

Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
16 months agocal: (man) document colorscheme
Thomas Weißschuh [Sat, 18 Feb 2023 22:59:33 +0000 (22:59 +0000)] 
cal: (man) document colorscheme

Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
16 months agowhereis: (man) fix example formatting
Jakub Wilk [Sat, 18 Feb 2023 20:35:55 +0000 (21:35 +0100)] 
whereis: (man) fix example formatting

Add missing newline between the two commands.

16 months agolsfd: specify variables instead of types in sizeof operator
Masatake YAMATO [Mon, 13 Feb 2023 16:24:33 +0000 (01:24 +0900)] 
lsfd: specify variables instead of types in sizeof operator

Suggested-by: Thomas Weißschuh <thomas@t-8ch.de>
Signed-off-by: Masatake YAMATO <yamato@redhat.com>
16 months agolsfd: (test) add a case for TCPv6 sockets
Masatake YAMATO [Mon, 13 Feb 2023 14:54:14 +0000 (23:54 +0900)] 
lsfd: (test) add a case for TCPv6 sockets

16 months agotests: (mkfds) add tcp6 factory
Masatake YAMATO [Mon, 13 Feb 2023 14:37:44 +0000 (23:37 +0900)] 
tests: (mkfds) add tcp6 factory

16 months agolsfd: (man) write about TCP6 related columns
Masatake YAMATO [Mon, 13 Feb 2023 13:48:28 +0000 (22:48 +0900)] 
lsfd: (man) write about TCP6 related columns

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
16 months agolsfd: use extra information loaded from /proc/net/tcp6
Masatake YAMATO [Fri, 3 Feb 2023 05:03:23 +0000 (14:03 +0900)] 
lsfd: use extra information loaded from /proc/net/tcp6

Example output:

  # ./lsfd -Q '(TYPE == "TCPv6") and ((COMMAND == "sshd") or (COMMAND == "test_mkfds"))'
  COMMAND       PID USER ASSOC MODE  TYPE SOURCE MNTID   INODE NAME
  sshd         1137 root     4  rw- TCPv6 sockfs     9   34689 state=listen laddr=[::]:22
  test_mkfds 716926  jet     3  rw- TCPv6 sockfs     9 6042073 state=listen laddr=[::1]:12345
  test_mkfds 716926  jet     4  rw- TCPv6 sockfs     9 6042074 state=established laddr=[::1]:23456 raddr=[::1]:12345
  test_mkfds 716926  jet     5  rw- TCPv6 sockfs     9 6042075 state=established laddr=[::1]:12345 raddr=[::1]:23456

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
16 months agolsfd: (man) fix typos
Masatake YAMATO [Mon, 13 Feb 2023 13:38:53 +0000 (22:38 +0900)] 
lsfd: (man) fix typos

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
16 months agocal: add workday and weekday colors
Karel Zak [Fri, 17 Feb 2023 13:33:26 +0000 (14:33 +0100)] 
cal: add workday and weekday colors

 echo -e 'weekend 35\ntoday 1;41\nheader yellow' > $HOME/.config/terminal-colors.d/cal.scheme
 cal -m
`
Signed-off-by: Karel Zak <kzak@redhat.com>
16 months agoMerge branch 'cal/colors' of https://github.com/t-8ch/util-linux
Karel Zak [Fri, 17 Feb 2023 13:44:19 +0000 (14:44 +0100)] 
Merge branch 'cal/colors' of https://github.com/t-8ch/util-linux

* 'cal/colors' of https://github.com/t-8ch/util-linux:
  cal: convert existing highlight logic to color lib
  lib/colors: introduce color_get_disable_sequence()
  cal: use escape codes from color-names.h
  cal: add test for vertical week color
  cal: add test for vertical colors

16 months agoMerge branch 'kernel-doc-links' of https://github.com/nl6720/util-linux
Karel Zak [Fri, 17 Feb 2023 10:45:27 +0000 (11:45 +0100)] 
Merge branch 'kernel-doc-links' of https://github.com/nl6720/util-linux

* 'kernel-doc-links' of https://github.com/nl6720/util-linux:
  documentation: link to HTML versions of kernel docs on docs.kernel.org

16 months agoMerge branch 'lsfd-unix-including-spaces-in-path' of https://github.com/masatake...
Karel Zak [Fri, 17 Feb 2023 10:43:51 +0000 (11:43 +0100)] 
Merge branch 'lsfd-unix-including-spaces-in-path' of https://github.com/masatake/util-linux

* 'lsfd-unix-including-spaces-in-path' of https://github.com/masatake/util-linux:
  lsfd: read the UNIX socket path including white spaces correctly
  lsfd: prepare enough large buffer when reading /proc/net/unix

16 months agotest_mkfds: add missing terminator of the option spec list
Masatake YAMATO [Thu, 16 Feb 2023 19:03:49 +0000 (04:03 +0900)] 
test_mkfds: add missing terminator of the option spec list

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
16 months agolibmount: add fsconfig() btrfs workaround
Karel Zak [Thu, 16 Feb 2023 12:44:24 +0000 (13:44 +0100)] 
libmount: add fsconfig() btrfs workaround

The new kernel mount API is not properly implemented in all FS
drivers. See strace output:

fsconfig(3, FSCONFIG_SET_STRING, "source", "/dev/sda", 0) = 0
fsconfig(3, FSCONFIG_SET_STRING, "context", "system_u:object_r:root_t:s0", 0) = 0
fsconfig(3, FSCONFIG_CMD_CREATE, NULL, NULL, 0) = -1 EINVAL (Invalid argument)

Reported-by: Shinichiro Kawasaki <shinichiro.kawasaki@wdc.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
16 months agocal: convert existing highlight logic to color lib
Thomas Weißschuh [Wed, 15 Feb 2023 16:13:58 +0000 (16:13 +0000)] 
cal: convert existing highlight logic to color lib

See #2053

Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
16 months agolib/colors: introduce color_get_disable_sequence()
Thomas Weißschuh [Wed, 15 Feb 2023 17:29:50 +0000 (17:29 +0000)] 
lib/colors: introduce color_get_disable_sequence()

Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
16 months agocal: use escape codes from color-names.h
Thomas Weißschuh [Wed, 15 Feb 2023 17:23:16 +0000 (17:23 +0000)] 
cal: use escape codes from color-names.h

Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
16 months agocal: add test for vertical week color
Thomas Weißschuh [Wed, 15 Feb 2023 19:20:27 +0000 (19:20 +0000)] 
cal: add test for vertical week color

Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
16 months agocal: add test for vertical colors
Thomas Weißschuh [Wed, 15 Feb 2023 18:54:10 +0000 (18:54 +0000)] 
cal: add test for vertical colors

Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
16 months agolibmount: support "recursive" argument for VFS attributes
Karel Zak [Wed, 15 Feb 2023 13:30:58 +0000 (14:30 +0100)] 
libmount: support "recursive" argument for VFS attributes

 mount  -o bind,ro=recursive,nosuid /foo /bar

sets all sub-mount to read-only, but only /bar will be nosuid.

Addresses: https://github.com/util-linux/util-linux/issues/1501
Signed-off-by: Karel Zak <kzak@redhat.com>
16 months agodocumentation: link to HTML versions of kernel docs on docs.kernel.org
nl6720 [Wed, 15 Feb 2023 13:28:42 +0000 (15:28 +0200)] 
documentation: link to HTML versions of kernel docs on docs.kernel.org

16 months agolsfd: read the UNIX socket path including white spaces correctly
Masatake YAMATO [Mon, 13 Feb 2023 19:03:27 +0000 (04:03 +0900)] 
lsfd: read the UNIX socket path including white spaces correctly

The original code uses '%s' scanf specifier to read lines in /proc/net/unix.
If white space is included in a path, lsfd could read only the first word of the path.
This commit fixes this bug.

Specifying the maximum length of path is suggested by Karel Zak <kzak@redhat.com>.

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
16 months agoinclude: improve statx fallback
Karel Zak [Tue, 14 Feb 2023 11:04:41 +0000 (12:04 +0100)] 
include: improve statx fallback

Addresses: https://github.com/util-linux/util-linux/pull/2065
Signed-off-by: Karel Zak <kzak@redhat.com>
16 months agolsfd: prepare enough large buffer when reading /proc/net/unix
Masatake YAMATO [Mon, 13 Feb 2023 18:59:35 +0000 (03:59 +0900)] 
lsfd: prepare enough large buffer when reading /proc/net/unix

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
16 months agolast: use full size of the username
Karel Zak [Mon, 13 Feb 2023 15:22:23 +0000 (16:22 +0100)] 
last: use full size of the username

utmp uses 32 bytes for username, last(1) truncates it to 31 when calls getpwnam().

Reported-by: Radka Skvarilova <rskvaril@redhat.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
16 months agoinclude: cleanup close_range fallback
Karel Zak [Mon, 13 Feb 2023 13:28:08 +0000 (14:28 +0100)] 
include: cleanup close_range fallback

* let's use && operator rather than if-if
* define HAVE_CLOSE_RANGE only if callback is really avalable

Signed-off-by: Karel Zak <kzak@redhat.com>
16 months agoinclude: add fallback for statx
Karel Zak [Mon, 13 Feb 2023 13:25:26 +0000 (14:25 +0100)] 
include: add fallback for statx

Fixes: https://github.com/util-linux/util-linux/pull/2065
Signed-off-by: Karel Zak <kzak@redhat.com>
16 months agoMerge branch 'waitpid/cleanup' of https://github.com/t-8ch/util-linux
Karel Zak [Mon, 13 Feb 2023 12:42:05 +0000 (13:42 +0100)] 
Merge branch 'waitpid/cleanup' of https://github.com/t-8ch/util-linux

* 'waitpid/cleanup' of https://github.com/t-8ch/util-linux:
  waitpid: prettify options terminator
  waitpid: delete trailing whitespace
  waipid: print error message without pids
  waitpid: fix help alignment

16 months agoMerge branch 'lsfd-raw' of https://github.com/masatake/util-linux
Karel Zak [Mon, 13 Feb 2023 12:40:48 +0000 (13:40 +0100)] 
Merge branch 'lsfd-raw' of https://github.com/masatake/util-linux

* 'lsfd-raw' of https://github.com/masatake/util-linux:
  lsfd: remove redundant parentheses surrounding return values
  lsfd: rename tcp_state to l4_state and use the type instead of unsigned int
  lsfd: use SCNu16 format specifier instead of cast operations (unsigned short)
  lsfd: use extra information loaded from /proc/net/raw
  lsfd: make TCP and UDP related code L3 protocol neutral
  lsfd: refactor the usage of tcp_decode_state()
  lsfd: move the field representing connection state from tcp_xinfo to the L4 abstract layer
  lsfd: add methods to the L4 abstract layer for hidding differences in L3 protocols
  lsfd: implement code scanning lines in /proc/net/$proto as a method in the L4 abstract layer
  lsfd: introduce L4 abstract layer stacked on IP and IP6
  lsfd: fix wrong identifier namings (L3->L4)
  lsfd: move kernel32_to_cpu() front in the source file
  lsfd: remove an unused field from struct sock_xinfo_class
  lsfd: (man) fix the description of NAME fields for TCP and UDP sockets
  lsfd: adjust coding style, insert space after "switch" keyword

16 months agowaitpid: prettify options terminator
Thomas Weißschuh [Sat, 11 Feb 2023 04:29:01 +0000 (04:29 +0000)] 
waitpid: prettify options terminator

Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
16 months agowaitpid: delete trailing whitespace
Thomas Weißschuh [Sat, 11 Feb 2023 04:25:20 +0000 (04:25 +0000)] 
waitpid: delete trailing whitespace

Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
16 months agowaipid: print error message without pids
Thomas Weißschuh [Sat, 11 Feb 2023 04:24:41 +0000 (04:24 +0000)] 
waipid: print error message without pids

Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
16 months agowaitpid: fix help alignment
Thomas Weißschuh [Sat, 11 Feb 2023 04:24:25 +0000 (04:24 +0000)] 
waitpid: fix help alignment

Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
16 months agolsfd: remove redundant parentheses surrounding return values
Masatake YAMATO [Fri, 10 Feb 2023 04:38:00 +0000 (13:38 +0900)] 
lsfd: remove redundant parentheses surrounding return values

Suggested-by: Thomas Weißschuh <thomas@t-8ch.de>
Signed-off-by: Masatake YAMATO <yamato@redhat.com>
16 months agolsfd: rename tcp_state to l4_state and use the type instead of unsigned int
Masatake YAMATO [Fri, 10 Feb 2023 04:34:13 +0000 (13:34 +0900)] 
lsfd: rename tcp_state to l4_state and use the type instead of unsigned int

Suggested-by: Thomas Weißschuh <thomas@t-8ch.de>
Signed-off-by: Masatake YAMATO <yamato@redhat.com>
16 months agolsfd: use SCNu16 format specifier instead of cast operations (unsigned short)
Masatake YAMATO [Fri, 10 Feb 2023 01:11:17 +0000 (10:11 +0900)] 
lsfd: use SCNu16 format specifier instead of cast operations (unsigned short)

Suggested-by: Thomas Weißschuh <thomas@t-8ch.de>
Signed-off-by: Masatake YAMATO <yamato@redhat.com>
16 months agolsfd: use extra information loaded from /proc/net/raw
Masatake YAMATO [Wed, 1 Feb 2023 12:53:57 +0000 (21:53 +0900)] 
lsfd: use extra information loaded from /proc/net/raw

RAW.PROTOCOL field is added.

Thomas Weißschuh <thomas@t-8ch.de> suggested making the test
script executable.

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
16 months agolsfd: make TCP and UDP related code L3 protocol neutral
Masatake YAMATO [Thu, 2 Feb 2023 18:05:23 +0000 (03:05 +0900)] 
lsfd: make TCP and UDP related code L3 protocol neutral

So we can reuse the current L4 code when supporting IPv6.

Signed-off-by: Masatake YAMATO <yamato@redhat.com>