]> git.ipfire.org Git - thirdparty/util-linux.git/log
thirdparty/util-linux.git
2 years agoMerge branch 'mount.idmap.fix' of https://github.com/brauner/util-linux
Karel Zak [Mon, 9 Jan 2023 11:38:13 +0000 (12:38 +0100)] 
Merge branch 'mount.idmap.fix' of https://github.com/brauner/util-linux

* 'mount.idmap.fix' of https://github.com/brauner/util-linux:
  libmount: ensure child hangs around until we persisted namespace

2 years agoMerge branch 'schedutils' of https://github.com/chaiken/util-linux
Karel Zak [Mon, 9 Jan 2023 11:35:03 +0000 (12:35 +0100)] 
Merge branch 'schedutils' of https://github.com/chaiken/util-linux

* 'schedutils' of https://github.com/chaiken/util-linux:
  schedutils: better illustrate the usage of cpu-lists with taskset
  schedutils: clarify meaning of taskset return code
  schedutils: clarify confusing mask example in taskset man page

2 years agoci: packit: enable -Werror
Thomas Weißschuh [Sat, 7 Jan 2023 13:58:17 +0000 (13:58 +0000)] 
ci: packit: enable -Werror

2 years agowdctl: mark flags field as unsigned long
Thomas Weißschuh [Sun, 8 Jan 2023 03:29:51 +0000 (03:29 +0000)] 
wdctl: mark flags field as unsigned long

This is required by string_to_bitmask().
The previous cast failed on s390x with the following warning:

In function 'string_to_bitmask',
    inlined from 'string_to_bitmask' at lib/strutils.c:802:5,
    inlined from 'main' at sys-utils/wdctl.c:770:8:
lib/strutils.c:829:23: error: write of 64-bit data outside the bound of destination object, data truncated into 32-bit [-Werror=extra]
  829 |                 *mask |= flag;
      |

2 years agolibblkid: topology/sysfs: fix uint64_t handling on 32bit systems
Thomas Weißschuh [Sun, 8 Jan 2023 03:22:35 +0000 (03:22 +0000)] 
libblkid: topology/sysfs: fix uint64_t handling on 32bit systems

2 years agolibblkid: topology/ioctl: fix uint64_t handling on 32bit systems
Thomas Weißschuh [Sun, 8 Jan 2023 03:09:37 +0000 (03:09 +0000)] 
libblkid: topology/ioctl: fix uint64_t handling on 32bit systems

2 years agolibblkid: topolicy/ioctl: use union for multiple data types
Thomas Weißschuh [Sun, 8 Jan 2023 03:08:09 +0000 (03:08 +0000)] 
libblkid: topolicy/ioctl: use union for multiple data types

2 years agoipc_msg_get_limits: always initialize memory
Thomas Weißschuh [Sat, 7 Jan 2023 14:36:11 +0000 (14:36 +0000)] 
ipc_msg_get_limits: always initialize memory

2 years agomkswap: make context_string const
Thomas Weißschuh [Sat, 7 Jan 2023 14:23:56 +0000 (14:23 +0000)] 
mkswap: make context_string const

Sometimes context_str() return `const char *`.

2 years agolibmount: ensure child hangs around until we persisted namespace
Christian Brauner [Sun, 8 Jan 2023 12:05:20 +0000 (13:05 +0100)] 
libmount: ensure child hangs around until we persisted namespace

When we create a new namespace in a child process to persist it we need
to ensure that the child hangs around. During exit the child will drop
all references to its namespaces and so by the time we call open we
might already fail to open the namespace. Fix this.

Signed-off-by: Christian Brauner (Microsoft) <brauner@kernel.org>
2 years agoschedutils: better illustrate the usage of cpu-lists with taskset
Alison Chaiken [Sun, 25 Dec 2022 17:37:02 +0000 (09:37 -0800)] 
schedutils: better illustrate the usage of cpu-lists with taskset

Provide a few examples of how to use the cpu-list variant of the taskset
command.

2 years agoschedutils: clarify meaning of taskset return code
Alison Chaiken [Sun, 25 Dec 2022 02:25:26 +0000 (18:25 -0800)] 
schedutils: clarify meaning of taskset return code

Make clear that an EXIT_SUCCESS value returned by taskset does not mean that a
thread has actually migrated to a core matching the affinity request.

