]> git.ipfire.org Git - thirdparty/util-linux.git/log
thirdparty/util-linux.git
2 months agotests: (lsfd::mkfds-inotify) consider environments not having / as a mount point
Masatake YAMATO [Sat, 2 Mar 2024 21:51:15 +0000 (06:51 +0900)] 
tests: (lsfd::mkfds-inotify) consider environments not having / as a mount point

Close #2819.

In the original test case, test_mkfds monitored / and /etc/fstab.

As reported in #2819, if a test platform doesn't have / as a
mount point, the test case doesn't work.

So we use /proc and /proc/cmdnline instead.

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
Acked-by: Chris Hofstaedtler <zeha@debian.org>
3 months agodocs: add note about stable branches
Karel Zak [Thu, 29 Feb 2024 22:00:10 +0000 (23:00 +0100)] 
docs: add note about stable branches

Signed-off-by: Karel Zak <kzak@redhat.com>
3 months agolslocks: fix buffer overflow
Karel Zak [Thu, 29 Feb 2024 19:43:35 +0000 (20:43 +0100)] 
lslocks: fix buffer overflow

* don't use memset() to init variables
* use xreaddir() to reduce code
* use ssize_t for readlinkat() return value to avoid buffer overflow

Signed-off-by: Karel Zak <kzak@redhat.com>
(cherry picked from commit f030775ffeaa8627c88434f7d0cba1a454aa0ffa)

3 months agosetterm: Document behavior of redirection
Stanislav Brabec [Wed, 28 Feb 2024 14:06:14 +0000 (15:06 +0100)] 
setterm: Document behavior of redirection

Debugging an error of setterm, I realized that setterm --powerdown operates
on stdout but setterm --powersave operates on stdin. Such unexpected
behavior should be documented.

I prefer a less accurate generic "always redirect both stdin and stdout"
over recommending of the correct I/O stream for each option separately.

Signed-off-by: Stanislav Brabec <sbrabec@suse.cz>
3 months agomeson: fix LIBBLKID_VERSION definition
Karel Zak [Thu, 29 Feb 2024 10:09:11 +0000 (11:09 +0100)] 
meson: fix LIBBLKID_VERSION definition

Fixes: https://github.com/util-linux/util-linux/issues/2802
Signed-off-by: Karel Zak <kzak@redhat.com>
3 months agoMerge branch 'lsfd--btrfs' of https://github.com/masatake/util-linux
Karel Zak [Thu, 29 Feb 2024 08:50:59 +0000 (09:50 +0100)] 
Merge branch 'lsfd--btrfs' of https://github.com/masatake/util-linux

* 'lsfd--btrfs' of https://github.com/masatake/util-linux:
  tests: (lsfd::mkfds-inotify-btrfs) test INOTIFY.INODES cooked output
  lsfd: extend nodev table to decode "btrfs" on SOURCE column
  lsfd: (refactor) rename a member of struct proc
  lsfd: (refactor) rename a local variable and a parameter
  lsfd: (refactor) split the function processing mountinfo file
  lsfd: (refactor) store a mnt_namespace object to struct process
  lsfd: (refactor) use a binary tree as the implementation for mnt_namespaces
  lsfd: read /proc/$pid/ns/mnt earlier
  lsfd: (refactor) rename add_nodevs to read_mountinfo
  lsfd: make the way to read /proc/$pid/mountinfo robust
  lsfd: (cosmetic) normalize whitespaces

3 months agobuild-sys: introduce localstatedir
Karel Zak [Wed, 28 Feb 2024 12:07:39 +0000 (13:07 +0100)] 
build-sys: introduce localstatedir

The directory is already used by ./configure.ac, but it has never been
exported to the Makefile.am or used by meson.

Signed-off-by: Karel Zak <kzak@redhat.com>
Signed-off-by: Christian Hesse <mail@eworm.de>
3 months agolastlog2: rename tmpfiles
Christian Hesse [Tue, 27 Feb 2024 21:36:13 +0000 (22:36 +0100)] 
lastlog2: rename tmpfiles

Signed-off-by: Christian Hesse <mail@eworm.de>
3 months agotmpfiles: depend on systemd...
Christian Hesse [Thu, 22 Feb 2024 07:50:52 +0000 (08:50 +0100)] 
tmpfiles: depend on systemd...

... as systemd-tmpfiles is required to handle this.

Signed-off-by: Christian Hesse <mail@eworm.de>
3 months agouuidd.rc: create localstatedir in init script
Christian Hesse [Tue, 27 Feb 2024 12:07:30 +0000 (13:07 +0100)] 
uuidd.rc: create localstatedir in init script

Signed-off-by: Christian Hesse <mail@eworm.de>
3 months agotmpfiles: add and install for uuidd, generate /run/uuidd & /var/lib/libuuid
Christian Hesse [Thu, 22 Feb 2024 07:48:55 +0000 (08:48 +0100)] 
tmpfiles: add and install for uuidd, generate /run/uuidd & /var/lib/libuuid

These directories are requird for uuidd, so let systemd-tmpfiles create them.

Signed-off-by: Christian Hesse <mail@eworm.de>
3 months agodocs: move GPL-2.0 license text to Docimentation directory
Karel Zak [Wed, 28 Feb 2024 13:37:25 +0000 (14:37 +0100)] 
docs: move GPL-2.0 license text to Docimentation directory

