]> git.ipfire.org Git - thirdparty/util-linux.git/log
thirdparty/util-linux.git
23 months agomeson: add check for struct statx
Thomas Weißschuh [Thu, 3 Aug 2023 10:22:29 +0000 (12:22 +0200)] 
meson: add check for struct statx

meson variant of commit 1fc3471dfb8b ("libmount: check for struct statx").

Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
23 months agomeson: add check for linux/mount.h
Thomas Weißschuh [Thu, 3 Aug 2023 10:18:41 +0000 (12:18 +0200)] 
meson: add check for linux/mount.h

meson variant of commit 5502e73d8f82 ("libmount: check for linux/mount.h").

Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
23 months agolibmount: improve EPERM interpretation
Karel Zak [Thu, 3 Aug 2023 11:06:30 +0000 (13:06 +0200)] 
libmount: improve EPERM interpretation

In some cases mount(2)/open_tree(2) returns EPERM for root user. In
this case libmount reports it as "mount point is not a directory".

It does not makes sense for bind mount where target could be a
regular file.

This patch is not ideal, the error handler is generic, but semantic
for new mount API and mount(2) is different. For example now it checks
for regular file, but the new API supports bind over symlinks, so
proper fix will require lstat() and S_ISLNK(), etc. We need to move
error messages to hook_mount.c and mount_mount_legacy.c to make it
more specific.

Fixes: https://github.com/util-linux/util-linux/issues/2413
Signed-off-by: Karel Zak <kzak@redhat.com>
23 months agolibmount: ifdef statx() call
Karel Zak [Thu, 3 Aug 2023 10:39:19 +0000 (12:39 +0200)] 
libmount: ifdef statx() call

In this case the statx() is use to get mount ID. It's optional and not
required. Let's #ifdef the statx() call and also check for stx_mnt_id
struct member.

Fixes: https://github.com/util-linux/util-linux/issues/2415
Signed-off-by: Karel Zak <kzak@redhat.com>
23 months agolibmount: check for struct statx
Markus Mayer [Tue, 1 Aug 2023 19:59:27 +0000 (12:59 -0700)] 
libmount: check for struct statx

Let's ensure struct statx exists before we try to use it. Checking for
the existence of linux/stat.h is not sufficient. This is because
[uapi/]linux/stat.h has existed since Linux 3.7, however struct statx
was only introduced with Linux 4.11.

The problem arises if one happens ot be using kernel headers from within
the aforementioned range, such as Linux 4.9.

  CC       libmount/src/la-utils.lo
In file included from libmount/src/utils.c:31:
./include/fileutils.h:100:33: warning: declaration of 'struct statx' will not
be visible outside of this function [-Wvisibility]
                    unsigned int mask, struct statx *stx)
                                              ^
libmount/src/utils.c:117:16: error: variable has incomplete type 'struct statx'
                struct statx stx = { 0 };
                             ^
libmount/src/utils.c:117:10: note: forward declaration of 'struct statx'
                struct statx stx = { 0 };
                       ^
libmount/src/utils.c:125:5: error: use of undeclared identifier 'STATX_TYPE'
                                STATX_TYPE
                                ^
libmount/src/utils.c:126:8: error: use of undeclared identifier 'STATX_MODE'
                                        | STATX_MODE
                                          ^
libmount/src/utils.c:127:8: error: use of undeclared identifier 'STATX_INO'
                                        | STATX_INO,
                                          ^
1 warning and 4 errors generated.
make[4]: *** [Makefile:11269: libmount/src/la-utils.lo] Error 1

Checking for the presence of struct statx explicitly avoids this
problem.

Signed-off-by: Markus Mayer <mmayer@broadcom.com>
23 months agolibmount: check for linux/mount.h
Markus Mayer [Tue, 1 Aug 2023 19:59:26 +0000 (12:59 -0700)] 
libmount: check for linux/mount.h

Check that linux/mount.h is present before using features that rely on
it.

It is necessary to check for the presence of linux/mount.h explicitly.
Simply relying on the presence of several syscalls (e.g. SYS_move_mount,
SYS_open_tree) does not work reliably, at least not in a cross-compiling
environment.