2 years agoschedutils: clarify confusing mask example in taskset man page
Alison Chaiken [Sun, 25 Dec 2022 02:12:04 +0000 (18:12 -0800)] 
schedutils: clarify confusing mask example in taskset man page

Omit "0x" from a mask example which is clearly hexadecimal rather than omitting
it from "32", which could be a decimal representation.

2 years agoautotools: add asciidoctor-includetracker to distributed files
Thomas Weißschuh [Sat, 7 Jan 2023 02:54:01 +0000 (02:54 +0000)] 
autotools: add asciidoctor-includetracker to distributed files

2 years agoautotools: fix build for test_loopdev
Thomas Weißschuh [Sat, 7 Jan 2023 02:27:45 +0000 (02:27 +0000)] 
autotools: fix build for test_loopdev

2 years agomeson: fix test_sysfs build
Thomas Weißschuh [Sat, 7 Jan 2023 02:24:49 +0000 (02:24 +0000)] 
meson: fix test_sysfs build

2 years agoMerge branch 'waitpid' of https://github.com/t-8ch/util-linux
Karel Zak [Fri, 6 Jan 2023 16:05:04 +0000 (17:05 +0100)] 
Merge branch 'waitpid' of https://github.com/t-8ch/util-linux

* 'waitpid' of https://github.com/t-8ch/util-linux:
  waitpid: add timeout support
  strutils: add function strtotimespec_or_err

2 years agoRevert "CI: update gcc to 12"
Karel Zak [Fri, 6 Jan 2023 15:51:39 +0000 (16:51 +0100)] 
Revert "CI: update gcc to 12"

This reverts commit 85c376a4cd102d5c3619ad937fedf80b6527ce36.

2 years agomount: split and cleanup usage()
Karel Zak [Fri, 6 Jan 2023 15:07:34 +0000 (16:07 +0100)] 
mount: split and cleanup usage()

* split usage() strings to message-per-line (like we use in others
  tools), it's better for maintenance

* use fputs() rather than unnecessary printf()

Signed-off-by: Karel Zak <kzak@redhat.com>
2 years agolib/sysfs: use temporary buffer
Karel Zak [Fri, 6 Jan 2023 14:58:16 +0000 (15:58 +0100)] 
lib/sysfs: use temporary buffer

It seems more readable (for humans and static analyzers) and safe
to use temporary buffer than use memmove to create absolute path.

Signed-off-by: Karel Zak <kzak@redhat.com>
2 years agowaitpid: add timeout support
Thomas Weißschuh [Tue, 3 Jan 2023 23:57:53 +0000 (23:57 +0000)] 
waitpid: add timeout support

2 years agostrutils: add function strtotimespec_or_err
Thomas Weißschuh [Fri, 6 Jan 2023 14:36:37 +0000 (14:36 +0000)] 
strutils: add function strtotimespec_or_err

2 years agoMerge branch 'setarch/current' of https://github.com/t-8ch/util-linux
Karel Zak [Fri, 6 Jan 2023 12:07:11 +0000 (13:07 +0100)] 
Merge branch 'setarch/current' of https://github.com/t-8ch/util-linux

* 'setarch/current' of https://github.com/t-8ch/util-linux:
  setarch: show current personality

2 years agoMerge branch 'asciidoctor-tracker' of https://github.com/t-8ch/util-linux
Karel Zak [Fri, 6 Jan 2023 11:57:49 +0000 (12:57 +0100)] 
Merge branch 'asciidoctor-tracker' of https://github.com/t-8ch/util-linux

* 'asciidoctor-tracker' of https://github.com/t-8ch/util-linux:
  build: track dependencies of manpage generation

2 years agoMerge branch 'master' of https://github.com/jengelh/util-linux
Karel Zak [Fri, 6 Jan 2023 11:50:17 +0000 (12:50 +0100)] 
Merge branch 'master' of https://github.com/jengelh/util-linux

* 'master' of https://github.com/jengelh/util-linux:
  doc: update renice.1 for spelling and style

2 years agoMerge branch 'fix-stringutils-2' of https://github.com/t-8ch/util-linux
Karel Zak [Fri, 6 Jan 2023 11:34:39 +0000 (12:34 +0100)] 
Merge branch 'fix-stringutils-2' of https://github.com/t-8ch/util-linux