Signed-off-by: Karel Zak <kzak@redhat.com>
3 months agodocs: use proper XSPD identifier for GPL-2.0
Karel Zak [Wed, 28 Feb 2024 12:22:51 +0000 (13:22 +0100)] 
docs: use proper XSPD identifier for GPL-2.0

Signed-off-by: Karel Zak <kzak@redhat.com>
3 months agoMerge branch 'PR/hexdump-overflow' of github.com:karelzak/util-linux-work
Karel Zak [Wed, 28 Feb 2024 11:16:25 +0000 (12:16 +0100)] 
Merge branch 'PR/hexdump-overflow' of github.com:karelzak/util-linux-work

* 'PR/hexdump-overflow' of github.com:karelzak/util-linux-work:
  hexdump: check blocksize when display data

3 months agoMerge branch 'enosys/dump' of https://github.com/t-8ch/util-linux
Karel Zak [Wed, 28 Feb 2024 10:49:51 +0000 (11:49 +0100)] 
Merge branch 'enosys/dump' of https://github.com/t-8ch/util-linux

* 'enosys/dump' of https://github.com/t-8ch/util-linux:
  enosys: allow dumping to file
  codeql: don't report world-writable files

3 months agoMerge branch 'PR/libmount-errmsg' of github.com:karelzak/util-linux-work
Karel Zak [Wed, 28 Feb 2024 10:49:37 +0000 (11:49 +0100)] 
Merge branch 'PR/libmount-errmsg' of github.com:karelzak/util-linux-work

* 'PR/libmount-errmsg' of github.com:karelzak/util-linux-work:
  libmount: report kernel message from new API

3 months agoenosys: allow dumping to file
Thomas Weißschuh [Thu, 22 Feb 2024 21:54:41 +0000 (22:54 +0100)] 
enosys: allow dumping to file

Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
3 months agocodeql: don't report world-writable files
Thomas Weißschuh [Tue, 27 Feb 2024 19:54:33 +0000 (20:54 +0100)] 
codeql: don't report world-writable files

Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
3 months agohexdump: check blocksize when display data
Karel Zak [Tue, 27 Feb 2024 17:38:02 +0000 (18:38 +0100)] 
hexdump: check blocksize when display data

hexdump(1) stores input to buffer and apply format unit when prints
the output. The unit can move pointer which points to the buffer, but
code does not check for limits.

Fixes: https://github.com/util-linux/util-linux/issues/2806
Signed-off-by: Karel Zak <kzak@redhat.com>
3 months agoMerge branch 'PR/dmesg-2807' of github.com:karelzak/util-linux-work
Karel Zak [Tue, 27 Feb 2024 15:10:22 +0000 (16:10 +0100)] 
Merge branch 'PR/dmesg-2807' of github.com:karelzak/util-linux-work

* 'PR/dmesg-2807' of github.com:karelzak/util-linux-work:
  dmesg: fix wrong size calculation

3 months agolibmount: report kernel message from new API
Karel Zak [Mon, 26 Feb 2024 11:44:10 +0000 (12:44 +0100)] 
libmount: report kernel message from new API

This is a very minimalistic implementation for v2.40 designed to print
error messages from the kernel. It exclusively displays errors, and
the patch does not introduce any new library interface for this
purpose. Instead, it simply replaces hardcoded messages within
libmount with kernel messages.

It's worth noting that the final implementation will necessitate
per-hook error handling in libmount and likely a new library API to
access other types of messages (warnings, notices, etc.).

Signed-off-by: Karel Zak <kzak@redhat.com>
3 months agoMerge branch 'patch-1' of https://github.com/ThomasKaiser/util-linux
Karel Zak [Tue, 27 Feb 2024 13:28:48 +0000 (14:28 +0100)] 
Merge branch 'patch-1' of https://github.com/ThomasKaiser/util-linux

* 'patch-1' of https://github.com/ThomasKaiser/util-linux:
  Adding Neoverse-V3/-N3 ARM cores

3 months agomeson: avoid future-deprecated feature
Thomas Weißschuh [Mon, 26 Feb 2024 19:01:45 +0000 (20:01 +0100)] 
meson: avoid future-deprecated feature

Avoid the following message from meson:

  NOTICE: Future-deprecated features used:
   * 1.1.0: {'"boolean option" keyword argument "value" of type str'}

Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
3 months agodmesg: fix wrong size calculation
Karel Zak [Mon, 26 Feb 2024 13:30:55 +0000 (14:30 +0100)] 
dmesg: fix wrong size calculation

* don't use string based function strspn() if work with non-zero terminated
  buffer

* make sure that message size is calculated from within buffer pointers

Fixes: https://github.com/util-linux/util-linux/issues/2807
Signed-off-by: Karel Zak <kzak@redhat.com>
3 months agoAdding Neoverse-V3/-N3 ARM cores
Thomas Kaiser [Mon, 26 Feb 2024 11:20:11 +0000 (12:20 +0100)] 
Adding Neoverse-V3/-N3 ARM cores

3 months agoMerge branch 'meson/gnu-source' of https://github.com/t-8ch/util-linux
Karel Zak [Mon, 26 Feb 2024 08:51:54 +0000 (09:51 +0100)] 
Merge branch 'meson/gnu-source' of https://github.com/t-8ch/util-linux

* 'meson/gnu-source' of https://github.com/t-8ch/util-linux:
  meson: run compiler checks with -D_GNU_SOURCE when necessary