The syscall definitions are provided by the C library. Meanwhile,
linux/mount.h is provided by the kernel. This opens the possibility for
discrepancies.

A problem arises if the C library (e.g. musl-1.2.3) defines all "mount
fd API" syscalls (and HAVE_MOUNTFD_API becomes true), but the kernel
headers are old enough to not provide linux/mount.h. The resulting error
looks as follows. This example is using an LLVM-13 cross-compiler from
x86_64 to aarch64 with musl-1.2.3 as the C library.

  CC       libmount/src/la-hooks.lo
In file included from libmount/src/hooks.c:30:
./include/mount-api-utils.h:11:10: fatal error: 'linux/mount.h' file not found
         ^~~~~~~~~~~~~~~
1 error generated.
make[4]: *** [Makefile:11185: libmount/src/la-hooks.lo] Error 1

To prevent this condition, we add a check to configure that will test
for the presence of linux/mount.h in addition to testing for the mount
fd API. Only if both conditions are met can we actually use the mount
fd API.

Signed-off-by: Markus Mayer <mmayer@broadcom.com>
23 months agolibmount: (utils) fix statx fallback
Thomas Weißschuh [Thu, 3 Aug 2023 05:13:28 +0000 (07:13 +0200)] 
libmount: (utils) fix statx fallback

If the systemcall is not available ENOSYS is returned.

Under glibc the statx implementation also has its own fallback logic.
As AT_STATX_DONT_SYNC can't be implemented correctly in that fallback
logic the wrapper will return EINVAL in case the emulation is needed and
AT_STATX_DONT_SYNC is set.
So also use our own fallback in that case.

Fixes: #2409
Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
23 months agolibmount: cleanup --fake mode
Karel Zak [Tue, 1 Aug 2023 12:49:48 +0000 (14:49 +0200)] 
libmount: cleanup --fake mode