* 'fix-stringutils-2' of https://github.com/t-8ch/util-linux:
  lib/strutils: fix compiler error

2 years agolib/strutils: fix compiler error
Thomas Weißschuh [Fri, 6 Jan 2023 03:14:27 +0000 (03:14 +0000)] 
lib/strutils: fix compiler error

In file included from /usr/include/stdio.h:894,
                 from lib/strutils.c:8:
In function ‘printf’,
    inlined from ‘test_strutils_cstrcasecmp’ at lib/strutils.c:1324:2,
    inlined from ‘main’ at lib/strutils.c:1348:10:
/usr/include/x86_64-linux-gnu/bits/stdio2.h:112:10: error: ‘%s’ directive argument is null [-Werror=format-overflow=]
  112 |   return __printf_chk (__USE_FORTIFY_LEVEL - 1, __fmt, __va_arg_pack ());
      |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
cc1: all warnings being treated as errors

2 years agoCI: update gcc to 12
Thomas Weißschuh [Fri, 6 Jan 2023 03:00:29 +0000 (03:00 +0000)] 
CI: update gcc to 12

gcc 10 has false positives around null strings:

In file included from /usr/include/stdio.h:894,
                 from lib/strutils.c:8:
In function ‘printf’,
    inlined from ‘test_strutils_cstrcasecmp’ at lib/strutils.c:1324:2,
    inlined from ‘main’ at lib/strutils.c:1348:10:
/usr/include/x86_64-linux-gnu/bits/stdio2.h:112:10: error: ‘%s’ directive argument is null [-Werror=format-overflow=]
  112 |   return __printf_chk (__USE_FORTIFY_LEVEL - 1, __fmt, __va_arg_pack ());
      |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
cc1: all warnings being treated as errors

2 years agobuild: track dependencies of manpage generation
Thomas Weißschuh [Fri, 6 Jan 2023 02:34:09 +0000 (02:34 +0000)] 
build: track dependencies of manpage generation

This will rerun the manpage generation if any of the involved files have
been updated.

2 years agodoc: update renice.1 for spelling and style
Jan Engelhardt [Fri, 6 Jan 2023 00:40:53 +0000 (01:40 +0100)] 
doc: update renice.1 for spelling and style

Relates to issue #1892.

Signed-off-by: Jan Engelhardt <jengelh@inai.de>
2 years agosetarch: show current personality
Thomas Weißschuh [Wed, 21 Dec 2022 15:50:46 +0000 (15:50 +0000)] 
setarch: show current personality

2 years agolib/strutils: include strings.h
Karel Zak [Thu, 5 Jan 2023 15:01:11 +0000 (16:01 +0100)] 
lib/strutils: include strings.h

Signed-off-by: Karel Zak <kzak@redhat.com>
2 years agoMerge branch 'misc-utils-rename-symlink-paths' of https://github.com/ChickenProp...
Karel Zak [Thu, 5 Jan 2023 12:03:46 +0000 (13:03 +0100)] 
Merge branch 'misc-utils-rename-symlink-paths' of https://github.com/ChickenProp/util-linux

* 'misc-utils-rename-symlink-paths' of https://github.com/ChickenProp/util-linux:
  `rename -s` treats paths the same as without `-s`.

2 years agoMerge branch 'packit' of https://github.com/t-8ch/util-linux
Karel Zak [Thu, 5 Jan 2023 11:25:02 +0000 (12:25 +0100)] 
Merge branch 'packit' of https://github.com/t-8ch/util-linux

* 'packit' of https://github.com/t-8ch/util-linux:
  ci: run packit builds for commits on master and releases

2 years agoMerge branch 'libblkid/cache' of https://github.com/t-8ch/util-linux
Karel Zak [Thu, 5 Jan 2023 11:09:37 +0000 (12:09 +0100)] 
Merge branch 'libblkid/cache' of https://github.com/t-8ch/util-linux

* 'libblkid/cache' of https://github.com/t-8ch/util-linux:
  blkid: cache: add test

2 years agoMerge branch 'waitpid' of https://github.com/t-8ch/util-linux
Karel Zak [Wed, 4 Jan 2023 17:45:10 +0000 (18:45 +0100)] 
Merge branch 'waitpid' of https://github.com/t-8ch/util-linux