3 months agolibmount: don't hold write fd to mounted device
Jan Kara [Wed, 21 Feb 2024 17:30:50 +0000 (18:30 +0100)] 
libmount: don't hold write fd to mounted device

Avoid holding writeable fd to a loop device that is being mounted. In
the hardened configurations (CONFIG_BLK_DEV_WRITE_MOUNTED = n) the
kernel wants to make sure nobody else has the block device writeably
open when mounting so this makes the mount fail.

Reported-by: JunChao Sun <sunjunchao2870@gmail.com>
Signed-off-by: Jan Kara <jack@suse.cz>
Acked-by: Christian Brauner <brauner@kernel.org>
3 months agotests: (lsfd::mkfds-inotify-btrfs) test INOTIFY.INODES cooked output
Masatake YAMATO [Sat, 24 Feb 2024 17:46:37 +0000 (02:46 +0900)] 
tests: (lsfd::mkfds-inotify-btrfs) test INOTIFY.INODES cooked output

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
3 months agolsfd: extend nodev table to decode "btrfs" on SOURCE column
Masatake YAMATO [Fri, 5 Jan 2024 05:31:46 +0000 (14:31 +0900)] 
lsfd: extend nodev table to decode "btrfs" on SOURCE column

When filling SOURCE column, lsfd decodes the name of the device where the
file object is. If the file object is sourced from a file system, lsfd
fills the column with the file system's name.

As #2349 and #2308, if the file system is btrfs, lsfd couldn't decode
the name correctly. This change and its preceding changes fix this bug.

"devnum offset" causes the trouble.  On btrfs, the device number
reported by stat syscall and proc fs are different.
For the details of "devnum offset", see "Mechanism behind the
devnum offset". About the way to fix it, see "How to adjust the output of lsfd".

Without this change:

    $ ./lsfd -Q '(ASSOC == "exe")' -p $$
    COMMAND   PID   USER ASSOC  XMODE TYPE SOURCE MNTID  INODE NAME
    zsh     19318 yamato   exe ------  REG   0:38     0 589767 /usr/bin/zsh

With this change:

    $ ./lsfd -Q '(ASSOC == "exe")' -p $$
    COMMAND   PID   USER ASSOC  XMODE TYPE SOURCE MNTID  INODE NAME
    zsh     19318 yamato   exe ------  REG  btrfs     0 589767 /usr/bin/zsh

Mechanisum behind the devnum offset
-----------------------------------
Both stat command and the inotify field in fdinfo refer to an inode.