It was originally designed to play nasty games with /etc/mtab (mount
when /etc is read-only and update later when it's write-able).

The --fake is completely useless with the new API due to complexity
where we cannot skip any step, because the next stuff depends on it.
So, it makes more sense skip all functionality where libmount does
anything significant.

This commit add --fake check to hooks logic to skip all hooks as the
hooks are place where libmount implements mount related invasive
operations (create mountpoint, namespaces, create superblock, move,
mount, etc.).

Frankly, --fake without mtab is useless.

Fixes: https://github.com/util-linux/util-linux/issues/2395
Signed-off-by: Karel Zak <kzak@redhat.com>
23 months agolibmount: (python): work around python 3.12 bug
Thomas Weißschuh [Sun, 9 Jul 2023 08:18:15 +0000 (10:18 +0200)] 
libmount: (python): work around python 3.12 bug

Python 3.12 introduced a -Wredundant-decls warning.
Work around it by not breaking the build.

See https://github.com/python/cpython/issues/106560

Closes: #2366
Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
23 months agobuild-sys: add AX_COMPARE_VERSION
Thomas Weißschuh [Mon, 10 Jul 2023 11:23:22 +0000 (13:23 +0200)] 
build-sys: add AX_COMPARE_VERSION

It will be used to check the found python version.

Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
23 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>
23 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>
23 months agolibmount: use some MS_* flags as superblock flags
Karel Zak [Thu, 20 Jul 2023 10:34:14 +0000 (12:34 +0200)] 
libmount: use some MS_* flags as superblock flags

The old mount(2) API usually utilizes MS_* flags to set up the VFS
node. However, there are some exceptions like "sync" (MS_SYNCHRONOUS),
where the flag is used (by kernel) for the superblock instead. The new
API addresses this issue, ensuring that these options are used for
fsconfig().

This commit introduces MNT_SUPERBLOCK to identify these options in the
libmount options Linux map, and it enforces the new mount code to
utilize these options for fsconfig(FSCONFIG_SET_FLAG).

Reported-by: Abbink Esger <esger.abbink.ext@siemens.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
(cherry picked from commit 54e4a6b145fd6ef943d93e16de748283e687855d)
Fixes: #2439
23 months agolibmount: use mount(2) for remount on Linux < 5.14
Karel Zak [Mon, 5 Jun 2023 10:59:41 +0000 (12:59 +0200)] 
libmount: use mount(2) for remount on Linux < 5.14

It seems mount_setattr() is supported on Linux < 5.14, but it's without
MOUNT_ATTR_NOSYMFOLLOW. That's problem for remount where we reset all
VFS flags.

The most simple (but not elegant) is to check for kernel version and
fallback to mount(2) on remount.

Addresses: https://github.com/util-linux/util-linux/issues/2283
Signed-off-by: Karel Zak <kzak@redhat.com>
23 months agogithub: check apt-cache in more robust way
Karel Zak [Wed, 16 Aug 2023 07:03:59 +0000 (09:03 +0200)] 
github: check apt-cache in more robust way

References: 3119a8060102ed7dd04d4a782932494c386f72a6
Signed-off-by: Karel Zak <kzak@redhat.com>
2 years agolibmount: handle failure to apply flags as part of a mount operation
Debarshi Ray [Thu, 13 Jul 2023 09:07:27 +0000 (11:07 +0200)] 
libmount: handle failure to apply flags as part of a mount operation

If a mount operation with extra flags runs into an EPERM when applying
the flags, then mnt_context_get_mount_excode() returns 'Unknown error
5005' and MNT_EX_FAIL.  Here's an example:

Create a mount point on the host with 'nodev,nosuid,noexec':
  $ dd if=/dev/zero of=/var/tmp/loopfile bs=40960 count=1024
  $ sudo losetup --find /var/tmp/loopfile
  $ sudo mkfs.ext4 /dev/loop0
  $ sudo mkdir /mnt/a
  $ sudo mount -o nosuid,nodev,noexec /dev/loop0 /mnt/a

Check the mount options to be sure:
  $ findmnt --output OPTIONS,PROPAGATION /mnt/a
  OPTIONS                                  PROPAGATION
  rw,nosuid,nodev,noexec,relatime,seclabel shared

Enter a mount and user namespace:
  $ podman run \
        --interactive \
        --privileged \
        --rm \
        --tty \
        --volume /:/run/host:rslave \
        registry.fedoraproject.org/fedora:38 \
        /bin/bash

Try to bind mount the mount point from the host inside the namespace
with some extra flags:
  # mkdir ~/b
  # mount --bind -o ro /run/host/mnt/a ~/b
  mount: /root/b: filesystem was mounted, but any subsequent operation
      failed: Unknown error 5005.
  # echo $?
  32

It will be better to show something more human-readable than 'Unknown
error 5005'.

Secondly, an exit code of 32 means 'mount failure', which isn't quite
correct here.  The mount operation is split into two mount(2) calls,
where the first one uses MS_BIND to create the bind mount, and the
second uses MS_REMOUNT | MS_BIND | MS_RDONLY to apply the 'ro' flag.
Here, the first mount(2) does succeed:
  # findmnt --output OPTIONS,PROPAGATION ~/b
  OPTIONS                                  PROPAGATION
  rw,nosuid,nodev,noexec,relatime,seclabel private,slave

It's only the application of the 'ro' flag with the second mount(2) that
fails with an EPERM.  Hence, an exit code of 1 that means 'incorrect
invocation or permissions' seems more appropriate.

Signed-off-by: Debarshi Ray <rishi@fedoraproject.org>
2 years agobuild-sys: release++ (v2.39.1) v2.39.1
Karel Zak [Tue, 27 Jun 2023 12:31:13 +0000 (14:31 +0200)] 
build-sys: release++ (v2.39.1)

Signed-off-by: Karel Zak <kzak@redhat.com>
2 years agodocs: update v2.39.1-ReleaseNotes
Karel Zak [Tue, 27 Jun 2023 12:30:01 +0000 (14:30 +0200)] 
docs: update v2.39.1-ReleaseNotes

Signed-off-by: Karel Zak <kzak@redhat.com>
2 years agodocs: update AUTHORS file
Karel Zak [Tue, 27 Jun 2023 12:16:53 +0000 (14:16 +0200)] 
docs: update AUTHORS file

Signed-off-by: Karel Zak <kzak@redhat.com>
2 years agopo-man: merge changes
Karel Zak [Tue, 27 Jun 2023 12:14:17 +0000 (14:14 +0200)] 
po-man: merge changes

Signed-off-by: Karel Zak <kzak@redhat.com>
2 years agopo: merge changes
Karel Zak [Tue, 27 Jun 2023 12:14:10 +0000 (14:14 +0200)] 
po: merge changes

Signed-off-by: Karel Zak <kzak@redhat.com>
2 years agopo-man: add ro.po (from translationproject.org)
Remus-Gabriel Chelu [Tue, 27 Jun 2023 12:08:33 +0000 (14:08 +0200)] 
po-man: add ro.po (from translationproject.org)

2 years agopo-man: add ko.po (from translationproject.org)
Seong-ho Cho [Tue, 27 Jun 2023 12:08:33 +0000 (14:08 +0200)] 
po-man: add ko.po (from translationproject.org)

2 years agopo-man: update uk.po (from translationproject.org)
Yuri Chornoivan [Tue, 27 Jun 2023 12:08:33 +0000 (14:08 +0200)] 
po-man: update uk.po (from translationproject.org)

2 years agopo: update hr.po (from translationproject.org)
Božidar Putanec [Tue, 27 Jun 2023 12:05:10 +0000 (14:05 +0200)] 
po: update hr.po (from translationproject.org)

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

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

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

2 years agobuild-sys: don't call pkg-config --static if unnecessary
Karel Zak [Mon, 26 Jun 2023 10:46:15 +0000 (12:46 +0200)] 
build-sys: don't call pkg-config --static if unnecessary

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

Addresses: https://github.com/util-linux/util-linux/issues/2336
Signed-off-by: Karel Zak <kzak@redhat.com>
2 years agounshare: fix error message for unexpected time offsets
Thomas Weißschuh [Sun, 25 Jun 2023 11:28:19 +0000 (13:28 +0200)] 
unshare: fix error message for unexpected time offsets

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

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

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

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

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

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

2 years agoMerge branch 'lsfd--fix-separators-for-json-output-endpoints-only' of https://github...
Karel Zak [Mon, 26 Jun 2023 10:00:41 +0000 (12:00 +0200)] 
Merge branch 'lsfd--fix-separators-for-json-output-endpoints-only' of https://github.com/masatake/util-linux into stable/v2.39

* 'lsfd--fix-separators-for-json-output-endpoints-only' of https://github.com/masatake/util-linux:
  tests: (lsfd) add a case for verifying ENDPOINTS column output in JSON mode
  lsfd: use ARRAY_STRING for ENDPOINTS column in JSON output mode
  lsfd: (filter) weakly support ARRAY_STRING and ARRAY_NUMBER json types

2 years agolibmount: fix sync options between context and fs structs
Karel Zak [Thu, 22 Jun 2023 11:11:57 +0000 (13:11 +0200)] 
libmount: fix sync options between context and fs structs

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

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

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

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

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

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

Addresses: https://github.com/util-linux/util-linux/issues/2326
Signed-off-by: Karel Zak <kzak@redhat.com>
2 years agotests: (lsfd) add a case for verifying ENDPOINTS column output in JSON mode
Masatake YAMATO [Thu, 22 Jun 2023 15:45:23 +0000 (00:45 +0900)] 
tests: (lsfd) add a case for verifying ENDPOINTS column output in JSON mode

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
2 years agolsfd: use ARRAY_STRING for ENDPOINTS column in JSON output mode
Masatake YAMATO [Thu, 22 Jun 2023 05:42:34 +0000 (14:42 +0900)] 
lsfd: use ARRAY_STRING for ENDPOINTS column in JSON output mode

This is the backport-for-v2.39 version of #2328.

With this change:
  {
     "lsfd": [
        {
           "assoc": "3",
           "endpoints": [
               "9942,test_mkfds,4-w", "9942,test_mkfds,5r-", "9942,test_mkfds,6-w"
           ]
        }
     ]
  }

Without this change:
 {
     "lsfd": [
        {
           "assoc": "3",
           "endpoints": [
               "9942,test_mkfds,4-w\n9942,test_mkfds,5r-\n9942,test_mkfds,6-w"
           ]
        }
     ]
  }

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

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

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

Signed-off-by: Karel Zak <kzak@redhat.com>
2 years agolib: remove pager.c from libcommon
Karel Zak [Tue, 20 Jun 2023 11:15:45 +0000 (13:15 +0200)] 
lib: remove pager.c from libcommon

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

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

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

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

* add missing SPDX-License-Identifier lines for LGPL

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

* use the same comment formatting

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

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

Signed-off-by: Karel Zak <kzak@redhat.com>
2 years agotests: fix update special mount test output
Karel Zak [Mon, 19 Jun 2023 12:56:30 +0000 (14:56 +0200)] 
tests: fix update special mount test output

Signed-off-by: Karel Zak <kzak@redhat.com>
2 years agotests: backport special mount script
Karel Zak [Mon, 19 Jun 2023 12:36:59 +0000 (14:36 +0200)] 
tests: backport special mount script

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

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

References: fe0b1e793c9017edba72768e2e0b4c769c204604
Addresses: https://github.com/util-linux/util-linux/issues/2315
Signed-off-by: Karel Zak <kzak@redhat.com>
2 years agoMerge pull request #2319 from t-8ch/2.39/_NL_TIME_WEEK_1STDAY
Karel Zak [Mon, 19 Jun 2023 09:12:55 +0000 (11:12 +0200)] 
Merge pull request #2319 from t-8ch/2.39/_NL_TIME_WEEK_1STDAY

2.39: meson: check for _NL_TIME_WEEK_1STDAY in langinfo.h

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

... which is required for `cal`.

Fixes GH-2316

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

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

(cherry picked from commit 334939a19d72febc0ce6f2913a9692123db79058)

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

This just mirrors what the autotools setup is doing.

(cherry picked from commit d6418774aba595c44fa6c68dd2da55cb6f7642dd)

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

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

Fixes #2310.

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

(cherry picked from commit 444753601c4c367ca395359ea74fe5c7b86ce56d)

2 years agomeson: install write setgid
Christian Hesse [Fri, 9 Jun 2023 13:04:00 +0000 (15:04 +0200)] 
meson: install write setgid

... as this requires elevated privileges.

(cherry picked from commit cee78467bea45f7a4f890f0c65bd59441bd42697)

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

... as this requires elevated privileges.

(cherry picked from commit 07641fd93c4829696c1e2101642fee32ad998025)

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

... as this requires elevated privileges.

(cherry picked from commit 1cb3c90ca5de6ffb43f8a40605118a8d84a0c6f3)

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

... as this requires elevated privileges.

(cherry picked from commit 8f49b3693d6f1db36d5ecb7328965686362deaa3)

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

... as this requires elevated privileges.

(cherry picked from commit cb3dee5a14da552a935680584d2fc5c37cb3a913)

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

... as this requires elevated privileges.

(cherry picked from commit fb8c224eae4e28502e05770d35c8e3b8509a9b69)

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

... as this requires elevated privileges.

(cherry picked from commit a13574b1de21d7fd9a0ad63790a7452c369e46e5)

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

... as this requires elevated privileges.

(cherry picked from commit 60d457f52991e6f6472171035974ce7a3ae621f3)

2 years agolibmount: introduce LIBMOUNT_FORCE_MOUNT2={always,never,auto}
Karel Zak [Mon, 5 Jun 2023 11:21:11 +0000 (13:21 +0200)] 
libmount: introduce LIBMOUNT_FORCE_MOUNT2={always,never,auto}

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

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

Addresses: https://github.com/util-linux/util-linux/issues/1992
Addresses: https://github.com/util-linux/util-linux/issues/2283
Signed-off-by: Karel Zak <kzak@redhat.com>
2 years agoMerge branch '2.39/libmount/loop-rw' of https://github.com/t-8ch/util-linux into...
Karel Zak [Mon, 12 Jun 2023 10:22:55 +0000 (12:22 +0200)] 
Merge branch '2.39/libmount/loop-rw' of https://github.com/t-8ch/util-linux into stable/v2.39

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

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

Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
2 years agotests: backport mount_setattr test
Karel Zak [Mon, 5 Jun 2023 10:48:34 +0000 (12:48 +0200)] 
tests: backport mount_setattr test

Signed-off-by: Karel Zak <kzak@redhat.com>
2 years agolibblkid: jfs - avoid undefined shift
Milan Broz [Sun, 4 Jun 2023 17:15:55 +0000 (19:15 +0200)] 
libblkid: jfs - avoid undefined shift

Fix previous commit 04a0717b0b0faa1a8078dc6fad05183b8bada395
to avoid undefined shift if value is exactly 32.

  libblkid/src/superblocks/jfs.c:46:39: runtime error:
  shift exponent 32 is too large for 32-bit type 'unsigned int'

Reproducer found with OSS-Fuzz (issue 59284) running over
cryptsetup project (blkid is used in header init).

Signed-off-by: Milan Broz <gmazyland@gmail.com>
2 years agobuild-sys: fix typo in waitpid check
Thomas Weißschuh [Wed, 31 May 2023 14:11:09 +0000 (16:11 +0200)] 
build-sys: fix typo in waitpid check

Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
2 years agoUpdate fsck.8.adoc
Hennie Botha [Wed, 31 May 2023 06:45:25 +0000 (08:45 +0200)] 
Update fsck.8.adoc

Typo

2 years agodmesg: make kmsg read() buffer big enough for kernel
anteater [Mon, 29 May 2023 20:59:11 +0000 (20:59 +0000)] 
dmesg: make kmsg read() buffer big enough for kernel

otherwise, if the kernel log has an item longer than 1024B, our read() gives EINVAL and we stop reading kmsg

2 years agoFix Blizzard-M2-Max
ThomasKaiser [Mon, 29 May 2023 12:47:50 +0000 (14:47 +0200)] 
Fix Blizzard-M2-Max

2 years agoAdd recent Apple ARM cores
ThomasKaiser [Mon, 29 May 2023 12:42:18 +0000 (14:42 +0200)] 
Add recent Apple ARM cores

2 years agolibmount: don't call hooks after mount.<type> helper
Karel Zak [Thu, 25 May 2023 09:48:24 +0000 (11:48 +0200)] 
libmount: don't call hooks after mount.<type> helper

In case more filesystems are specified (or when libmount follows
/{etc,proc}/filesystems) then the library may try to use and
initialize the new API because for some filesystems, we need
exec(/sbin/mount.<type>) and for another fsopen().

The hooks that use the API have to smart and detect that the mount
operation was done in external /sbin/mount.<type> helper. And in this
case, the new API file descriptors must be ignored.

The exception is propagation flags, mount(8) can set the flags after
exec(/sbin/mount.<type>), for example, "mount -t ntfs --make-private".

Fixes: https://github.com/util-linux/util-linux/issues/2267
Signed-off-by: Karel Zak <kzak@redhat.com>
2 years agomeson: install symlink for vigr man page
Christian Hesse [Mon, 22 May 2023 14:11:18 +0000 (16:11 +0200)] 
meson: install symlink for vigr man page

2 years agomeson: include bash-completion for write
Christian Hesse [Mon, 22 May 2023 13:57:35 +0000 (15:57 +0200)] 
meson: include bash-completion for write

2 years agomeson: include bash-completion for newgrp
Christian Hesse [Mon, 22 May 2023 13:56:28 +0000 (15:56 +0200)] 
meson: include bash-completion for newgrp

2 years agolibmount: cleanup enosys returns from mount hoop
Karel Zak [Tue, 23 May 2023 10:13:02 +0000 (12:13 +0200)] 
libmount: cleanup enosys returns from mount hoop

Signed-off-by: Karel Zak <kzak@redhat.com>
2 years agolibmount: don't call mount.<type> helper with usernames
Karel Zak [Mon, 22 May 2023 15:26:55 +0000 (17:26 +0200)] 
libmount: don't call mount.<type> helper with usernames

This is v2.39 regression. The "user" mount option is internally
converted to "user=<name>", but this should not be exported to
the mount helpers.

The mount helper accepts the <name> only if specified in mount options
(cifs uses user=). The real username as generated by libmount is not
relevant in this case.

Signed-off-by: Karel Zak <kzak@redhat.com>
2 years agolibmount: fix options prepend/insert and merging
Karel Zak [Mon, 22 May 2023 13:00:25 +0000 (15:00 +0200)] 
libmount: fix options prepend/insert and merging

 * the order of the new options should not be changed
   (for example prepend "a,b,c" to list with "d" has to generate "a,b,c,d", not "c,b,a,d")

 * make sure that  options map is defined when merging options

Fixes: https://github.com/util-linux/util-linux/issues/2238
Signed-off-by: Karel Zak <kzak@redhat.com>
2 years agolibmount: check for availability of mount_setattr
Thomas Weißschuh [Sat, 20 May 2023 04:38:20 +0000 (06:38 +0200)] 
libmount: check for availability of mount_setattr

If mount_setattr is not available but needed fall back to the legacy
mount API.

Fixes #2247

Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
2 years agolibmount: don't pass option "defaults" to helper
Thomas Weißschuh [Sun, 21 May 2023 17:58:47 +0000 (19:58 +0200)] 
libmount: don't pass option "defaults" to helper

"defaults" is only a pseudo-option that expands to other options.
It should not be passed to helpers.

Reported-by: Quentin Rameau <quinq@fifth.space>
Closes: https://lore.kernel.org/util-linux/20230521181814.0b0f2d38.quinq@fifth.space/
Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
2 years agobuild-sys: add --disable-waitpid
Frantisek Sumsal [Thu, 18 May 2023 16:56:15 +0000 (18:56 +0200)] 
build-sys: add --disable-waitpid

The new pidfd stuff waitpid uses is not compatible with older kernel
headers, but the rest of the util-linux is still perfectly fine, so
allow disabling just the waitpid utility to make the builds happy again.

2 years agomesg.1 cleanups/updates
наб [Sun, 14 May 2023 23:19:58 +0000 (01:19 +0200)] 
mesg.1 cleanups/updates

First hunk:  grammar.
Second hunk: (a) mentioning BSD ptys and not UNIX98 ones is odd,
             (b) mentioning /only/ ptys is odder still.
Third hunk:  mesg is found in the UNIX Programmer's Manual;
             it takes its modern form in V7
             (it's unclear to me why V6 specifically is mentioned,
              since it's still default-invert + always-report-"was X").

2 years agoMerge branch '2.39/bcache' of https://github.com/t-8ch/util-linux into stable/v2.39
Karel Zak [Mon, 5 Jun 2023 09:49:47 +0000 (11:49 +0200)] 
Merge branch '2.39/bcache' of https://github.com/t-8ch/util-linux into stable/v2.39

* '2.39/bcache' of https://github.com/t-8ch/util-linux:
  libblkid: (bcache) also calculate checksum over journal buckets
  libblkid: (bcache) extend superblock definition

2 years agolibblkid: (bcache) also calculate checksum over journal buckets
Thomas Weißschuh [Sat, 3 Jun 2023 11:13:52 +0000 (13:13 +0200)] 
libblkid: (bcache) also calculate checksum over journal buckets

Fixes #2291

Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
2 years agolibblkid: (bcache) extend superblock definition
Thomas Weißschuh [Sat, 3 Jun 2023 11:13:37 +0000 (13:13 +0200)] 
libblkid: (bcache) extend superblock definition

We will need it for the correct checksum calculation.

Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
2 years agoci: prevent prompts during installation
Thomas Weißschuh [Wed, 31 May 2023 08:15:11 +0000 (10:15 +0200)] 
ci: prevent prompts during installation

Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
2 years agotools: (asciidoctor) explicitly require extensions module
Thomas Weißschuh [Wed, 31 May 2023 15:12:12 +0000 (17:12 +0200)] 
tools: (asciidoctor) explicitly require extensions module

This is needed for older versions of asciidoctor.

Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
2 years agobuild-sys: only pass --failure-level if supported
Thomas Weißschuh [Wed, 31 May 2023 14:56:31 +0000 (16:56 +0200)] 
build-sys: only pass --failure-level if supported

Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
2 years agolsfd: (tests) fix typo
Thomas Weißschuh [Wed, 31 May 2023 15:25:22 +0000 (17:25 +0200)] 
lsfd: (tests) fix typo

Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
2 years agoblkzone: don't take address of struct blk_zone
Thomas Weißschuh [Wed, 31 May 2023 10:47:03 +0000 (12:47 +0200)] 
blkzone: don't take address of struct blk_zone

Older versions of GCC do not know the warning so they warn about the
unknown ignored warning.

As struct blk_zone is only 64 bytes anyway just copy it.

Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
2 years agoenosys: add support for loongarch
Thomas Weißschuh [Tue, 23 May 2023 14:34:47 +0000 (16:34 +0200)] 
enosys: add support for loongarch

Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
2 years agomeson: require 0.57
Thomas Weißschuh [Tue, 23 May 2023 14:32:23 +0000 (16:32 +0200)] 
meson: require 0.57

It is needed for fs.read()

Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
2 years agoenosys: split audit arch detection into dedicated header
Thomas Weißschuh [Mon, 22 May 2023 15:25:15 +0000 (17:25 +0200)] 
enosys: split audit arch detection into dedicated header

Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
2 years agoenosys: add support for sparc
Thomas Weißschuh [Mon, 22 May 2023 15:21:26 +0000 (17:21 +0200)] 
enosys: add support for sparc

Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
2 years agowaitpid: only build when pidfd_open is available
Thomas Weißschuh [Mon, 22 May 2023 16:24:47 +0000 (18:24 +0200)] 
waitpid: only build when pidfd_open is available

Fixes #2256

[kzak@redhat.com: - fix UL_BUILD_INIT() use]

Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
Signed-off-by: Karel Zak <kzak@redhat.com>
2 years agolibsmartcols: (samples): fix format truncation warning
Thomas Weißschuh [Fri, 19 May 2023 15:34:00 +0000 (17:34 +0200)] 
libsmartcols: (samples): fix format truncation warning

As this is only an example and the needed memory is not much just
hardcode a large enough number.
The previously computed value was wrong anyways.

libsmartcols/samples/continuous.c: In function 'main':
libsmartcols/samples/continuous.c:110:61: error: '%3d' directive output may be truncated writing between 3 and 11 bytes into a region of size between 0 and 7 [-Werror=format-truncation=]
  110 |                         snprintf(timecell, timecellsz, "%f [%3d%%]", diff,
      |                                                             ^~~
libsmartcols/samples/continuous.c:110:25: note: 'snprintf' output between 11 and 333 bytes into a destination of size 12
  110 |                         snprintf(timecell, timecellsz, "%f [%3d%%]", diff,
      |                         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  111 |                                 done ? 100 : (int)(diff / (TIME_PERIOD / 100.0)));
      |                                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
libsmartcols/samples/continuous.c:110:61: error: '%3d' directive output may be truncated writing 3 bytes into a region of size between 0 and 7 [-Werror=format-truncation=]
  110 |                         snprintf(timecell, timecellsz, "%f [%3d%%]", diff,
      |                                                             ^~~
libsmartcols/samples/continuous.c:110:25: note: 'snprintf' output between 11 and 325 bytes into a destination of size 12
  110 |                         snprintf(timecell, timecellsz, "%f [%3d%%]", diff,
      |                         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  111 |                                 done ? 100 : (int)(diff / (TIME_PERIOD / 100.0)));
      |                                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
2 years agotest_uuidd: make pthread_t formatting more robust
Thomas Weißschuh [Fri, 19 May 2023 14:47:48 +0000 (16:47 +0200)] 
test_uuidd: make pthread_t formatting more robust

On musl pthread_t is a pointer. To avoid compiler warnings on 32bit
systems add a cast through intptr_t.

Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
2 years agomkfs.minix: handle 64bit time on 32bit system
Thomas Weißschuh [Fri, 19 May 2023 14:47:22 +0000 (16:47 +0200)] 
mkfs.minix: handle 64bit time on 32bit system

Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
2 years agoenosys: add support for MIPS, PowerPC and ARC
Thomas Weißschuh [Wed, 17 May 2023 15:00:31 +0000 (17:00 +0200)] 
enosys: add support for MIPS, PowerPC and ARC

Co-developed-by: Hauke Mertens <hauke@hauke-m.de>
Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
2 years agotest_enosys: fix build on old kernels
Thomas Weißschuh [Tue, 30 May 2023 18:01:49 +0000 (20:01 +0200)] 
test_enosys: fix build on old kernels

Fixes #2277

Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>