* 'waitpid' of https://github.com/t-8ch/util-linux:
  waitpid: add new command
  tests: add ts_skip_exitcode_not_supported
  exitcodes: add EXIT_NOTSUPP
  pidfd-utils: include wait.h for siginfo_t

2 years agolib/signames: ignore locales when searching for signal names
Karel Zak [Wed, 4 Jan 2023 17:37:26 +0000 (18:37 +0100)] 
lib/signames: ignore locales when searching for signal names

Fix: https://github.com/util-linux/util-linux/issues/1991
Signed-off-by: Karel Zak <kzak@redhat.com>
2 years agoinclude/cctype: add c_strcasecmp() and c_strncasecmp()
Karel Zak [Wed, 4 Jan 2023 17:34:03 +0000 (18:34 +0100)] 
include/cctype: add c_strcasecmp() and c_strncasecmp()

Sometimes, we need to compare ASCII-only strings independently on the
current locales. Let's follow our cctype.h to implement such functions.

Addresses: https://github.com/util-linux/util-linux/issues/1991
Signed-off-by: Karel Zak <kzak@redhat.com>
2 years agotests: (column) add range and negative numbers column addresses
Karel Zak [Wed, 4 Jan 2023 13:08:46 +0000 (14:08 +0100)] 
tests: (column) add range and negative numbers column addresses

Addresses: https://github.com/util-linux/util-linux/issues/1700
Signed-off-by: Karel Zak <kzak@redhat.com>
2 years agocolumn: support negative numbers in range
Karel Zak [Wed, 4 Jan 2023 12:59:08 +0000 (13:59 +0100)] 
column: support negative numbers in range

Fixes: https://github.com/util-linux/util-linux/issues/1700
Signed-off-by: Karel Zak <kzak@redhat.com>
2 years agolibmount: (mount) consolidate sysapi FDs close [coverity scan]
Karel Zak [Wed, 4 Jan 2023 12:21:17 +0000 (13:21 +0100)] 
libmount: (mount) consolidate sysapi FDs close [coverity scan]

Signed-off-by: Karel Zak <kzak@redhat.com>
2 years agolibmount: fix unused variable [coverity scan]
Karel Zak [Wed, 4 Jan 2023 12:13:21 +0000 (13:13 +0100)] 
libmount: fix unused variable [coverity scan]

Signed-off-by: Karel Zak <kzak@redhat.com>
2 years agolibmount: (idmap) fix leak and doble free [coverity scan]
Karel Zak [Wed, 4 Jan 2023 12:10:59 +0000 (13:10 +0100)] 
libmount: (idmap) fix leak and doble free [coverity scan]

Signed-off-by: Karel Zak <kzak@redhat.com>
2 years agolibmount: (subdir) fix memory leak [coverity scan]
Karel Zak [Wed, 4 Jan 2023 12:04:14 +0000 (13:04 +0100)] 
libmount: (subdir) fix memory leak [coverity scan]

Signed-off-by: Karel Zak <kzak@redhat.com>
2 years agolibmount: fix possible double free
Karel Zak [Wed, 4 Jan 2023 11:57:03 +0000 (12:57 +0100)] 
libmount: fix possible double free

Signed-off-by: Karel Zak <kzak@redhat.com>
2 years agolibmount: fix memory leak [coverity scan]
Karel Zak [Wed, 4 Jan 2023 11:35:27 +0000 (12:35 +0100)] 
libmount: fix memory leak [coverity scan]

Signed-off-by: Karel Zak <kzak@redhat.com>
2 years agolibmount: fix unused value [coverity scan]
Karel Zak [Wed, 4 Jan 2023 11:31:17 +0000 (12:31 +0100)] 
libmount: fix unused value [coverity scan]

Signed-off-by: Karel Zak <kzak@redhat.com>
2 years agolibmount: fix memory leak [coverity scan]
Karel Zak [Wed, 4 Jan 2023 11:28:44 +0000 (12:28 +0100)] 
libmount: fix memory leak [coverity scan]

Signed-off-by: Karel Zak <kzak@redhat.com>
2 years agolibmount: make NULL deference checks more consistent [coverity scan]
Karel Zak [Wed, 4 Jan 2023 11:25:11 +0000 (12:25 +0100)] 
libmount: make NULL deference checks more consistent [coverity scan]