filename_lookup(https://elixir.bootlin.com/linux/v6.2.9/source/fs/namei.c#L2495)
is the function getting the inode for a given file
name. filename_lookup returns a struct path.  Via path->detnry->inode,
the caller of filename_lookup can get the inode.

stat command calls statx system call. statx calls filename_lookup
eventually.

inotify_add_watch system call takes a file name. The inotify_add_watch
calls the filename_lookup eventually for getting the inode for the
file name.  The inode number that inotify_add_watch gets via
filename_lookup is printed in the inotify field in fdinfo.

The device number, the subject of this issue, can be obtained via
path->detnry->inode->i_sb->s_dev. Both the stat command and the
inotify field in fdinfo use the filename_lookup for getting path. If
they use the same function, why don't the device numbers match? I
monitored the device numbers obtained via
path->detnry->inode->i_sb->s_dev by inserting a systemtap probe to
filename_lookup. I saw the numbers matched.

However, the number monitored via systemtap did not match the number
printed by the stat command.  statx system call doesn't use
path->detnry->inode->i_sb->s_dev , the value obtained via
filename_lookup, directly.  statx calls vfs_statx. vfs_statx calls
vfs_getattr after calling the filename_lookup for filling struct
kstat. vfs_getattr calls inode->i_op->getattr, a file system specific
method for filling struct kstat if it is available.  btrfs has an
implementation for the method,
btrfs_getattr(https://elixir.bootlin.com/linux/v6.2.9/source/fs/btrfs/inode.c#L9007):

    stat->dev = BTRFS_I(inode)->root->anon_dev;

The dev member is overwritten with btrfs specific value.

How to adjust the output of lsfd
--------------------------------
lsfd already reads mountinfo files.

1. Get the "rawnum" and mount point

   The device numbers in a mountinfo file are raw; btrfs is not
   considered. Let's call the number "rawnum" here. When reading the
   mountinfo file, lsfd can know the mount points of btrfs.

       grep btrfs /proc/self/mountinfo
       72 1 0:35 /root / rw,relatime shared:1 - btrfs

2. Get the cooked num

   By calling "stat" system call for the mount point getting in the
   step 1, lsdf can know the device number the btrfs customizes with
   its getattr method. Let's call the device number "cookednum".

3. Make a table mapping "rawnum" to "cookednum".

4. Look up the table when printing inodes.

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
3 months agolsfd: (refactor) rename a member of struct proc
Masatake YAMATO [Fri, 5 Jan 2024 01:27:42 +0000 (10:27 +0900)] 
lsfd: (refactor) rename a member of struct proc

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
3 months agolsfd: (refactor) rename a local variable and a parameter
Masatake YAMATO [Fri, 5 Jan 2024 01:26:35 +0000 (10:26 +0900)] 
lsfd: (refactor) rename a local variable and a parameter

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
3 months agolsfd: (refactor) split the function processing mountinfo file
Masatake YAMATO [Thu, 4 Jan 2024 07:02:03 +0000 (16:02 +0900)] 
lsfd: (refactor) split the function processing mountinfo file

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
3 months agolsfd: (refactor) store a mnt_namespace object to struct process
Masatake YAMATO [Thu, 4 Jan 2024 22:59:04 +0000 (07:59 +0900)] 
lsfd: (refactor) store a mnt_namespace object to struct process

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
3 months agolsfd: (refactor) use a binary tree as the implementation for mnt_namespaces
Masatake YAMATO [Thu, 4 Jan 2024 22:35:58 +0000 (07:35 +0900)] 
lsfd: (refactor) use a binary tree as the implementation for mnt_namespaces

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
3 months agolsfd: read /proc/$pid/ns/mnt earlier
Masatake YAMATO [Wed, 3 Jan 2024 07:33:19 +0000 (16:33 +0900)] 
lsfd: read /proc/$pid/ns/mnt earlier

The change fba9898fd5b1d20a2ed350b7b542d9f8a3597a0c I introduced
unexpectedly canceled the optimization technique introduced in
a7f70ce17a925f1085bfa4b292427f8741d7e2a2 that reduced the number of
times reading /proc/$pid/mountinfo.

This change reenables the technique.

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
3 months agolsfd: (refactor) rename add_nodevs to read_mountinfo
Masatake YAMATO [Wed, 3 Jan 2024 06:54:03 +0000 (15:54 +0900)] 
lsfd: (refactor) rename add_nodevs to read_mountinfo

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
3 months agolsfd: make the way to read /proc/$pid/mountinfo robust
Masatake YAMATO [Wed, 3 Jan 2024 17:19:28 +0000 (02:19 +0900)] 
lsfd: make the way to read /proc/$pid/mountinfo robust

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
3 months agolsfd: (cosmetic) normalize whitespaces
Masatake YAMATO [Wed, 3 Jan 2024 19:57:25 +0000 (04:57 +0900)] 
lsfd: (cosmetic) normalize whitespaces

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
3 months agomeson: run compiler checks with -D_GNU_SOURCE when necessary
Thomas Weißschuh [Fri, 23 Feb 2024 07:15:32 +0000 (08:15 +0100)] 
meson: run compiler checks with -D_GNU_SOURCE when necessary

Through the addition of default_options: c_std=c99 some build-time
checks were incorrect. Explicitly add -D_GNU_SOURCE where necessary.

Fixes: 6240e4458cdf ("build: use -std=c99 and -std=c++11 by default")
Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
3 months agoMerge branch 'lastlog2_error' of https://github.com/schubi2/util-linux
Karel Zak [Thu, 22 Feb 2024 09:44:41 +0000 (10:44 +0100)] 
Merge branch 'lastlog2_error' of https://github.com/schubi2/util-linux

* 'lastlog2_error' of https://github.com/schubi2/util-linux:
  liblastlog2: Improved sqlite3 error handling

3 months agoMerge branch 'PR/more-poll' of github.com:karelzak/util-linux-work
Karel Zak [Thu, 22 Feb 2024 09:39:03 +0000 (10:39 +0100)] 
Merge branch 'PR/more-poll' of github.com:karelzak/util-linux-work

* 'PR/more-poll' of github.com:karelzak/util-linux-work:
  more: fix poll() use

3 months agoMerge branch 'PR/lastlog2-cleanup' of github.com:karelzak/util-linux-work
Karel Zak [Thu, 22 Feb 2024 09:38:25 +0000 (10:38 +0100)] 
Merge branch 'PR/lastlog2-cleanup' of github.com:karelzak/util-linux-work

* 'PR/lastlog2-cleanup' of github.com:karelzak/util-linux-work:
  lastlog2: convert check_user() to boolean-like macro
  lastlog: cleanup function definitions
  lastlog2: make longopts[] static-const
  lastlog: improve errors printing
  lastlog2: improve coding style

3 months agoenosys: add support for alternative error codes
Thomas Weißschuh [Sun, 4 Feb 2024 10:56:58 +0000 (11:56 +0100)] 
enosys: add support for alternative error codes

Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
3 months agoenosys: generalize named number parsing
Thomas Weißschuh [Sun, 4 Feb 2024 10:36:54 +0000 (11:36 +0100)] 
enosys: generalize named number parsing

[kzak@redhat.com: - resolve merge conflict in main()]

Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
3 months agoautotools: make errnos.h available without lsfd
Thomas Weißschuh [Sat, 17 Feb 2024 09:03:22 +0000 (10:03 +0100)] 
autotools: make errnos.h available without lsfd

enosys will use it.

Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
3 months agoMerge branch 'enosys/dump' of https://github.com/t-8ch/util-linux
Karel Zak [Thu, 22 Feb 2024 09:26:15 +0000 (10:26 +0100)] 
Merge branch 'enosys/dump' of https://github.com/t-8ch/util-linux

* 'enosys/dump' of https://github.com/t-8ch/util-linux:
  setpriv: (tests) add seccomp test
  setpriv: add support for seccomp filters
  enosys: add functionality to dump filter
  include: introduce seccomp.h

3 months agoliblastlog2: Improved sqlite3 error handling
Stefan Schubert [Wed, 21 Feb 2024 12:09:52 +0000 (13:09 +0100)] 
liblastlog2: Improved sqlite3 error handling

3 months agodocs: cleanup public domain license texts
Karel Zak [Wed, 21 Feb 2024 09:13:50 +0000 (10:13 +0100)] 
docs: cleanup public domain license texts

The absence of an official 'Public domain' definition is the reason
why, for example, the Fedora distribution aggregates all variants from
various projects to make them reviewable.

This commit unifies the 'Public domain' statements to make it simple.

Signed-off-by: Karel Zak <kzak@redhat.com>
3 months agomore: fix poll() use
Karel Zak [Tue, 20 Feb 2024 11:26:33 +0000 (12:26 +0100)] 
more: fix poll() use

The more(1) command utilizes signalfd() to monitor signals and reads
commands from the user via stderr (as stdin is typically used for
piping and not for user interaction).

However, the current more_poll() implementation ignores stderr. As a result,
more(1) waits on read(stderr) while completely ignoring signals. This issue
becomes evident when using commands like:

    grep foo /path/file | more

In such cases, it's only possible to exit 'more' by pressing 'q';
CTRL+C does not work.

Changes:

- Refactor more_poll() code:
  - Introduce an enum to access pfd[] items instead of using magical constants.
  - Implement a while() loop to handle EAGAIN or POLLHUP.

- Ignore stdin after POLLHUP (indicating that the pipe's peer closed).
- Ensure stderr is also checked.
- Use return codes akin to classic poll().

Note: I have doubts regarding the usability of stdin in more_poll(),
as the function is primarily used to wait for user input (via stderr)
and to monitor signals. Nevertheless, it is retained for potential use
in detecting when the pipe's peer (or the entire session) has been
terminated (see commit 68e14d3d5f4116ad3aca0e392d008645ea90cf70).

Signed-off-by: Karel Zak <kzak@redhat.com>
3 months agolastlog2: convert check_user() to boolean-like macro
Karel Zak [Tue, 20 Feb 2024 09:37:02 +0000 (10:37 +0100)] 
lastlog2: convert check_user() to boolean-like macro

Let's make simple and stupid.

Signed-off-by: Karel Zak <kzak@redhat.com>
3 months agolastlog: cleanup function definitions
Karel Zak [Tue, 20 Feb 2024 09:28:06 +0000 (10:28 +0100)] 
lastlog: cleanup function definitions

- let's make it more compatible with the rest of util-linux

- don't initialize global static variables (it's unnecessary)

Signed-off-by: Karel Zak <kzak@redhat.com>
3 months agolastlog2: make longopts[] static-const
Karel Zak [Tue, 20 Feb 2024 09:20:10 +0000 (10:20 +0100)] 
lastlog2: make longopts[] static-const

Signed-off-by: Karel Zak <kzak@redhat.com>
3 months agolastlog: improve errors printing
Karel Zak [Tue, 20 Feb 2024 09:12:19 +0000 (10:12 +0100)] 
lastlog: improve errors printing

- single exit by goto

- always print specific error (e.g. "Couldn't update login time ...")
  and then optionally generic ll2 error

Signed-off-by: Karel Zak <kzak@redhat.com>
3 months agolastlog2: improve coding style
Karel Zak [Tue, 20 Feb 2024 08:55:48 +0000 (09:55 +0100)] 
lastlog2: improve coding style

- use space around operators
- remove unnecessary line breaks from errx() calls

Signed-off-by: Karel Zak <kzak@redhat.com>
3 months agolastlog2: Don't print space if Service column is not printed
Miika Alikirri [Mon, 19 Feb 2024 10:09:13 +0000 (12:09 +0200)] 
lastlog2: Don't print space if Service column is not printed

3 months agoMerge branch 'foo' of https://github.com/emanuele6/util-linux
Karel Zak [Mon, 19 Feb 2024 09:22:11 +0000 (10:22 +0100)] 
Merge branch 'foo' of https://github.com/emanuele6/util-linux

* 'foo' of https://github.com/emanuele6/util-linux:
  docs: remove duplicated author name in namei.1.adoc

3 months agoMerge branch 'patch-2' of https://github.com/ThomasKaiser/util-linux
Karel Zak [Mon, 19 Feb 2024 09:20:42 +0000 (10:20 +0100)] 
Merge branch 'patch-2' of https://github.com/ThomasKaiser/util-linux

* 'patch-2' of https://github.com/ThomasKaiser/util-linux:
  Add Microsoft as vendor and Cobalt 100 core

3 months agoMerge branch 'meson/lslogins' of https://github.com/t-8ch/util-linux
Karel Zak [Mon, 19 Feb 2024 09:13:59 +0000 (10:13 +0100)] 
Merge branch 'meson/lslogins' of https://github.com/t-8ch/util-linux

* 'meson/lslogins' of https://github.com/t-8ch/util-linux:
  meson: fix build of lslogins with -Dbuild-liblastlog2=disabled

3 months agoMerge branch 'fix-luks-offset' of https://github.com/mbroz/util-linux
Karel Zak [Mon, 19 Feb 2024 09:13:42 +0000 (10:13 +0100)] 
Merge branch 'fix-luks-offset' of https://github.com/mbroz/util-linux

* 'fix-luks-offset' of https://github.com/mbroz/util-linux:
  libblkid: Check offset in LUKS2 header

3 months agodocs: improve howto-pull-request
Karel Zak [Mon, 19 Feb 2024 09:10:56 +0000 (10:10 +0100)] 
docs: improve howto-pull-request

* improve branch naming suggestions

* recommend GitHub, make Mailing-List optional

Signed-off-by: Karel Zak <kzak@redhat.com>
3 months agoAdd Microsoft as vendor and Cobalt 100 core
Thomas Kaiser [Sun, 18 Feb 2024 23:16:54 +0000 (00:16 +0100)] 
Add Microsoft as vendor and Cobalt 100 core

https://lore.kernel.org/linux-arm-kernel/b99a7196-011e-4f08-83ec-e63a690ab919@linux.microsoft.com/T/

3 months agodocs: remove duplicated author name in namei.1.adoc
Emanuele Torre [Sun, 18 Feb 2024 03:43:09 +0000 (04:43 +0100)] 
docs: remove duplicated author name in namei.1.adoc

This was being rendered in the man page as:

    The program was rewritten by Karel Zak Karel Zak <kzak@redhat.com>.

Instead of as:

    The program was rewritten by Karel Zak <kzak@redhat.com>.

3 months agomeson: fix build of lslogins with -Dbuild-liblastlog2=disabled
Thomas Weißschuh [Sat, 17 Feb 2024 08:54:56 +0000 (09:54 +0100)] 
meson: fix build of lslogins with -Dbuild-liblastlog2=disabled

Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
3 months agolibblkid: Check offset in LUKS2 header
Milan Broz [Fri, 16 Feb 2024 15:44:12 +0000 (16:44 +0100)] 
libblkid: Check offset in LUKS2 header

LUKS2 binary header contains offset field that describes where
the header should be located.

If this offset is not correct, blkid should tread this header
as invalid.

This patch fixes problem when both swap and LUKS headers are
present (LUKS header was swapped out) and detected LUKS header
is at a wrong offset.
As LUKS has higher priority, it confuses detection.

Signed-off-by: Milan Broz <gmazyland@gmail.com>
3 months agodocs: add hints about systemd
Karel Zak [Thu, 15 Feb 2024 09:33:42 +0000 (10:33 +0100)] 
docs: add hints about systemd

Suggested-by: Stanislav Brabec <sbrabec@suse.cz>
Signed-off-by: Karel Zak <kzak@redhat.com>
3 months agoMerge branch 'PR/dmesg-fixes' of github.com:karelzak/util-linux-work
Karel Zak [Thu, 15 Feb 2024 09:10:42 +0000 (10:10 +0100)] 
Merge branch 'PR/dmesg-fixes' of github.com:karelzak/util-linux-work

* 'PR/dmesg-fixes' of github.com:karelzak/util-linux-work:
  tests: update dmesg deltas
  dmesg: fix delta calculation
  dmesg: don't affect delta by --since

3 months agoMerge branch 'PR/meson-lastlog2' of github.com:karelzak/util-linux-work
Karel Zak [Thu, 15 Feb 2024 09:10:08 +0000 (10:10 +0100)] 
Merge branch 'PR/meson-lastlog2' of github.com:karelzak/util-linux-work

* 'PR/meson-lastlog2' of github.com:karelzak/util-linux-work:
  meson: install lastlog2.h library header file

3 months agoMerge branch 'lslogins-lastlog2' of https://github.com/schubi2/util-linux
Karel Zak [Wed, 14 Feb 2024 13:46:26 +0000 (14:46 +0100)] 
Merge branch 'lslogins-lastlog2' of https://github.com/schubi2/util-linux

* 'lslogins-lastlog2' of https://github.com/schubi2/util-linux:
  added build option login-lastlogin
  added sqlite3 to packit
  added sqlite3 to debian build
  fixed time
  unifiy test output
  cleanup tests
  cleanup tests
  fixed time-stamp
  creating lastlog2 database in the tests
  check test output
  cleanup; Added testcase for lslogins and lastlog2 DB
  lslogins: Add support for lastlog2

3 months agomeson: install lastlog2.h library header file
Karel Zak [Wed, 14 Feb 2024 08:31:34 +0000 (09:31 +0100)] 
meson: install lastlog2.h library header file

Signed-off-by: Karel Zak <kzak@redhat.com>
3 months agoMerge branch 'as-safe-maybe_final' of https://github.com/crrodriguez/util-linux
Karel Zak [Tue, 13 Feb 2024 19:08:58 +0000 (20:08 +0100)] 
Merge branch 'as-safe-maybe_final' of https://github.com/crrodriguez/util-linux

* 'as-safe-maybe_final' of https://github.com/crrodriguez/util-linux:
  Save and restore errno on signal handlers

3 months agoRevert "libmount: don't canonicalize symlinks for bind operation"
Karel Zak [Tue, 13 Feb 2024 18:54:08 +0000 (19:54 +0100)] 
Revert "libmount: don't canonicalize symlinks for bind operation"

This reverts commit 1b2d8187360157b00b47f52522fc039d82e34e6b.

Unfortunately, this new feature introduces a regression. We need a
better solution (probably mount options option to enable the feature)
rather than enable it by default.

Fixes: https://github.com/util-linux/util-linux/issues/2773
References: https://github.com/util-linux/util-linux/issues/2370

3 months agotests: update dmesg deltas
Karel Zak [Tue, 13 Feb 2024 18:09:38 +0000 (19:09 +0100)] 
tests: update dmesg deltas

See commit a355f2b78a8c486f7721371d9010f4f1bafcee00.

Signed-off-by: Karel Zak <kzak@redhat.com>
3 months agodmesg: fix delta calculation
Karel Zak [Tue, 13 Feb 2024 09:56:41 +0000 (10:56 +0100)] 
dmesg: fix delta calculation

Old:
./dmesg --nopager --color=never --decode --time-format delta  --kernel --since "@$t"
kern  :info  : [<18446744098961.000000>] bash (40091): drop_caches: 3

Fixed:
./dmesg --nopager --color=never --decode --time-format delta  --kernel --since "@$t"
kern  :info  : [<25251.997673>] bash (40091): drop_caches: 3

Signed-off-by: Karel Zak <kzak@redhat.com>
3 months agodmesg: don't affect delta by --since
Karel Zak [Tue, 13 Feb 2024 09:53:41 +0000 (10:53 +0100)] 
dmesg: don't affect delta by --since

Fixes: https://github.com/util-linux/util-linux/issues/2770
Signed-off-by: Karel Zak <kzak@redhat.com>
3 months agoSave and restore errno on signal handlers
Cristian Rodríguez [Sun, 11 Feb 2024 18:53:30 +0000 (15:53 -0300)] 
Save and restore errno on signal handlers

"Fetching and setting the value of errno is async-signal-safe
provided that the signal handler saves errno on entry and
       restores its value before returning."

save and restore errno on cases where it is needed.

3 months agoMerge branch 'minor-improvement' of https://github.com/calestyo/util-linux
Karel Zak [Mon, 12 Feb 2024 11:53:20 +0000 (12:53 +0100)] 
Merge branch 'minor-improvement' of https://github.com/calestyo/util-linux

* 'minor-improvement' of https://github.com/calestyo/util-linux:
  blkdev.h: update location of SCSI device types

3 months agofsck: warn if fsck.<type> not found and device is specified
Karel Zak [Thu, 8 Feb 2024 11:42:51 +0000 (12:42 +0100)] 
fsck: warn if fsck.<type> not found and device is specified

The fsck(8) command prints an error for certain 'required'
filesystems, such as extN, if the corresponding fsck.<type> helper is
not found. However, for other filesystems, it silently ignores the
device. While this behavior is acceptable for the -A option, if a user
explicitly specifies the device on the command line, it is probably a
good idea to be more verbose and issue a warning that the device will
be ignored. The warning is enabled only for interactive mode (only one
device specified or -s).

Note that some filesystems do not have an fsck utility, so caution is
needed when issuing such warnings to prevent the generation of a large
number of unwanted entries in system logs, etc."

Reported-by: наб <nabijaczleweli@nabijaczleweli.xyz>
Signed-off-by: Karel Zak <kzak@redhat.com>
3 months agoMerge branch 'nopython' of https://github.com/Vogtinator/util-linux
Karel Zak [Mon, 12 Feb 2024 11:49:29 +0000 (12:49 +0100)] 
Merge branch 'nopython' of https://github.com/Vogtinator/util-linux

* 'nopython' of https://github.com/Vogtinator/util-linux:
  meson: Only build libmount python module if python was found

3 months agoMerge branch 'lastlog2' of https://github.com/Vogtinator/util-linux
Karel Zak [Mon, 12 Feb 2024 11:49:11 +0000 (12:49 +0100)] 
Merge branch 'lastlog2' of https://github.com/Vogtinator/util-linux

* 'lastlog2' of https://github.com/Vogtinator/util-linux:
  lastlog2: Fix various issues with meson

3 months agoMerge branch 'more-meson' of https://github.com/keszybz/util-linux
Karel Zak [Mon, 12 Feb 2024 11:48:52 +0000 (12:48 +0100)] 
Merge branch 'more-meson' of https://github.com/keszybz/util-linux

* 'more-meson' of https://github.com/keszybz/util-linux:
  meson: fix mismatch with handling of lib_dl dependency
  meson: add forgotten files to lists
  meson: fix disablement check

3 months agoMerge branch 'column-handle-ansi-escapes' of https://github.com/juarezr/util-linux
Karel Zak [Mon, 12 Feb 2024 11:48:13 +0000 (12:48 +0100)] 
Merge branch 'column-handle-ansi-escapes' of https://github.com/juarezr/util-linux

* 'column-handle-ansi-escapes' of https://github.com/juarezr/util-linux:
  column: add doc comment explaining ansi code detection
  column: fix regression tests complaint
  column: add test for ansi escapes
  column: fix unaligned cols in text with ansi escapes

3 months agoblkdev.h: update location of SCSI device types
Christoph Anton Mitterer [Fri, 9 Feb 2024 22:34:25 +0000 (23:34 +0100)] 
blkdev.h: update location of SCSI device types

In Linux commit c5f1ac8b94bd10f97f5aa1a3279ad8e8bbc6311a (“Split SCSI header
files”) these definition where split out into `include/scsi/scsi_proto.h`.

This commit also removes the git link (any kernel sources will do just fine) and
just names the file.

Signed-off-by: Christoph Anton Mitterer <mail@christoph.anton.mitterer.name>
3 months agomeson: Only build libmount python module if python was found
Fabian Vogt [Wed, 7 Feb 2024 10:48:33 +0000 (11:48 +0100)] 
meson: Only build libmount python module if python was found

The extension_module call was in the wrong place.

3 months agolastlog2: Fix various issues with meson
Fabian Vogt [Wed, 7 Feb 2024 10:29:26 +0000 (11:29 +0100)] 
lastlog2: Fix various issues with meson

- Make sure @usrbin_execdir@ is actually replaced
- pam_lastlog2.so is always a shared library that's dlopen()ed,
  so use shared_module and do not generate a pkgconfig module

3 months agolibmount: fix copy & past bug in lock initialization
Karel Zak [Wed, 7 Feb 2024 09:56:19 +0000 (10:56 +0100)] 
libmount: fix copy & past bug in lock initialization

Signed-off-by: Karel Zak <kzak@redhat.com>
3 months agocolumn: add doc comment explaining ansi code detection
Juarez Rudsatz [Mon, 5 Feb 2024 18:59:15 +0000 (15:59 -0300)] 
column: add doc comment explaining ansi code detection

3 months agocolumn: fix regression tests complaint
Juarez Rudsatz [Mon, 5 Feb 2024 14:49:27 +0000 (11:49 -0300)] 
column: fix regression tests complaint

3 months agocolumn: add test for ansi escapes
Juarez Rudsatz [Mon, 5 Feb 2024 01:33:35 +0000 (22:33 -0300)] 
column: add test for ansi escapes

3 months agocolumn: fix unaligned cols in text with ansi escapes
Juarez Rudsatz [Mon, 5 Feb 2024 01:32:41 +0000 (22:32 -0300)] 
column: fix unaligned cols in text with ansi escapes

3 months agomeson: fix mismatch with handling of lib_dl dependency
Zbigniew Jędrzejewski-Szmek [Tue, 6 Feb 2024 12:41:53 +0000 (13:41 +0100)] 
meson: fix mismatch with handling of lib_dl dependency

lib_dl is only defined if both conditions are met, so meson would fail with an
undefined variable.

3 months agomeson: add forgotten files to lists
Zbigniew Jędrzejewski-Szmek [Tue, 6 Feb 2024 12:18:38 +0000 (13:18 +0100)] 
meson: add forgotten files to lists

3 months agomeson: fix disablement check
Zbigniew Jędrzejewski-Szmek [Tue, 6 Feb 2024 12:14:37 +0000 (13:14 +0100)] 
meson: fix disablement check

opt is not defined for those programs.

3 months agosetpriv: (tests) add seccomp test
Thomas Weißschuh [Fri, 2 Feb 2024 14:20:57 +0000 (15:20 +0100)] 
setpriv: (tests) add seccomp test

Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
3 months agosetpriv: add support for seccomp filters
Thomas Weißschuh [Fri, 2 Feb 2024 14:20:40 +0000 (15:20 +0100)] 
setpriv: add support for seccomp filters

Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
3 months agoenosys: add functionality to dump filter
Thomas Weißschuh [Fri, 2 Feb 2024 14:00:56 +0000 (15:00 +0100)] 
enosys: add functionality to dump filter

Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
3 months agoinclude: introduce seccomp.h
Thomas Weißschuh [Fri, 2 Feb 2024 14:28:30 +0000 (15:28 +0100)] 
include: introduce seccomp.h

It will be used by setpriv in a future commit.

Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
3 months agoMerge branch 'lsfd--error' of https://github.com/masatake/util-linux
Karel Zak [Mon, 5 Feb 2024 11:07:49 +0000 (12:07 +0100)] 
Merge branch 'lsfd--error' of https://github.com/masatake/util-linux

* 'lsfd--error' of https://github.com/masatake/util-linux:
  tests: (lsfd) add a case testing ERROR type appeared in TYPE column
  tests: (test_mkfds::mmap) new factory
  lsfd: add --_drop-prvilege option for testing purpose
  lsfd: add ERROR as a new type
  lsfd: (refactor) make the steps for new_file consistent
  lsfd: (refactor) add abst_class as super class of file_class
  lsfd: (refactor) simplify the step to make a file struct
  lsfd: (refactor) simplify the step to copy a file struct if the result of its stat is reusable
  lsfd: (refactor) flatten bit fields in struct file
  lsfd: fix typos of a function name

3 months agoMerge branch 'meson/lastlog2' of https://github.com/t-8ch/util-linux v2.41-devel
Karel Zak [Mon, 5 Feb 2024 10:55:39 +0000 (11:55 +0100)] 
Merge branch 'meson/lastlog2' of https://github.com/t-8ch/util-linux

* 'meson/lastlog2' of https://github.com/t-8ch/util-linux:
  meson: only build liblastlog when enabled
  meson: create dedicated config for pam_lastlog2
  meson: use a dependency object for sqlite3
  meson: use a dependency object for liblastlog2

3 months agoMerge branch 'lsclocks' of https://github.com/alanc/util-linux
Karel Zak [Mon, 5 Feb 2024 10:53:55 +0000 (11:53 +0100)] 
Merge branch 'lsclocks' of https://github.com/alanc/util-linux

* 'lsclocks' of https://github.com/alanc/util-linux:
  lsclocks: use clock id from clock_getcpuclockid in add_cpu_clock

3 months agoMerge branch 'strtod' of https://github.com/alanc/util-linux
Karel Zak [Mon, 5 Feb 2024 10:42:53 +0000 (11:42 +0100)] 
Merge branch 'strtod' of https://github.com/alanc/util-linux

* 'strtod' of https://github.com/alanc/util-linux:
  lib/c_strtod: fix uselocale() fallback if strtod_l() is not available