Signed-off-by: Karel Zak <kzak@redhat.com>
2 years agowaitpid: add new command
Thomas Weißschuh [Sat, 24 Dec 2022 04:27:04 +0000 (04:27 +0000)] 
waitpid: add new command

This command implements waiting for the exit of multiple processes.
Especially it allows to wait for process that are not children of the
current process.

In contrast to wait(1P) it does not allow to retrieve the processes exit
codes.

2 years agotests: add ts_skip_exitcode_not_supported
Thomas Weißschuh [Wed, 4 Jan 2023 01:11:04 +0000 (01:11 +0000)] 
tests: add ts_skip_exitcode_not_supported

2 years agoci: run packit builds for commits on master and releases
Thomas Weißschuh [Mon, 2 Jan 2023 14:13:31 +0000 (14:13 +0000)] 
ci: run packit builds for commits on master and releases

2 years agoblkid: cache: add test
Thomas Weißschuh [Tue, 27 Dec 2022 05:04:23 +0000 (05:04 +0000)] 
blkid: cache: add test

2 years agoexitcodes: add EXIT_NOTSUPP
Thomas Weißschuh [Mon, 2 Jan 2023 13:58:03 +0000 (13:58 +0000)] 
exitcodes: add EXIT_NOTSUPP

2 years agopidfd-utils: include wait.h for siginfo_t
Thomas Weißschuh [Sun, 25 Dec 2022 05:19:32 +0000 (05:19 +0000)] 
pidfd-utils: include wait.h for siginfo_t

2 years ago`rename -s` treats paths the same as without `-s`.
Philip Hazelden [Tue, 3 Jan 2023 19:43:28 +0000 (19:43 +0000)] 
`rename -s` treats paths the same as without `-s`.

That is, it only updates the final path component, unless either the
expression or the replacement contains a '/'.

As discussed in #1962.

2 years agounshare: fix a --map-auto error message
Chris Webb [Sun, 25 Dec 2022 16:34:37 +0000 (16:34 +0000)] 
unshare: fix a --map-auto error message

When --map-auto is used by a user not listed in /etc/subuid, the error

  unshare: no line matching user "foo" in /etc/subuid: No error information

is emitted. Fix the stray ': No error information', correcting err() to
the intended errx().

Signed-off-by: Chris Webb <chris@arachsys.com>
2 years agoMerge branch 'libblkid-debug' of https://github.com/t-8ch/util-linux
Karel Zak [Tue, 3 Jan 2023 14:07:06 +0000 (15:07 +0100)] 
Merge branch 'libblkid-debug' of https://github.com/t-8ch/util-linux

* 'libblkid-debug' of https://github.com/t-8ch/util-linux:
  libblkid: remove strewn around calls to blkid_init_debug()
  libblkid: always initialize debugging

2 years agoMerge branch 'make-nice-posix-compliant' of https://github.com/kraptor/util-linux
Karel Zak [Tue, 3 Jan 2023 13:52:58 +0000 (14:52 +0100)] 
Merge branch 'make-nice-posix-compliant' of https://github.com/kraptor/util-linux

* 'make-nice-posix-compliant' of https://github.com/kraptor/util-linux:
  Changes for review
  renice: support posix-compliant -n (via POSIXLY_CORRECT) and add --relative flag

2 years agotools: update po/LINGUAS when downloading new translations
Karel Zak [Tue, 3 Jan 2023 13:39:10 +0000 (14:39 +0100)] 
tools: update po/LINGUAS when downloading new translations

Fix: https://github.com/util-linux/util-linux/issues/1985
Signed-off-by: Karel Zak <kzak@redhat.com>
2 years agopo: update ko.po (from translationproject.org)
Seong-ho Cho [Tue, 3 Jan 2023 13:38:15 +0000 (14:38 +0100)] 
po: update ko.po (from translationproject.org)

2 years agolibmount: use mount ID to merge utab and mountinfo files
Karel Zak [Tue, 29 Nov 2022 09:13:39 +0000 (10:13 +0100)] 
libmount: use mount ID to merge utab and mountinfo files

Signed-off-by: Karel Zak <kzak@redhat.com>
2 years agolibmount: remove unnecessary commented code
Karel Zak [Mon, 28 Nov 2022 12:44:37 +0000 (13:44 +0100)] 
libmount: remove unnecessary commented code

2 years agotests: check for loopdevs
Karel Zak [Wed, 23 Nov 2022 08:10:39 +0000 (09:10 +0100)] 
tests: check for loopdevs

Signed-off-by: Karel Zak <kzak@redhat.com>
2 years agolibmount: fix potentially uninitialized local variable [CodeQL]
Karel Zak [Tue, 22 Nov 2022 14:15:10 +0000 (15:15 +0100)] 
libmount: fix potentially uninitialized local variable [CodeQL]

Signed-off-by: Karel Zak <kzak@redhat.com>
2 years agomeson: update to build new libmount
Karel Zak [Tue, 22 Nov 2022 11:11:07 +0000 (12:11 +0100)] 
meson: update to build new libmount

Signed-off-by: Karel Zak <kzak@redhat.com>
2 years agolibmount: fix include
Karel Zak [Tue, 22 Nov 2022 11:10:44 +0000 (12:10 +0100)] 
libmount: fix include

Signed-off-by: Karel Zak <kzak@redhat.com>
2 years agobuild-sys: remove --enable-libmount-support-mtab
Karel Zak [Tue, 22 Nov 2022 10:46:20 +0000 (11:46 +0100)] 
build-sys: remove --enable-libmount-support-mtab

It's already removed from code, let's remove it from configure too.

Signed-off-by: Karel Zak <kzak@redhat.com>
2 years agobuild-sys: add --disable-libmount-mountfd-support
Karel Zak [Tue, 22 Nov 2022 10:41:58 +0000 (11:41 +0100)] 
build-sys: add --disable-libmount-mountfd-support

We need to disable support for new kernel API in libmount to test the
old code on new kernels (or maybe also for conservative users).

The new configure option disable only mount(2)-like operations, the
another stuff (like IDs mapping) is not affected.

Signed-off-by: Karel Zak <kzak@redhat.com>
2 years agotests: add complex mount test
Karel Zak [Thu, 20 Oct 2022 08:56:59 +0000 (10:56 +0200)] 
tests: add complex mount test

This test check complex tasks when one mount(8) call modifies VFS flags,
propagation flags and do some operation (bind, move, ...).

Signed-off-by: Karel Zak <kzak@redhat.com>
2 years agotests: fix test file name
Karel Zak [Thu, 20 Oct 2022 07:32:37 +0000 (09:32 +0200)] 
tests: fix test file name

Signed-off-by: Karel Zak <kzak@redhat.com>
2 years agotests: add X-mount.subdir test
Karel Zak [Tue, 18 Oct 2022 10:37:09 +0000 (12:37 +0200)] 
tests: add X-mount.subdir test

Signed-off-by: Karel Zak <kzak@redhat.com>
2 years agolibmount: (subdir) use new FD based API
Karel Zak [Tue, 18 Oct 2022 10:33:39 +0000 (12:33 +0200)] 
libmount: (subdir) use new FD based API

Signed-off-by: Karel Zak <kzak@redhat.com>
2 years agolibmount: add inline function to access API file descritors
Karel Zak [Tue, 18 Oct 2022 09:38:45 +0000 (11:38 +0200)] 
libmount: add inline function to access API file descritors

Signed-off-by: Karel Zak <kzak@redhat.com>
2 years agolibmount: (owner) call hooks when all mount stuff is done
Karel Zak [Wed, 12 Oct 2022 11:00:12 +0000 (13:00 +0200)] 
libmount: (owner) call hooks when all mount stuff is done

Signed-off-by: Karel Zak <kzak@redhat.com>
2 years agolibmount: fix new API code when use external helper
Karel Zak [Wed, 12 Oct 2022 10:23:48 +0000 (12:23 +0200)] 
libmount: fix new API code when use external helper

We don't want to call fsopen() or so if external /sbin/mount.<type>
helper is expected.

This patch also add fallback to propagation hook to open mount tree
if necessary.

Signed-off-by: Karel Zak <kzak@redhat.com>
2 years agolibmount: improve context deinitialization
Karel Zak [Wed, 12 Oct 2022 10:23:37 +0000 (12:23 +0200)] 
libmount: improve context deinitialization

Signed-off-by: Karel Zak <kzak@redhat.com>
2 years agolibmount: check for propagation-only in proper way
Karel Zak [Wed, 12 Oct 2022 09:15:25 +0000 (11:15 +0200)] 
libmount: check for propagation-only in proper way

Signed-off-by: Karel Zak <kzak@redhat.com>
2 years agolibmount: (mount) fix mount by FS list/pattern for new API
Karel Zak [Mon, 10 Oct 2022 14:08:29 +0000 (16:08 +0200)] 
libmount: (mount) fix mount by FS list/pattern for new API

Signed-off-by: Karel Zak <kzak@redhat.com>
2 years agolibmount: use AT_RECURSIVE only when clone tree
Karel Zak [Fri, 7 Oct 2022 10:18:03 +0000 (12:18 +0200)] 
libmount: use AT_RECURSIVE only when clone tree

It seems AT_RECURSIVE is usable for open_tree() only when
OPEN_TREE_CLONE specified too.

Signed-off-by: Karel Zak <kzak@redhat.com>
2 years agolibmount: (mount) use MOUNT_ATTR__ATIME
Karel Zak [Fri, 7 Oct 2022 09:26:07 +0000 (11:26 +0200)] 
libmount: (mount) use MOUNT_ATTR__ATIME

The atime related attributes for mount_setattr() requires MOUNT_ATTR__ATIME
in clear mask.

Signed-off-by: Karel Zak <kzak@redhat.com>
2 years agolibmount: fix mount -a to work with optlist
Karel Zak [Thu, 6 Oct 2022 10:02:41 +0000 (12:02 +0200)] 
libmount: fix mount -a to work with optlist

The original code uses libmnt_fs instance to store mount options. The
new uses libmnt_fs only for library API backward compatibility, but
internally it uses libmnt_optlist. Let's use optlist also to save
context template.

Signed-off-by: Karel Zak <kzak@redhat.com>
2 years agolibmount: don't refer optlist when copy libmnt_fs
Karel Zak [Thu, 6 Oct 2022 10:00:57 +0000 (12:00 +0200)] 
libmount: don't refer optlist when copy libmnt_fs

Signed-off-by: Karel Zak <kzak@redhat.com>
2 years agolibmount: fix external helps call
Karel Zak [Tue, 4 Oct 2022 11:34:42 +0000 (13:34 +0200)] 
libmount: fix external helps call

* always use rw/ro flags on helper command line
* don't return MNT_ERR_APPLYFLAGS, the flags are applied in post-mount stage

Signed-off-by: Karel Zak <kzak@redhat.com>
2 years agolibmount: (legacy) init regualer mount before propagation
Karel Zak [Tue, 4 Oct 2022 11:05:27 +0000 (13:05 +0200)] 
libmount: (legacy) init regualer mount before propagation

We have two ways how mount(2) is used, for propagation-only calls and
regular FS mount. The propagation-only code removes MS_PROPAGATION
flags from main mount options (=optlist), so any later decision about
propagation is impossible. We need to call propagation-only code as
the last thing. (Yes, new FD based mount(8) handles it better.)

Signed-off-by: Karel Zak <kzak@redhat.com>
2 years agolibmount: fix compilation without new API
Karel Zak [Tue, 4 Oct 2022 09:59:52 +0000 (11:59 +0200)] 
libmount: fix compilation without new API

Signed-off-by: Karel Zak <kzak@redhat.com>
2 years agotests: (libmount) update debug test
Karel Zak [Mon, 3 Oct 2022 13:44:04 +0000 (15:44 +0200)] 
tests: (libmount) update debug test

The debug mask is printed as 0x%06x number now.

References: 72e2f1ea8b7b90014118f4c9e55babb67528b986
Signed-off-by: Karel Zak <kzak@redhat.com>
2 years agotests: (libmount) remove unsupported test
Karel Zak [Mon, 3 Oct 2022 13:30:44 +0000 (15:30 +0200)] 
tests: (libmount) remove unsupported test

Signed-off-by: Karel Zak <kzak@redhat.com>
2 years agolibmount: initialize tb in is_mounted_same_loopfile()
Karel Zak [Mon, 3 Oct 2022 13:20:46 +0000 (15:20 +0200)] 
libmount: initialize tb in is_mounted_same_loopfile()

Signed-off-by: Karel Zak <kzak@redhat.com>
2 years agolibmount: (mount) implement remount by new Linux API
Karel Zak [Tue, 27 Sep 2022 10:56:57 +0000 (12:56 +0200)] 
libmount: (mount) implement remount by new Linux API

Signed-off-by: Karel Zak <kzak@redhat.com>
2 years agolibmount: (mount) create new FS instance by new Linux API
Karel Zak [Mon, 26 Sep 2022 13:22:57 +0000 (15:22 +0200)] 
libmount: (mount) create new FS instance by new Linux API

Signed-off-by: Karel Zak <kzak@redhat.com>
2 years agolibmount: (mount) support propagation by new kernel API
Karel Zak [Mon, 26 Sep 2022 07:45:04 +0000 (09:45 +0200)] 
libmount: (mount) support propagation by new kernel API

Signed-off-by: Karel Zak <kzak@redhat.com>
2 years agolibmount: support VFS flags attributes clear
Karel Zak [Thu, 22 Sep 2022 09:05:53 +0000 (11:05 +0200)] 
libmount: support VFS flags attributes clear

Signed-off-by: Karel Zak <kzak@redhat.com>
2 years agolibmount: (mount) fix recursion
Karel Zak [Wed, 21 Sep 2022 16:01:05 +0000 (18:01 +0200)] 
libmount: (mount) fix recursion

Signed-off-by: Karel Zak <kzak@redhat.com>
2 years agolibmount: (mount) use independent hooks
Karel Zak [Wed, 21 Sep 2022 15:28:36 +0000 (17:28 +0200)] 
libmount: (mount) use independent hooks

It seems better to reuse functions (hooks) to implement various
ways the mount is done. For example, attach to the tree is used
for move, bind, and new mount; set VFS flags is usable for all
operations, etc.

Complete mount(8) is a set (chain) of hooks that is possible to mix to
get the wanted result.

The new API allow for example things like

mount --move /A /B -oro,noexec

because it's

- open_tree()
- mount_setattr()
- move_tree()

Note that the hooks allow extend it to new functionality  without core
code modification (for example, X-mount.idmap= append a new hook to
call another mount_setattr()).

Signed-off-by: Karel Zak <kzak@redhat.com>
2 years agolibmount: remove upper-case from debug message
Karel Zak [Wed, 21 Sep 2022 15:28:28 +0000 (17:28 +0200)] 
libmount: remove upper-case from debug message

Signed-off-by: Karel Zak <kzak@redhat.com>
2 years agolibmount: add MOUNT_ATTR_NOSYMFOLLOW
Karel Zak [Wed, 21 Sep 2022 15:27:15 +0000 (17:27 +0200)] 
libmount: add MOUNT_ATTR_NOSYMFOLLOW

Signed-off-by: Karel Zak <kzak@redhat.com>
2 years agolibmount: (mount) improve syscalls status handling
Karel Zak [Wed, 21 Sep 2022 09:39:13 +0000 (11:39 +0200)] 
libmount: (mount) improve syscalls status handling

The new kernel API is composed from more syscalls, but libmount
originally assumes one syscall and one place where we need to remember
return value of the syscall. It seems the best will be to set the
status after each mount related syscall call (fsopen(), move_mount(),
...) until we reach error or end of mount  process.

For better error messages the last failed mount related syscall name
will be recorded in cxt->syscall_name.

Signed-off-by: Karel Zak <kzak@redhat.com>
2 years agolibmount: (mount) support --move by new kernel API
Karel Zak [Wed, 21 Sep 2022 09:07:25 +0000 (11:07 +0200)] 
libmount: (mount) support --move by new kernel API

* support --move in new mount implementation

* remember errno from mount related failed syscalls

Signed-off-by: Karel Zak <kzak@redhat.com>
2 years agolibmount: add MS_MOVE to options map
Karel Zak [Wed, 21 Sep 2022 09:03:54 +0000 (11:03 +0200)] 
libmount: add MS_MOVE to options map

libmount originally had in the options map only options that are
possible to use in fstab. Now we use the map to verify and
classify all mount options, so MS_MOVE is necessary there too.

The patch also add a new MNT_NOFSTAB option flag, not used for now.

Signed-off-by: Karel Zak <kzak@redhat.com>