Compare commits

...
Sign in to create a new pull request.

84 commits

Author SHA1 Message Date
Karel Zak
e98ef85a8f build-sys: release++ (v2.39.1)
Some checks failed
Build test / build (map[COMPILER:clang COMPILER_VERSION:15 SANITIZE:no]) (push) Has been cancelled
Build test / build (map[COMPILER:clang COMPILER_VERSION:15 SANITIZE:yes]) (push) Has been cancelled
Build test / build (map[COMPILER:gcc COMPILER_VERSION:10 SANITIZE:no]) (push) Has been cancelled
Build test / build (map[COMPILER:gcc COMPILER_VERSION:10 SANITIZE:yes]) (push) Has been cancelled
Build test / coveralls (push) Has been cancelled
Build test / meson (push) Has been cancelled
Build test / distcheck (push) Has been cancelled
Build test / build (qemu-user, riscv64) (push) Has been cancelled
Build test / build (qemu-user, s390x) (push) Has been cancelled
Signed-off-by: Karel Zak <kzak@redhat.com>
2023-06-27 14:31:13 +02:00
Karel Zak
12169133ee docs: update v2.39.1-ReleaseNotes
Signed-off-by: Karel Zak <kzak@redhat.com>
2023-06-27 14:30:01 +02:00
Karel Zak
508e251108 docs: update AUTHORS file
Signed-off-by: Karel Zak <kzak@redhat.com>
2023-06-27 14:16:53 +02:00
Karel Zak
6b865e1b01 po-man: merge changes
Signed-off-by: Karel Zak <kzak@redhat.com>
2023-06-27 14:14:17 +02:00
Karel Zak
aa4f94cb56 po: merge changes
Signed-off-by: Karel Zak <kzak@redhat.com>
2023-06-27 14:14:10 +02:00
Remus-Gabriel Chelu
cad75b6356 po-man: add ro.po (from translationproject.org) 2023-06-27 14:08:33 +02:00
Seong-ho Cho
8acfe93b77 po-man: add ko.po (from translationproject.org) 2023-06-27 14:08:33 +02:00
Yuri Chornoivan
5f31e774c5 po-man: update uk.po (from translationproject.org) 2023-06-27 14:08:33 +02:00
Božidar Putanec
29626b0956 po: update hr.po (from translationproject.org) 2023-06-27 14:05:10 +02:00
Jakub Wilk
90835e74a8 cal: fix long option name for -c 2023-06-27 10:32:20 +02:00
Jakub Wilk
7826c3ebee cal: fix error message for bad -c argument 2023-06-27 10:32:20 +02:00
Jakub Wilk
07e6b9a127 lib/strutils: fix typo 2023-06-27 10:32:04 +02:00
Karel Zak
cc99bfd06a 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>
2023-06-26 12:46:15 +02:00
Karel Zak
3b59942da4 logger: initialize socket credentials contol union
Addresses: https://github.com/util-linux/util-linux/issues/2336
Signed-off-by: Karel Zak <kzak@redhat.com>
2023-06-26 12:02:51 +02:00
Thomas Weißschuh
4746cf9368 unshare: fix error message for unexpected time offsets
Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
2023-06-26 12:02:32 +02:00
Thomas Weißschuh
a34e6aced4 losetup: deduplicate find_unused() logic
Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
2023-06-26 12:02:15 +02:00
Thomas Weißschuh
423d9efabb lib/loopdev: consistently return error values from loopcxt_find_unused()
Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
2023-06-26 12:02:15 +02:00
Thomas Weißschuh
8feec98a8f lib/loopdev: document function return values
Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
2023-06-26 12:02:15 +02:00
Thomas Weißschuh
36ce0c2501 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>
2023-06-26 12:01:41 +02:00
Jakub Wilk
1943ad6cd5 hardlink: (man) add missing comma 2023-06-26 12:01:25 +02:00
Karel Zak
174f2b3904 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
2023-06-26 12:00:41 +02:00
Karel Zak
1a4522541b 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>
2023-06-26 12:00:12 +02:00
Masatake YAMATO
3aba3fb95b tests: (lsfd) add a case for verifying ENDPOINTS column output in JSON mode
Signed-off-by: Masatake YAMATO <yamato@redhat.com>
2023-06-23 00:57:14 +09:00
Masatake YAMATO
c289c152a3 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>
2023-06-23 00:51:36 +09:00
Masatake YAMATO
665e28c302 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>
2023-06-22 19:37:44 +09:00
Karel Zak
d9fca2b62e sfdisk: add hint about duplicate UUIDs when use dump
Signed-off-by: Karel Zak <kzak@redhat.com>
2023-06-21 10:58:56 +02:00
Karel Zak
d84ee5a461 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>
2023-06-20 13:30:07 +02:00
Karel Zak
c50da4b07a 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>
2023-06-20 13:29:29 +02:00
Karel Zak
d5adeed7a2 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>
2023-06-20 13:27:38 +02:00
Karel Zak
868f7f10ce tests: fix update special mount test output
Signed-off-by: Karel Zak <kzak@redhat.com>
2023-06-19 14:56:30 +02:00
Karel Zak
2278e2f913 tests: backport special mount script
Signed-off-by: Karel Zak <kzak@redhat.com>
2023-06-19 14:36:59 +02:00
Karel Zak
d8a4e680f3 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: fe0b1e793c
Addresses: https://github.com/util-linux/util-linux/issues/2315
Signed-off-by: Karel Zak <kzak@redhat.com>
2023-06-19 14:28:37 +02:00
Karel Zak
f5765e238b
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
2023-06-19 11:12:55 +02:00
Christian Hesse
22d0a65571 meson: check for _NL_TIME_WEEK_1STDAY in langinfo.h
... which is required for `cal`.

Fixes GH-2316
2023-06-17 15:29:38 +02:00
Zbigniew Jędrzejewski-Szmek
205e88e51c meson: conditionalize waitpid
I *think* this mirros what configure.ac does, except that the configuration
option is not implemented.

(cherry picked from commit 334939a19d)
2023-06-14 12:18:58 +02:00
Zbigniew Jędrzejewski-Szmek
aebfa97d54 meson: add conditionalization for test progs
This just mirrors what the autotools setup is doing.

(cherry picked from commit d6418774ab)
2023-06-14 12:18:58 +02:00
Zbigniew Jędrzejewski-Szmek
bbe24d5b10 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 444753601c)
2023-06-14 10:29:47 +02:00
Christian Hesse
bc58e3b35d meson: install write setgid
... as this requires elevated privileges.

(cherry picked from commit cee78467be)
2023-06-14 10:29:18 +02:00
Christian Hesse
f5a411883d meson: install wall setgid
... as this requires elevated privileges.

(cherry picked from commit 07641fd93c)
2023-06-14 10:29:18 +02:00
Christian Hesse
64e67f720f meson: install umount setuid
... as this requires elevated privileges.

(cherry picked from commit 1cb3c90ca5)
2023-06-14 10:29:18 +02:00
Christian Hesse
4c3c050064 meson: install mount setuid
... as this requires elevated privileges.

(cherry picked from commit 8f49b3693d)
2023-06-14 10:29:18 +02:00
Christian Hesse
58c107277a meson: install newgrp setuid
... as this requires elevated privileges.

(cherry picked from commit cb3dee5a14)
2023-06-14 10:29:18 +02:00
Christian Hesse
8549017af9 meson: install su setuid
... as this requires elevated privileges.

(cherry picked from commit fb8c224eae)
2023-06-14 10:29:18 +02:00
Christian Hesse
fa818dc8df meson: install chsh setuid
... as this requires elevated privileges.

(cherry picked from commit a13574b1de)
2023-06-14 10:29:18 +02:00
Christian Hesse
1e9fc724e4 meson: install chfn setuid
... as this requires elevated privileges.

(cherry picked from commit 60d457f529)
2023-06-14 10:29:18 +02:00
Karel Zak
53ff0fcdab 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>
2023-06-12 13:46:50 +02:00
Karel Zak
1a4b5c832c 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
2023-06-12 12:22:55 +02:00
Thomas Weißschuh
61307a950f libmount: (optlist) correctly detect ro status
Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
2023-06-11 11:51:27 +02:00
Karel Zak
8c85b08057 tests: backport mount_setattr test
Signed-off-by: Karel Zak <kzak@redhat.com>
2023-06-05 12:48:34 +02:00
Milan Broz
5004732d8c libblkid: jfs - avoid undefined shift
Fix previous commit 04a0717b0b
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>
2023-06-05 12:08:25 +02:00
Thomas Weißschuh
c082e6182f build-sys: fix typo in waitpid check
Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
2023-06-05 12:07:00 +02:00
Hennie Botha
b04446bfd4 Update fsck.8.adoc
Typo
2023-06-05 12:04:41 +02:00
anteater
9429cc72b5 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
2023-06-05 12:04:02 +02:00
ThomasKaiser
198fd3fb2c Fix Blizzard-M2-Max 2023-06-05 12:03:33 +02:00
ThomasKaiser
20c04a5097 Add recent Apple ARM cores 2023-06-05 12:03:17 +02:00
Karel Zak
9d4d768f2d 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>
2023-06-05 12:02:15 +02:00
Christian Hesse
98ed3edf8e meson: install symlink for vigr man page 2023-06-05 12:00:05 +02:00
Christian Hesse
f25cc33724 meson: include bash-completion for write 2023-06-05 11:59:55 +02:00
Christian Hesse
760c016418 meson: include bash-completion for newgrp 2023-06-05 11:59:45 +02:00
Karel Zak
ddf48064fb libmount: cleanup enosys returns from mount hoop
Signed-off-by: Karel Zak <kzak@redhat.com>
2023-06-05 11:59:15 +02:00
Karel Zak
230459358a 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>
2023-06-05 11:58:46 +02:00
Karel Zak
6fa034d0a9 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>
2023-06-05 11:57:52 +02:00
Thomas Weißschuh
f8c9ef62e4 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>
2023-06-05 11:57:07 +02:00
Thomas Weißschuh
9422991c92 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>
2023-06-05 11:55:24 +02:00
Frantisek Sumsal
2806759b5a 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.
2023-06-05 11:53:35 +02:00
наб
01e3ec5150 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").
2023-06-05 11:51:08 +02:00
Karel Zak
16e5dccf83 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
2023-06-05 11:49:47 +02:00
Thomas Weißschuh
00a19fb8cd libblkid: (bcache) also calculate checksum over journal buckets
Fixes #2291

Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
2023-06-03 18:47:16 +02:00
Thomas Weißschuh
158639a2a4 libblkid: (bcache) extend superblock definition
We will need it for the correct checksum calculation.

Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
2023-06-03 18:44:57 +02:00
Thomas Weißschuh
43926e0b04 ci: prevent prompts during installation
Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
2023-06-01 12:16:34 +02:00
Thomas Weißschuh
01bb5d12d7 tools: (asciidoctor) explicitly require extensions module
This is needed for older versions of asciidoctor.

Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
2023-06-01 12:16:34 +02:00
Thomas Weißschuh
da22c179c2 build-sys: only pass --failure-level if supported
Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
2023-06-01 12:16:34 +02:00
Thomas Weißschuh
1bfc285fa0 lsfd: (tests) fix typo
Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
2023-06-01 12:16:34 +02:00
Thomas Weißschuh
66fac3e71f 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>
2023-06-01 12:16:34 +02:00
Thomas Weißschuh
d2e3ac9595 enosys: add support for loongarch
Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
2023-06-01 12:16:34 +02:00
Thomas Weißschuh
a369feacc5 meson: require 0.57
It is needed for fs.read()

Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
2023-06-01 12:16:34 +02:00
Thomas Weißschuh
f084562c36 enosys: split audit arch detection into dedicated header
Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
2023-06-01 12:16:34 +02:00
Thomas Weißschuh
88f76e37a2 enosys: add support for sparc
Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
2023-06-01 12:16:34 +02:00
Thomas Weißschuh
f65c49002f 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>
2023-06-01 12:16:34 +02:00
Thomas Weißschuh
ddf9b36ea4 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>
2023-06-01 12:16:34 +02:00
Thomas Weißschuh
0d0766fbe5 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>
2023-06-01 12:16:34 +02:00
Thomas Weißschuh
873a896e02 mkfs.minix: handle 64bit time on 32bit system
Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
2023-06-01 12:16:34 +02:00
Thomas Weißschuh
69d8400e40 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>
2023-06-01 12:16:34 +02:00
Thomas Weißschuh
0ee8ac0652 test_enosys: fix build on old kernels
Fixes #2277

Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
2023-05-31 09:32:50 +02:00
124 changed files with 93397 additions and 15138 deletions

View file

@ -2,6 +2,8 @@
set -ex
export DEBIAN_FRONTEND=noninteractive
apt-get -y update --fix-missing
# Xenial uses btrfs-tools, but since Focal it's btrfs-progs

View file

@ -397,6 +397,7 @@ CONTRIBUTORS:
Helmut Grohne <helmut@subdivi.de>
Hendrik Lönngren <wikibugs@googlemail.com>
Henne Vogelsang <hvogel@opensuse.org>
Hennie Botha <42469385+theHenMan@users.noreply.github.com>
Hideki EIRAKU <hdk@igel.co.jp>
Hill Ma <maahiuzeon@gmail.com>
Hiroaki Sengoku <sengoku@senri.gcd.org>
@ -750,6 +751,7 @@ CONTRIBUTORS:
ratijas <me@ratijas.tk>
Raul Gutierrez Segales <rgs@itevenworks.net>
Ray Wang <wanglei1123@gmail.com>
Remus-Gabriel Chelu <remusgabriel.chelu@disroot.org>
Rian Hunter <rian@alum.mit.edu>
Richard Allen <rsaxvc@rsaxvc.net>
Richard Fuchs <rfuchs@sipwise.com>

View file

@ -0,0 +1,117 @@
util-linux v2.39.1 Release Notes
================================
The main objective of this maintenance release is to address bugs in libmount and
resolve the regression that occurred due to the v2.39 rewrite for the new kernel
mount interface.
The meson build system has also been enhanced.
Changes between v2.39 and v2.39.1
---------------------------------
blkzone:
- don't take address of struct blk_zone [Thomas Weißschuh]
build-sys:
- add --disable-waitpid [Frantisek Sumsal]
- don't call pkg-config --static if unnecessary [Karel Zak]
- fix typo in waitpid check [Thomas Weißschuh]
- only pass --failure-level if supported [Thomas Weißschuh]
cal:
- fix error message for bad -c argument [Jakub Wilk]
- fix long option name for -c [Jakub Wilk]
ci:
- prevent prompts during installation [Thomas Weißschuh]
dmesg:
- make kmsg read() buffer big enough for kernel [anteater]
docs:
- update AUTHORS file [Karel Zak]
enosys:
- add support for MIPS, PowerPC and ARC [Thomas Weißschuh]
- add support for loongarch [Thomas Weißschuh]
- add support for sparc [Thomas Weißschuh]
- split audit arch detection into dedicated header [Thomas Weißschuh]
hardlink:
- (man) add missing comma [Jakub Wilk]
lib:
- remove pager.c from libcommon [Karel Zak]
lib/ include/:
- cleanup license headers [Karel Zak]
lib/color-names:
- fix license header [Karel Zak]
lib/loopdev:
- consistently return error values from loopcxt_find_unused() [Thomas Weißschuh]
- document function return values [Thomas Weißschuh]
lib/strutils:
- fix typo [Jakub Wilk]
libblkid:
- (bcache) also calculate checksum over journal buckets [Thomas Weißschuh]
- (bcache) extend superblock definition [Thomas Weißschuh]
- jfs - avoid undefined shift [Milan Broz]
libmount:
- (optlist) correctly detect ro status [Thomas Weißschuh]
- always ignore user=<name> [Karel Zak]
- check for availability of mount_setattr [Thomas Weißschuh]
- cleanup enosys returns from mount hoop [Karel Zak]
- don't call hooks after mount.<type> helper [Karel Zak]
- don't call mount.<type> helper with usernames [Karel Zak]
- don't pass option "defaults" to helper [Thomas Weißschuh]
- fix options prepend/insert and merging [Karel Zak]
- fix sync options between context and fs structs [Karel Zak]
- introduce LIBMOUNT_FORCE_MOUNT2={always,never,auto} [Karel Zak]
libsmartcols:
- (samples) fix format truncation warning [Thomas Weißschuh]
logger:
- initialize socket credentials contol union [Karel Zak]
losetup:
- deduplicate find_unused() logic [Thomas Weißschuh]
lsfd:
- (filter) weakly support ARRAY_STRING and ARRAY_NUMBER json types [Masatake YAMATO]
- (tests) fix typo [Thomas Weißschuh]
- use ARRAY_STRING for ENDPOINTS column in JSON output mode [Masatake YAMATO]
meson:
- add conditionalization for test progs [Zbigniew Jędrzejewski-Szmek]
- check for _NL_TIME_WEEK_1STDAY in langinfo.h [Christian Hesse]
- conditionalize waitpid [Zbigniew Jędrzejewski-Szmek]
- implement HAVE_PTY [Zbigniew Jędrzejewski-Szmek]
- include bash-completion for newgrp [Christian Hesse]
- include bash-completion for write [Christian Hesse]
- install chfn setuid [Christian Hesse]
- install chsh setuid [Christian Hesse]
- install mount setuid [Christian Hesse]
- install newgrp setuid [Christian Hesse]
- install su setuid [Christian Hesse]
- install symlink for vigr man page [Christian Hesse]
- install umount setuid [Christian Hesse]
- install wall setgid [Christian Hesse]
- install write setgid [Christian Hesse]
- require 0.57 [Thomas Weißschuh]
mkfs.minix:
- handle 64bit time on 32bit system [Thomas Weißschuh]
po:
- merge changes [Karel Zak]
- update hr.po (from translationproject.org) [Božidar Putanec]
po-man:
- add ko.po (from translationproject.org) [Seong-ho Cho]
- add ro.po (from translationproject.org) [Remus-Gabriel Chelu]
- merge changes [Karel Zak]
- update uk.po (from translationproject.org) [Yuri Chornoivan]
sfdisk:
- add hint about duplicate UUIDs when use dump [Karel Zak]
test_enosys:
- fix build on old kernels [Thomas Weißschuh]
test_uuidd:
- make pthread_t formatting more robust [Thomas Weißschuh]
tests:
- (lsfd) add a case for verifying ENDPOINTS column output in JSON mode [Masatake YAMATO]
- (run.sh) detect builddir from working directory [Thomas Weißschuh]
- backport mount_setattr test [Karel Zak]
- backport special mount script [Karel Zak]
- fix update special mount test output [Karel Zak]
tools:
- (asciidoctor) explicitly require extensions module [Thomas Weißschuh]
unshare:
- fix error message for unexpected time offsets [Thomas Weißschuh]
waitpid:
- only build when pidfd_open is available [Thomas Weißschuh]

View file

@ -230,10 +230,13 @@ asciidoc_man_cmd = $(ASCIIDOCTOR) \
-a 'package-docdir=$(docdir)' \
-a 'VERSION=$(VERSION)' \
-a 'ADJTIME_PATH=$(ADJTIME_PATH)' \
--failure-level ERROR \
--load-path '$(abs_srcdir)/tools' \
--require asciidoctor-includetracker
if HAVE_ASCIIDOCTOR_FAILURE_LEVEL
asciidoc_man_cmd += --failure-level ERROR
endif
SUFFIXES = .1.adoc .3.adoc .5.adoc .8.adoc .1 .3 .5 .8
.1.adoc.1 .3.adoc.3 .5.adoc.5 .8.adoc.8:
$(AM_V_GEN) test -f ./$@ || \

4
NEWS
View file

@ -1,3 +1,7 @@
util-linux 2.39.1: Jun 27 2023
* see Documentation/releases/v2.39.1-ReleaseNotes or the complete changelog at
https://www.kernel.org/pub/linux/utils/util-linux/v2.39/v2.39.1-ChangeLog
util-linux 2.39: May 17 2023
* see Documentation/releases/v2.39-ReleaseNotes or the complete changelog at
https://www.kernel.org/pub/linux/utils/util-linux/v2.39/v2.39-ChangeLog

View file

@ -29,7 +29,7 @@ PACKAGE_VERSION_RELEASE=$(echo $PACKAGE_VERSION | awk -F. '{
dnl libblkid version
LIBBLKID_VERSION="$PACKAGE_VERSION_MAJOR.$PACKAGE_VERSION_MINOR.$PACKAGE_VERSION_RELEASE"
LIBBLKID_DATE="17-May-2023"
LIBBLKID_DATE="27-Jun-2023"
LIBBLKID_LT_MAJOR=1
LIBBLKID_LT_MINOR=1
LIBBLKID_LT_MICRO=0
@ -802,6 +802,17 @@ AC_ARG_ENABLE([asciidoc],
UL_BUILD_INIT([asciidoc])
UL_REQUIRES_PROGRAM([asciidoc], [ASCIIDOCTOR], [asciidoctor], [man pages])
AM_CONDITIONAL([ENABLE_ASCIIDOC], [test "x$build_asciidoc" = xyes])
have_asciidoctor_failure_level=no
AS_IF([test "x$build_asciidoc" = xyes], [
AC_MSG_CHECKING([whether ${ASCIIDOCTOR} supports --failure-level])
AS_IF([${ASCIIDOCTOR} --help | grep failure-level >/dev/null 2>&1 ], [
AC_MSG_RESULT([yes])
have_asciidoctor_failure_level=yes
], [
AC_MSG_RESULT([no])
])
])
AM_CONDITIONAL([HAVE_ASCIIDOCTOR_FAILURE_LEVEL], [test "x$have_asciidoctor_failure_level" = xyes])
have_manpages=no
AS_IF([test -f "$srcdir/sys-utils/mount.8"], [
@ -1847,8 +1858,13 @@ UL_BUILD_INIT([fadvise], [check])
UL_REQUIRES_LINUX([fadvise])
AM_CONDITIONAL([BUILD_FADVISE], [test "x$build_fadvise" = xyes])
UL_BUILD_INIT([waitpid], [check])
AC_ARG_ENABLE([waitpid],
AS_HELP_STRING([--disable-waitpid], [do not build waitpid]),
[], [UL_DEFAULT_ENABLE([waitpid], [check])]
)
UL_BUILD_INIT([waitpid])
UL_REQUIRES_LINUX([waitpid])
UL_REQUIRES_SYSCALL_CHECK([waitpid], [UL_CHECK_SYSCALL([pidfd_open])], [pidfd_open])
AM_CONDITIONAL([BUILD_WAITPID], [test "x$build_waitpid" = xyes])
UL_BUILD_INIT([getopt], [yes])

View file

@ -157,7 +157,9 @@ fdisk_SOURCES = \
disk-utils/fdisk.h \
disk-utils/fdisk-menu.c \
disk-utils/fdisk-list.c \
disk-utils/fdisk-list.h
disk-utils/fdisk-list.h \
include/pager.h \
lib/pager.c
fdisk_LDADD = $(LDADD) libcommon.la libfdisk.la \
libsmartcols.la libtcolors.la $(READLINE_LIBS)

View file

@ -20,7 +20,7 @@ fsck - check and repair a Linux filesystem
== DESCRIPTION
*fsck* is used to check and optionally repair one or more Linux filesystems. _filesystem_ can be a device name (e.g., _/dev/hdc1_, _/dev/sdb2_), a mount point (e.g., _/_, _/usr_, _/home_), or an filesystem label or UUID specifier (e.g., UUID=8868abf6-88c5-4a83-98b8-bfc24057f7bd or LABEL=root). Normally, the *fsck* program will try to handle filesystems on different physical disk drives in parallel to reduce the total amount of time needed to check all of them.
*fsck* is used to check and optionally repair one or more Linux filesystems. _filesystem_ can be a device name (e.g., _/dev/hdc1_, _/dev/sdb2_), a mount point (e.g., _/_, _/usr_, _/home_), or a filesystem label or UUID specifier (e.g., UUID=8868abf6-88c5-4a83-98b8-bfc24057f7bd or LABEL=root). Normally, the *fsck* program will try to handle filesystems on different physical disk drives in parallel to reduce the total amount of time needed to check all of them.
If no filesystems are specified on the command line, and the *-A* option is not specified, *fsck* will default to checking filesystems in _/etc/fstab_ serially. This is equivalent to the *-As* options.

View file

@ -69,7 +69,8 @@ fdisk_sources = files(
'fdisk.h',
'fdisk-menu.c',
'fdisk-list.c',
'fdisk-list.h')
'fdisk-list.h') + \
pager_c
sfdisk_sources = files(
'sfdisk.c',

View file

@ -157,9 +157,9 @@ static void __attribute__((__noreturn__)) usage(void)
static inline time_t mkfs_minix_time(time_t *t)
{
const char *str = getenv("MKFS_MINIX_TEST_SECOND_SINCE_EPOCH");
time_t sec;
uint64_t sec;
if (str && sscanf(str, "%ld", &sec) == 1)
if (str && sscanf(str, "%"SCNd64, &sec) == 1)
return sec;
return time(t);
}

View file

@ -366,6 +366,8 @@ ____
*sfdisk /dev/sda < sda.dump*
____
Note that sfdisk completely restores partition types and partition UUIDs. This could potentially become problematic if you duplicate the same layout to different disks, as it may result in duplicate UUIDs within your system.
=== Full binary backup
If you want to do a full binary backup of all sectors where the partition table is stored, then use the *--backup-pt-sectors* command. It writes the sectors to _~/sfdisk-<device>-<offset>.bak_ files. The default name of the backup file can be changed with the *--backup-file* option. The backup files contain only raw data from the _device_. For example:

View file

@ -1,6 +1,7 @@
dist_noinst_HEADERS += \
include/all-io.h \
include/audit-arch.h \
include/bitops.h \
include/blkdev.h \
include/buffer.h \

64
include/audit-arch.h Normal file
View file

@ -0,0 +1,64 @@
/*
* Copyright (C) 2023 Thomas Weißschuh <thomas@t-8ch.de>
*
* This file may be distributed under the terms of the
* GNU Lesser General Public License.
*/
#ifndef UTIL_LINUX_AUDIT_ARCH_H
#define UTIL_LINUX_AUDIT_ARCH_H
#if __x86_64__
# define SECCOMP_ARCH_NATIVE AUDIT_ARCH_X86_64
#elif __i386__
# define SECCOMP_ARCH_NATIVE AUDIT_ARCH_I386
#elif __arm__
# define SECCOMP_ARCH_NATIVE AUDIT_ARCH_ARM
#elif __aarch64__
# define SECCOMP_ARCH_NATIVE AUDIT_ARCH_AARCH64
#elif __riscv
# if __riscv_xlen == 32
# define SECCOMP_ARCH_NATIVE AUDIT_ARCH_RISCV32
# elif __riscv_xlen == 64
# define SECCOMP_ARCH_NATIVE AUDIT_ARCH_RISCV64
# endif
#elif __s390x__
# define SECCOMP_ARCH_NATIVE AUDIT_ARCH_S390X
#elif __s390__
# define SECCOMP_ARCH_NATIVE AUDIT_ARCH_S390
#elif __PPC64__
# if __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__
# define SECCOMP_ARCH_NATIVE AUDIT_ARCH_PPC64
# else
# define SECCOMP_ARCH_NATIVE AUDIT_ARCH_PPC64LE
# endif
#elif __powerpc__
# define SECCOMP_ARCH_NATIVE AUDIT_ARCH_PPC
#elif __mips__
# if __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__
# define SECCOMP_ARCH_NATIVE AUDIT_ARCH_MIPS
# else
# define SECCOMP_ARCH_NATIVE AUDIT_ARCH_MIPSEL
# endif
#elif __arc__
# if __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__
# define SECCOMP_ARCH_NATIVE AUDIT_ARCH_ARCV2BE
# else
# define SECCOMP_ARCH_NATIVE AUDIT_ARCH_ARCV2
# endif
#elif __sparc__
# if __SIZEOF_POINTER__ == 4
# define SECCOMP_ARCH_NATIVE AUDIT_ARCH_SPARC
# else
# define SECCOMP_ARCH_NATIVE AUDIT_ARCH_SPARC64
# endif
#elif __loongarch__
# if __SIZEOF_POINTER__ == 4
# define SECCOMP_ARCH_NATIVE AUDIT_ARCH_LOONGARCH32
# else
# define SECCOMP_ARCH_NATIVE AUDIT_ARCH_LOONGARCH64
# endif
#else
# error Unknown target architecture
#endif
#endif /* UTIL_LINUX_AUDIT_ARCH_H */

View file

@ -1,8 +1,8 @@
/*
* Copyright (C) 2012-2015 Karel Zak <kzak@redhat.com>
* No copyright is claimed. This code is in the public domain; do with
* it what you wish.
*
* This file may be distributed under the terms of the
* GNU Lesser General Public License.
* Copyright (C) 2012-2015 Karel Zak <kzak@redhat.com>
*/
#ifndef UTIL_LINUX_COLOR_NAMES_H
#define UTIL_LINUX_COLOR_NAMES_H

View file

@ -1,4 +1,6 @@
/*
* SPDX-License-Identifier: LGPL-2.1-or-later
*
* Copyright (C) 2012 Ondrej Oprala <ooprala@redhat.com>
* Copyright (C) 2012-2014 Karel Zak <kzak@redhat.com>
*

View file

@ -1,4 +1,6 @@
/*
* SPDX-License-Identifier: LGPL-2.1-or-later
*
* This file may be redistributed under the terms of the
* GNU Lesser General Public License.
*/

View file

@ -1,3 +1,7 @@
/*
* No copyright is claimed. This code is in the public domain; do with
* it what you wish.
*/
#ifndef UTIL_LINUX_ENV_H
#define UTIL_LINUX_ENV_H

View file

@ -1,19 +1,15 @@
/* Align/Truncate a string in a given screen width
Copyright (C) 2009-2010 Free Software Foundation, Inc.
Copyright (C) 2010-2013 Karel Zak <kzak@redhat.com>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation, either version 2.1 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. */
/*
* SPDX-License-Identifier: LGPL-2.1-or-later
*
* Align/Truncate a string in a given screen width
* Copyright (C) 2009-2010 Free Software Foundation, Inc.
* Copyright (C) 2010-2013 Karel Zak <kzak@redhat.com>
*
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as published by the
* Free Software Foundation, either version 2.1 of the License, or (at your
* option) any later version.
*/
#ifndef UTIL_LINUX_MBSALIGN_H
# define UTIL_LINUX_MBSALIGN_H
# include <stddef.h>

View file

@ -1,26 +1,17 @@
/***
SPDX-License-Identifier: LGPL-2.1-or-later
First set of functions in this file are part of systemd, and were
copied to util-linux at August 2013.
Copyright 2010 Lennart Poettering
Copyright (C) 2014 Karel Zak <kzak@redhat.com>
systemd is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 2.1 of the License, or
(at your option) any later version.
systemd is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with systemd; If not, see <http://www.gnu.org/licenses/>.
***/
/*
* SPDX-License-Identifier: LGPL-2.1-or-later
*
* First set of functions in this file are part of systemd, and were
* copied to util-linux at August 2013.
*
* Copyright 2010 Lennart Poettering
* Copyright (C) 2014 Karel Zak <kzak@redhat.com>
*
* This is free software; you can redistribute it and/or modify it under the
* terms of the GNU Lesser General Public License as published by the Free
* Software Foundation; either version 2.1 of the License, or (at your option)
* any later version.
*/
#ifndef UTIL_LINUX_TIME_UTIL_H
#define UTIL_LINUX_TIME_UTIL_H

View file

@ -30,7 +30,6 @@ libcommon_la_SOURCES = \
lib/mbsalign.c \
lib/mbsedit.c\
lib/md5.c \
lib/pager.c \
lib/pwdutils.c \
lib/randutils.c \
lib/sha1.c \

View file

@ -2,7 +2,7 @@
* No copyright is claimed. This code is in the public domain; do with
* it what you wish.
*
* Written by Karel Zak <kzak@redhat.com>
* Copyright (C) 2012-2015 Karel Zak <kzak@redhat.com>
*/
#include "c.h"
#include "color-names.h"

View file

@ -1,4 +1,6 @@
/*
* SPDX-License-Identifier: LGPL-2.1-or-later
*
* Copyright (C) 2012 Ondrej Oprala <ooprala@redhat.com>
* Copyright (C) 2012-2014 Karel Zak <kzak@redhat.com>
*

View file

@ -1,4 +1,6 @@
/*
* SPDX-License-Identifier: LGPL-2.1-or-later
*
* Terminology:
*
* cpuset - (libc) cpu_set_t data structure represents set of CPUs

View file

@ -580,7 +580,7 @@ static int loopcxt_next_from_sysfs(struct loopdev_cxt *lc)
/*
* @lc: context, has to initialized by loopcxt_init_iterator()
*
* Returns: 0 on success, -1 on error, 1 at the end of scanning. The details
* Returns: 0 on success, < 0 on error, 1 at the end of scanning. The details
* about the current loop device are available by
* loopcxt_get_{fd,backing_file,device,offset, ...} functions.
*/
@ -1602,6 +1602,8 @@ done:
* kernels we have to check all loop devices to found unused one.
*
* See kernel commit 770fe30a46a12b6fb6b63fbe1737654d28e8484.
*
* Returns: 0 = success, < 0 error
*/
int loopcxt_find_unused(struct loopdev_cxt *lc)
{
@ -1617,6 +1619,8 @@ int loopcxt_find_unused(struct loopdev_cxt *lc)
ctl = open(_PATH_DEV_LOOPCTL, O_RDWR|O_CLOEXEC);
if (ctl >= 0)
rc = ioctl(ctl, LOOP_CTL_GET_FREE);
else
rc = -errno;
if (rc >= 0) {
char name[16];
snprintf(name, sizeof(name), "loop%d", rc);
@ -1638,6 +1642,8 @@ int loopcxt_find_unused(struct loopdev_cxt *lc)
rc = loopcxt_next(lc);
loopcxt_deinit_iterator(lc);
DBG(CXT, ul_debugobj(lc, "find_unused by scan [rc=%d]", rc));
if (rc)
return -ENOENT;
}
return rc;
}
@ -1681,6 +1687,9 @@ char *loopdev_get_backing_file(const char *device)
return res;
}
/*
* Returns: TRUE/FALSE
*/
int loopdev_has_backing_file(const char *device)
{
char *tmp = loopdev_get_backing_file(device);
@ -1718,6 +1727,9 @@ int loopdev_is_used(const char *device, const char *filename,
return rc;
}
/*
* Returns: 0 = success, < 0 error
*/
int loopdev_delete(const char *device)
{
struct loopdev_cxt lc;

View file

@ -1,21 +1,16 @@
/* Align/Truncate a string in a given screen width
Copyright (C) 2009-2010 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation, either version 2.1 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. */
/* Written by Pádraig Brady. */
/*
* SPDX-License-Identifier: LGPL-2.1-or-later
*
* Align/Truncate a string in a given screen width
* Copyright (C) 2009-2010 Free Software Foundation, Inc.
*
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as published by the
* Free Software Foundation, either version 2.1 of the License, or (at your
* option) any later version.
*
* Written by Pádraig Brady.
*/
#include <stdlib.h>
#include <string.h>
#include <stdio.h>

View file

@ -1,4 +1,6 @@
/*
* SPDX-License-Identifier: LGPL-2.1-or-later
*
* Very simple multibyte buffer editor. Allows to maintaine the current
* position in the string, add and remove chars on the current position.
*

View file

@ -17,7 +17,6 @@ lib_common_sources = '''
mbsalign.c
mbsedit.c
md5.c
pager.c
procfs.c
pwdutils.c
randutils.c
@ -37,6 +36,7 @@ md5_c = files('md5.c')
sha1_c = files('sha1.c')
strutils_c = files('strutils.c')
strv_c = files('strv.c')
pager_c = files('pager.c')
lib_common_sources += [idcache_c,
randutils_c,

View file

@ -1,4 +1,10 @@
/*
* No copyright is claimed. This code is in the public domain; do with
* it what you wish.
*
* Copyright (C) 2018 Karel Zak <kzak@redhat.com>
*
*
* Simple functions to access files. Paths can be globally prefixed to read
* data from an alternative source (e.g. a /proc dump for regression tests).
*
@ -7,11 +13,6 @@
*
* The ul_path_read_* API is possible to use without path_cxt handler. In this
* case is not possible to use global prefix and printf-like formatting.
*
* No copyright is claimed. This code is in the public domain; do with
* it what you wish.
*
* Written by Karel Zak <kzak@redhat.com> [February 2018]
*/
#include <stdarg.h>
#include <string.h>

View file

@ -2,7 +2,7 @@
* No copyright is claimed. This code is in the public domain; do with
* it what you wish.
*
* Written by Karel Zak <kzak@redhat.com>
* Copyright (C) 2021 Karel Zak <kzak@redhat.com>
*/
#include <ctype.h>
#include <unistd.h>

View file

@ -397,7 +397,7 @@ int ul_strtou32(const char *str, uint32_t *num, int base)
* Convert strings to numbers in defined range and print message on error.
*
* These functions are used when we read input from users (getopt() etc.). It's
* better to consolidate the code and keep it all based on 64-bit numbers then
* better to consolidate the code and keep it all based on 64-bit numbers than
* implement it for 32 and 16-bit numbers too.
*/
int64_t str2num_or_err(const char *str, int base, const char *errmesg,

View file

@ -2,7 +2,7 @@
* No copyright is claimed. This code is in the public domain; do with
* it what you wish.
*
* Written by Karel Zak <kzak@redhat.com>
* Copyright (C) 2011 Karel Zak <kzak@redhat.com>
*/
#include <ctype.h>
#include <libgen.h>

View file

@ -1,23 +1,17 @@
/***
First set of functions in this file are part of systemd, and were
copied to util-linux at August 2013.
Copyright 2010 Lennart Poettering
systemd is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 2.1 of the License, or
(at your option) any later version.
systemd is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with util-linux; If not, see <http://www.gnu.org/licenses/>.
***/
/*
* SPDX-License-Identifier: LGPL-2.1-or-later
*
* First set of functions in this file are part of systemd, and were
* copied to util-linux at August 2013.
*
* Copyright 2010 Lennart Poettering
* Copyright (C) 2014 Karel Zak <kzak@redhat.com>
*
* This is free software; you can redistribute it and/or modify it under the
* terms of the GNU Lesser General Public License as published by the Free
* Software Foundation; either version 2.1 of the License, or (at your option)
* any later version.
*/
#include <assert.h>
#include <ctype.h>
#include <stdlib.h>

View file

@ -1,4 +1,6 @@
/*
* SPDX-License-Identifier: BSD-2-Clause
*
* xxHash - Extremely Fast Hash algorithm
* Copyright (C) 2012-2020 Yann Collet
*

View file

@ -17,10 +17,11 @@
#include "xxhash.h"
#define SB_LABEL_SIZE 32
#define SB_JOURNAL_BUCKETS 256U
/*
* The bcache_super_block is heavily simplified version of struct cache_sb in kernel.
* https://github.com/torvalds/linux/blob/master/include/uapi/linux/bcache.h
* The bcache_super_block is adapted from struct cache_sb in kernel.
* https://github.com/torvalds/linux/blob/master/drivers/md/bcache/bcache_ondisk.h
*/
struct bcache_super_block {
uint64_t csum;
@ -28,6 +29,43 @@ struct bcache_super_block {
uint64_t version;
uint8_t magic[16]; /* bcache file system identifier */
uint8_t uuid[16]; /* device identifier */
uint8_t set_info[16]; /* magic or uuid */
uint8_t label[SB_LABEL_SIZE];
uint64_t flags;
uint64_t seq;
uint64_t feature_compat;
uint64_t feature_incompat;
uint64_t feature_ro_compat;
uint64_t pad[5];
union {
struct {
/* Cache devices */
uint64_t nbuckets; /* device size */
uint16_t block_size; /* sectors */
uint16_t bucket_size; /* sectors */
uint16_t nr_in_set;
uint16_t nr_this_dev;
};
struct {
/* Backing devices */
uint64_t data_offset;
};
};
uint32_t last_mount;
uint16_t first_bucket;
union {
uint16_t njournal_buckets;
uint16_t keys;
};
uint64_t d[SB_JOURNAL_BUCKETS]; /* journal buckets */
uint16_t obso_bucket_size_hi; /* obsoleted */
} __attribute__((packed));
struct bcachefs_sb_field {
@ -102,8 +140,6 @@ struct bcachefs_super_block {
#define BCACHE_SB_MAGIC_OFF offsetof(struct bcache_super_block, magic)
/* start of checksummed data within superblock */
#define BCACHE_SB_CSUMMED_START 8
/* end of checksummed data within superblock */
#define BCACHE_SB_CSUMMED_END 208
/* granularity of offset and length fields within superblock */
#define BCACHEFS_SECTOR_SIZE 512
/* maximum superblock size */
@ -118,9 +154,19 @@ struct bcachefs_super_block {
static int bcache_verify_checksum(blkid_probe pr, const struct blkid_idmag *mag,
const struct bcache_super_block *bcs)
{
unsigned char *csummed = blkid_probe_get_sb_buffer(pr, mag, BCACHE_SB_CSUMMED_END);
uint64_t csum = ul_crc64_we(csummed + BCACHE_SB_CSUMMED_START,
BCACHE_SB_CSUMMED_END - BCACHE_SB_CSUMMED_START);
const unsigned char *csummed;
size_t csummed_size;
uint64_t csum;
if (le16_to_cpu(bcs->keys) > ARRAY_SIZE(bcs->d))
return 0;
/* up to the end of bcs->d[] */
csummed_size = offsetof(typeof(*bcs), d) +
sizeof(bcs->d[0]) * le16_to_cpu(bcs->keys);
csummed = blkid_probe_get_sb_buffer(pr, mag, csummed_size);
csum = ul_crc64_we(csummed + BCACHE_SB_CSUMMED_START,
csummed_size - BCACHE_SB_CSUMMED_START);
return blkid_probe_verify_csum(pr, csum, le64_to_cpu(bcs->csum));
}

View file

@ -41,7 +41,7 @@ static int probe_jfs(blkid_probe pr, const struct blkid_idmag *mag)
js = blkid_probe_get_sb(pr, mag, struct jfs_super_block);
if (!js)
return errno ? -errno : 1;
if (le16_to_cpu(js->js_l2bsize) > 32 || le16_to_cpu(js->js_l2pbsize) > 32)
if (le16_to_cpu(js->js_l2bsize) > 31 || le16_to_cpu(js->js_l2pbsize) > 31)
return 1;
if (le32_to_cpu(js->js_bsize) != (1U << le16_to_cpu(js->js_l2bsize)))
return 1;

View file

@ -141,7 +141,7 @@ foreach libmount_test: libmount_tests
c_args : ['-DTEST_PROGRAM'],
)
# the test-setup expects the helpers in the toplevel build-directory
link = meson.build_root() / test_name
link = meson.project_build_root() / test_name
run_command('ln', '-srf', exe.full_path(), link,
check : true)
endforeach

View file

@ -911,9 +911,29 @@ int mnt_context_set_fs(struct libmnt_context *cxt, struct libmnt_fs *fs)
if (!cxt)
return -EINVAL;
if (cxt->fs == fs)
return 0;
DBG(CXT, ul_debugobj(cxt, "setting new FS"));
mnt_ref_fs(fs); /* new */
mnt_unref_fs(cxt->fs); /* old */
/* new */
if (fs) {
struct libmnt_optlist *ol = mnt_context_get_optlist(cxt);
if (!ol)
return -ENOMEM;
mnt_ref_fs(fs);
mnt_optlist_set_optstr(ol, mnt_fs_get_options(fs), NULL);
mnt_fs_follow_optlist(fs, ol);
}
/* old */
if (cxt->fs)
mnt_fs_follow_optlist(cxt->fs, NULL);
mnt_unref_fs(cxt->fs);
cxt->fs = fs;
return 0;
}
@ -932,8 +952,17 @@ struct libmnt_fs *mnt_context_get_fs(struct libmnt_context *cxt)
{
if (!cxt)
return NULL;
if (!cxt->fs)
if (!cxt->fs) {
struct libmnt_optlist *ol = mnt_context_get_optlist(cxt);
if (!ol)
return NULL;
cxt->fs = mnt_new_fs();
if (!cxt->fs)
return NULL;
mnt_fs_follow_optlist(cxt->fs, ol);
}
return cxt->fs;
}
@ -3314,6 +3343,50 @@ static int test_flags(struct libmnt_test *ts, int argc, char *argv[])
return rc;
}
static int test_cxtsync(struct libmnt_test *ts, int argc, char *argv[])
{
struct libmnt_context *cxt;
struct libmnt_fs *fs;
unsigned long flags = 0;
int rc;
if (argc != 4)
return -EINVAL;
fs = mnt_new_fs();
if (!fs)
return -ENOMEM;
rc = mnt_fs_set_options(fs, argv[1]);
if (rc)
return rc;
cxt = mnt_new_context();
if (!cxt)
return -ENOMEM;
rc = mnt_context_set_fs(cxt, fs);
if (rc)
return rc;
rc = mnt_context_append_options(cxt, argv[2]);
if (rc)
return rc;
rc = mnt_fs_append_options(fs, argv[3]);
if (rc)
return rc;
mnt_context_get_mflags(cxt, &flags);
printf(" fs options: %s\n", mnt_fs_get_options(fs));
printf("context options: %s\n", mnt_context_get_options(cxt));
printf(" context mflags: %08lx\n", flags);
mnt_free_context(cxt);
return 0;
}
static int test_mountall(struct libmnt_test *ts, int argc, char *argv[])
{
struct libmnt_context *cxt;
@ -3361,6 +3434,8 @@ static int test_mountall(struct libmnt_test *ts, int argc, char *argv[])
return 0;
}
int main(int argc, char *argv[])
{
struct libmnt_test tss[] = {
@ -3368,6 +3443,7 @@ int main(int argc, char *argv[])
{ "--umount", test_umount, "[-t <type>] [-f][-l][-r] <src>|<target>" },
{ "--mount-all", test_mountall, "[-O <pattern>] [-t <pattern] mount all filesystems from fstab" },
{ "--flags", test_flags, "[-o <opts>] <spec>" },
{ "--cxtsync", test_cxtsync, "<fsopts> <cxtopts> <fsopts>" },
{ "--search-helper", test_search_helper, "<fstype>" },
{ NULL }};

View file

@ -177,6 +177,22 @@ static int evaluate_permissions(struct libmnt_context *cxt)
if (rc)
return rc;
/*
* Ignore user=<name> (if <name> is set). Let's keep it hidden
* for normal library operations, but visible for /sbin/mount.<type>
* helpers.
*/
if (user_flags & MNT_MS_USER
&& (opt = mnt_optlist_get_opt(ol, MNT_MS_USER, cxt->map_userspace))
&& mnt_opt_has_value(opt)) {
DBG(CXT, ul_debugobj(cxt, "perms: user=<name> detected, ignore"));
cxt->flags |= MNT_FL_SAVED_USER;
mnt_opt_set_external(opt, 1);
user_flags &= ~MNT_MS_USER;
}
if (!mnt_context_is_restricted(cxt)) {
/*
* superuser mount
@ -228,22 +244,6 @@ static int evaluate_permissions(struct libmnt_context *cxt)
return -EPERM;
}
/*
* Ignore user=<name> (if <name> is set). Let's keep it hidden
* for normal library operations, but visible for /sbin/mount.<type>
* helpers.
*/
if (user_flags & MNT_MS_USER
&& (opt = mnt_optlist_get_opt(ol, MNT_MS_USER, cxt->map_userspace))
&& mnt_opt_has_value(opt)) {
DBG(CXT, ul_debugobj(cxt, "perms: user=<name> detected, ignore"));
cxt->flags |= MNT_FL_SAVED_USER;
mnt_opt_set_external(opt, 1);
user_flags &= ~MNT_MS_USER;
}
/*
* Insert MS_SECURE between system flags on position where is MNT_MS_USER
*/
@ -377,9 +377,7 @@ int mnt_context_mount_setopt(struct libmnt_context *cxt, int c, char *arg)
static int exec_helper(struct libmnt_context *cxt)
{
struct libmnt_optlist *ol;
struct libmnt_ns *ns_tgt = mnt_context_get_target_ns(cxt);
const char *o = NULL;
char *namespace = NULL;
int rc;
pid_t pid;
@ -391,14 +389,6 @@ static int exec_helper(struct libmnt_context *cxt)
DBG(CXT, ul_debugobj(cxt, "mount: executing helper %s", cxt->helper));
ol = mnt_context_get_optlist(cxt);
if (!ol)
return -ENOMEM;
rc = mnt_optlist_get_optstr(ol, &o, NULL, MNT_OL_FLTR_HELPERS);
if (rc)
return rc;
if (ns_tgt->fd != -1
&& asprintf(&namespace, "/proc/%i/fd/%i",
getpid(), ns_tgt->fd) == -1) {
@ -412,8 +402,24 @@ static int exec_helper(struct libmnt_context *cxt)
case 0:
{
const char *args[14], *type;
struct libmnt_optlist *ol = mnt_context_get_optlist(cxt);
struct libmnt_opt *opt;
const char *o = NULL;
int i = 0;
if (!ol)
_exit(EXIT_FAILURE);
/* Call helper with original user=<name> (aka "saved user")
* or remove the username at all.
*/
opt = mnt_optlist_get_opt(ol, MNT_MS_USER, cxt->map_userspace);
if (opt && !(cxt->flags & MNT_FL_SAVED_USER))
mnt_opt_set_value(opt, NULL);
if (mnt_optlist_get_optstr(ol, &o, NULL, MNT_OL_FLTR_HELPERS))
_exit(EXIT_FAILURE);
if (drop_permissions() != 0)
_exit(EXIT_FAILURE);
@ -502,6 +508,8 @@ static int do_mount(struct libmnt_context *cxt, const char *try_type)
assert(cxt->fs);
assert((cxt->flags & MNT_FL_MOUNTFLAGS_MERGED));
mnt_context_reset_status(cxt);
if (try_type) {
rc = mnt_context_prepare_helper(cxt, "mount", try_type);
if (rc)

View file

@ -228,10 +228,14 @@ int mnt_fs_follow_optlist(struct libmnt_fs *fs, struct libmnt_optlist *ol)
if (fs->optlist == ol)
return 0;
if (fs->optlist)
mnt_unref_optlist(fs->optlist);
fs->opts_age = 0;
fs->optlist = ol;
mnt_ref_optlist(ol);
if (ol)
mnt_ref_optlist(ol);
return 0;
}
@ -919,7 +923,11 @@ int mnt_fs_set_options(struct libmnt_fs *fs, const char *optstr)
if (!fs)
return -EINVAL;
fs->opts_age = 0;
if (fs->optlist) {
fs->opts_age = 0;
return mnt_optlist_set_optstr(fs->optlist, optstr, NULL);
}
if (optstr) {
int rc = mnt_split_optstr(optstr, &u, &v, &f, 0, 0);
@ -968,8 +976,10 @@ int mnt_fs_append_options(struct libmnt_fs *fs, const char *optstr)
return -EINVAL;
if (!optstr)
return 0;
fs->opts_age = 0;
if (fs->optlist) {
fs->opts_age = 0;
return mnt_optlist_append_optstr(fs->optlist, optstr, NULL);
}
rc = mnt_split_optstr(optstr, &u, &v, &f, 0, 0);
if (rc)
@ -1013,7 +1023,10 @@ int mnt_fs_prepend_options(struct libmnt_fs *fs, const char *optstr)
if (!optstr)
return 0;
fs->opts_age = 0;
if (fs->optlist) {
fs->opts_age = 0;
return mnt_optlist_prepend_optstr(fs->optlist, optstr, NULL);
}
rc = mnt_split_optstr(optstr, &u, &v, &f, 0, 0);
if (rc)

View file

@ -239,6 +239,10 @@ static int hook_create_mount(struct libmnt_context *cxt,
int rc = 0;
assert(cxt);
if (mnt_context_helper_executed(cxt))
return 0;
assert(cxt->fs);
api = get_sysapi(cxt);
@ -309,6 +313,9 @@ static int hook_reconfigure_mount(struct libmnt_context *cxt,
assert(cxt);
if (mnt_context_helper_executed(cxt))
return 0;
api = get_sysapi(cxt);
assert(api);
assert(api->fd_tree >= 0);
@ -379,6 +386,9 @@ static int hook_set_vfsflags(struct libmnt_context *cxt,
uint64_t set = 0, clr = 0;
int rc = 0;
if (mnt_context_helper_executed(cxt))
return 0;
DBG(HOOK, ul_debugobj(hs, "setting VFS flags"));
ol = mnt_context_get_optlist(cxt);
@ -471,6 +481,9 @@ static int hook_attach_target(struct libmnt_context *cxt,
const char *target;
int rc = 0;
if (mnt_context_helper_executed(cxt))
return 0;
target = mnt_fs_get_target(cxt->fs);
if (!target)
return -EINVAL;
@ -510,6 +523,15 @@ static inline int fsopen_is_supported(void)
return rc;
}
static inline int mount_setattr_is_supported(void)
{
int rc;
errno = 0;
rc = mount_setattr(-1, NULL, 0, NULL, 0);
return !(rc == -1 && errno == ENOSYS);
}
/*
* open_tree() and fsopen()
*/
@ -587,6 +609,43 @@ fake:
return 0;
}
static int force_classic_mount(struct libmnt_context *cxt)
{
const char *env = getenv("LIBMOUNT_FORCE_MOUNT2");
if (env) {
if (strcmp(env, "always") == 0)
return 1;
if (strcmp(env, "never") == 0)
return 0;
}
/* "auto" (default) -- try to be smart */
/* For external /sbin/mount.<type> helpers we use the new API only for
* propagation setting. In this case, the usability of mount_setattr()
* will be verified later */
if (cxt->helper)
return 0;
/*
* The current kernel btrfs driver does not completely implement
* fsconfig() as it does not work with selinux stuff.
*
* Don't use the new mount API in this situation. Let's hope this issue
* is temporary.
*/
{
const char *type = mnt_fs_get_fstype(cxt->fs);
if (type && strcmp(type, "btrfs") == 0 && cxt->has_selinux_opt)
return 1;
}
return 0;
}
/*
* Analyze library context and register hook to call mount-like syscalls.
*
@ -607,20 +666,9 @@ static int hook_prepare(struct libmnt_context *cxt,
assert(cxt);
assert(hs == &hookset_mount);
/*
* The current kernel btrfs driver does not completely implement
* fsconfig() as it does not work with selinux stuff.
*
* Don't use the new mount API in this situation. Let's hope this issue
* is temporary.
*/
{
const char *type = mnt_fs_get_fstype(cxt->fs);
if (type && strcmp(type, "btrfs") == 0 && cxt->has_selinux_opt) {
DBG(HOOK, ul_debugobj(hs, "don't use new API (btrfs issue)"));
return 0;
}
if (force_classic_mount(cxt)) {
DBG(HOOK, ul_debugobj(hs, "new API disabled"));
return 0;
}
DBG(HOOK, ul_debugobj(hs, "prepare mount"));
@ -639,13 +687,8 @@ static int hook_prepare(struct libmnt_context *cxt,
/* open_tree() or fsopen() */
if (!rc) {
rc = init_sysapi(cxt, hs, flags);
if (rc && cxt->syscall_status == -ENOSYS) {
/* we need to recover from this error, so hook_mount_legacy.c
* can try to continue */
reset_syscall_status(cxt);
free_hookset_data(cxt, hs);
return 1;
}
if (rc && cxt->syscall_status == -ENOSYS)
goto enosys;
}
/* check mutually exclusive operations */
@ -675,9 +718,13 @@ static int hook_prepare(struct libmnt_context *cxt,
/* call mount_setattr() */
if (!rc
&& cxt->helper == NULL
&& (set != 0 || clr != 0 || (flags & MS_REMOUNT)))
&& (set != 0 || clr != 0 || (flags & MS_REMOUNT))) {
if (!mount_setattr_is_supported())
goto enosys;
rc = mnt_context_append_hook(cxt, hs, MNT_STAGE_MOUNT, NULL,
hook_set_vfsflags);
}
/* call move_mount() to attach target */
if (!rc
@ -688,12 +735,24 @@ static int hook_prepare(struct libmnt_context *cxt,
hook_attach_target);
/* set propagation (has to be attached to VFS) */
if (!rc && mnt_optlist_get_propagation(ol))
if (!rc && mnt_optlist_get_propagation(ol)) {
if (!mount_setattr_is_supported())
goto enosys;
rc = mnt_context_append_hook(cxt, hs, MNT_STAGE_MOUNT_POST, NULL,
hook_set_propagation);
}
DBG(HOOK, ul_debugobj(hs, "prepare mount done [rc=%d]", rc));
return rc;
enosys:
/* we need to recover from this error, so hook_mount_legacy.c
* can try to continue */
DBG(HOOK, ul_debugobj(hs, "failed to init new API"));
reset_syscall_status(cxt);
hookset_deinit(cxt, hs);
return 1;
}
const struct libmnt_hookset hookset_mount =

View file

@ -338,6 +338,7 @@ int mnt_optlist_merge_opts(struct libmnt_optlist *ls)
/* remove inverted option */
else if (opt->ent && x->ent
&& opt->map == x->map
&& opt->ent->id == x->ent->id
&& (opt->ent->mask & MNT_INVERT
|| x->ent->mask & MNT_INVERT))
@ -462,7 +463,7 @@ static struct libmnt_opt *optlist_new_opt(struct libmnt_optlist *ls,
else if (opt->ent->id == MS_BIND)
ls->is_bind = 1;
else if (opt->ent->id == MS_RDONLY)
ls->is_rdonly = 1;
ls->is_rdonly = opt->ent->mask & MNT_INVERT ? 0 : 1;
else if (opt->ent->id == MS_MOVE)
ls->is_move = 1;
else if (opt->ent->id == MS_SILENT)
@ -520,6 +521,8 @@ static int optlist_add_optstr(struct libmnt_optlist *ls, const char *optstr,
if (!opt)
return -ENOMEM;
opt->src = MNT_OPTSRC_STRING;
if (where)
where = &opt->opts;
}
optlist_cleanup_cache(ls);
@ -622,6 +625,8 @@ static int optlist_add_flags(struct libmnt_optlist *ls, unsigned long flags,
if (!opt)
return -ENOMEM;
opt->src = MNT_OPTSRC_FLAG;
if (where)
where = &opt->opts;
}
optlist_cleanup_cache(ls);

View file

@ -147,7 +147,7 @@ static const struct libmnt_optmap linux_flags_map[] =
*/
static const struct libmnt_optmap userspace_opts_map[] =
{
{ "defaults", 0, 0 }, /* default options */
{ "defaults", 0, MNT_NOHLPS }, /* default options */
{ "auto", MNT_MS_NOAUTO, MNT_NOHLPS | MNT_INVERT | MNT_NOMTAB }, /* Can be mounted using -a */
{ "noauto", MNT_MS_NOAUTO, MNT_NOHLPS | MNT_NOMTAB }, /* Can only be mounted explicitly */

View file

@ -69,7 +69,7 @@ int main(int argc, char *argv[])
{
struct libscols_table *tb;
size_t i;
const size_t timecellsz = sizeof(stringify_value(UINT_MAX));
const size_t timecellsz = 500;
struct timeval last;
scols_init_debug(0);

View file

@ -30,10 +30,12 @@ dnl
dnl Calls pkg-config --static
dnl
AC_DEFUN([UL_PKG_STATIC], [
if AC_RUN_LOG([$PKG_CONFIG --exists --print-errors "$2"]); then
$1=`$PKG_CONFIG --libs --static "$2"`
else
AC_MSG_ERROR([pkg-config description of $2, needed for static build, is not available])
if test "$enable_static" != xno; then
if AC_RUN_LOG([$PKG_CONFIG --exists --print-errors "$2"]); then
$1=`$PKG_CONFIG --libs --static "$2"`
else
AC_MSG_ERROR([pkg-config description of $2, needed for static build, is not available])
fi
fi
])

View file

@ -1,6 +1,6 @@
project('util-linux', 'c',
version : run_command('tools/git-version-gen', check: true).stdout(),
meson_version: '>=0.53.0',
meson_version: '>=0.57.0',
license : 'GPLv2+')
pkgconfig = import('pkgconfig')
@ -483,6 +483,18 @@ have = cc.compiles('''
name : 'langinfo.h defines _NL_ABALTMON_x constants')
conf.set('HAVE_LANGINFO_NL_ABALTMON', have ? 1 : false)
have = cc.compiles('''
#define _GNU_SOURCE 1
#include <langinfo.h>
int main(void) {
char *str;
str = nl_langinfo (_NL_TIME_WEEK_1STDAY);
return 0;
}
''',
name : 'langinfo.h defines _NL_TIME_WEEK_1STDAY constant')
conf.set('HAVE_DECL__NL_TIME_WEEK_1STDAY', have ? 1 : false)
funcs = '''
clearenv
close_range
@ -708,6 +720,9 @@ int main(void) {
have = cc.compiles(code, name : 'using __progname')
conf.set('HAVE___PROGNAME', have ? 1 : false)
have = conf.get('HAVE_PTY_H') != false and conf.get('HAVE_SYS_SIGNALFD_H') != false
conf.set('HAVE_PTY', have ? 1 : false)
have_opal_get_status= cc.has_header_symbol('linux/sed-opal.h', 'IOC_OPAL_GET_STATUS')
conf.set('HAVE_OPAL_GET_STATUS', have_opal_get_status ? 1 : false)
@ -895,6 +910,7 @@ exe = executable(
link_with : [lib_common, logindefs_c],
dependencies : chfn_chsh_deps,
install_dir : usrbin_exec_dir,
install_mode : 'rwsr-xr-x',
install : opt,
build_by_default : opt)
@ -907,6 +923,7 @@ exe2 = executable(
link_with : lib_common,
dependencies : chfn_chsh_deps,
install_dir : usrbin_exec_dir,
install_mode : 'rwsr-xr-x',
install : opt,
build_by_default : opt)
if opt and not is_disabler(exe)
@ -994,6 +1011,7 @@ exe = executable(
lib_pam_misc,
lib_util,
realtime_libs],
install_mode : 'rwsr-xr-x',
install : opt,
build_by_default : opt)
if opt and not is_disabler(exe)
@ -1009,11 +1027,13 @@ exe = executable(
include_directories : includes,
dependencies : [lib_crypt],
install_dir : usrbin_exec_dir,
install_mode : 'rwsr-xr-x',
install : opt,
build_by_default : opt)
if opt and not is_disabler(exe)
exes += exe
manadocs += ['login-utils/newgrp.1.adoc']
bashcompletions += ['newgrp']
endif
opt = not get_option('build-lslogins').disabled()
@ -1052,6 +1072,9 @@ if opt and not is_disabler(exe)
'vipw',
join_paths(usrbin_exec_dir, 'vigr'))
manadocs += ['login-utils/vipw.8.adoc']
meson.add_install_script(meson_make_symlink,
'vipw.8',
join_paths(mandir, 'man8/vigr.8'))
endif
opt = not get_option('build-runuser').disabled()
@ -1621,6 +1644,7 @@ exe = executable(
lib_smartcols,
lib_mount],
dependencies : lib_selinux,
install_mode : 'rwsr-xr-x',
install : opt,
build_by_default : opt)
exe2 = executable(
@ -1629,6 +1653,7 @@ exe2 = executable(
include_directories : includes,
link_with : [lib_common,
lib_mount],
install_mode : 'rwsr-xr-x',
install : opt,
build_by_default : opt)
if opt and not is_disabler(exe)
@ -2379,6 +2404,7 @@ exe = executable(
include_directories : includes,
link_with : [lib_common],
install_dir : usrbin_exec_dir,
install_mode : 'rwxr-sr-x',
install : opt,
build_by_default : opt)
if opt
@ -2397,11 +2423,13 @@ exe = executable(
include_directories : includes,
link_with : [lib_common],
install_dir : usrbin_exec_dir,
install_mode : 'rwxr-sr-x',
install : opt,
build_by_default : opt)
if opt
exes += exe
manadocs += ['term-utils/write.1.adoc']
bashcompletions += ['write']
endif
# chgrp tty $(DESTDIR)$(usrbin_execdir)/write
@ -2843,17 +2871,19 @@ if not is_disabler(exe)
bashcompletions += ['fadvise']
endif
exe = executable(
'waitpid',
waitpid_sources,
include_directories : includes,
link_with : [lib_common],
install_dir : usrbin_exec_dir,
install : true)
if not is_disabler(exe)
exes += exe
manadocs += ['misc-utils/waitpid.1.adoc']
bashcompletions += ['waitpid']
if LINUX and conf.get('HAVE_PIDFD_OPEN') != false
exe = executable(
'waitpid',
waitpid_sources,
include_directories : includes,
link_with : [lib_common],
install_dir : usrbin_exec_dir,
install : true)
if not is_disabler(exe)
exes += exe
manadocs += ['misc-utils/waitpid.1.adoc']
bashcompletions += ['waitpid']
endif
endif
############################################################
@ -2962,46 +2992,48 @@ exe = executable(
include_directories : dir_include)
exes += exe
# XXX: HAVE_OPENAT && HAVE_DIRFD
exe = executable(
'test_procfs',
'lib/procfs.c',
c_args : ['-DTEST_PROGRAM_PROCFS'],
include_directories : dir_include,
link_with : lib_common)
exes += exe
if conf.get('HAVE_OPENAT') != false and conf.get('HAVE_DIRFD') != false
exe = executable(
'test_procfs',
'lib/procfs.c',
c_args : ['-DTEST_PROGRAM_PROCFS'],
include_directories : dir_include,
link_with : lib_common)
exes += exe
# XXX: HAVE_OPENAT && HAVE_DIRFD
exe = executable(
'test_path',
'lib/path.c',
'lib/fileutils.c',
have_cpu_set_t ? 'lib/cpuset.c' : [],
c_args : ['-DTEST_PROGRAM_PATH'],
include_directories : dir_include,
link_with : lib_common)
exes += exe
exe = executable(
'test_path',
'lib/path.c',
'lib/fileutils.c',
have_cpu_set_t ? 'lib/cpuset.c' : [],
c_args : ['-DTEST_PROGRAM_PATH'],
include_directories : dir_include,
link_with : lib_common)
exes += exe
endif
# XXX: HAVE_PTY
exe = executable(
'test_pty',
pty_session_c,
monotonic_c,
c_args : ['-DTEST_PROGRAM_PTY'],
include_directories : dir_include,
link_with : [lib_common],
dependencies : [lib_m,
realtime_libs,
lib_util])
exes += exe
if conf.get('HAVE_PTY') != false
exe = executable(
'test_pty',
pty_session_c,
monotonic_c,
c_args : ['-DTEST_PROGRAM_PTY'],
include_directories : dir_include,
link_with : [lib_common],
dependencies : [lib_m,
realtime_libs,
lib_util])
exes += exe
endif
# XXX: LINUX
exe = executable(
'test_cpuset',
'lib/cpuset.c',
c_args : ['-DTEST_PROGRAM_CPUSET'],
include_directories : dir_include)
exes += exe
if LINUX
exe = executable(
'test_cpuset',
'lib/cpuset.c',
c_args : ['-DTEST_PROGRAM_CPUSET'],
include_directories : dir_include)
exes += exe
endif
exe = executable(
'test_sysfs',
@ -3238,12 +3270,13 @@ exe = executable(
include_directories : includes)
exes += exe
# XXX: LINUX
exe = executable(
'test_mkfds',
'tests/helpers/test_mkfds.c',
include_directories : includes)
exes += exe
if LINUX
exe = executable(
'test_mkfds',
'tests/helpers/test_mkfds.c',
include_directories : includes)
exes += exe
endif
exe = executable(
'test_enosys',
@ -3253,14 +3286,15 @@ exes += exe
############################################################
# XXX: HAVE_OPENAT
exe = executable(
'sample-scols-tree',
'libsmartcols/samples/tree.c',
include_directories : includes,
link_with : [lib_smartcols, lib_common])
if not is_disabler(exe)
exes += exe
if conf.get('HAVE_OPENAT') != false
exe = executable(
'sample-scols-tree',
'libsmartcols/samples/tree.c',
include_directories : includes,
link_with : [lib_smartcols, lib_common])
if not is_disabler(exe)
exes += exe
endif
endif
exe = executable(
@ -3337,7 +3371,7 @@ configure_file(output : 'meson.conf',
'''asan=@0@
PYTHON=@1@
'''.format(get_option('b_sanitize')=='address' ? 'yes' : '',
python.path())])
python.full_path())])
run_sh = find_program('tests/run.sh')
run_target(

View file

@ -320,7 +320,7 @@ int main(int argc, char **argv)
{"twelve", no_argument, NULL, 'Y'},
{"help", no_argument, NULL, 'h'},
{"vertical", no_argument, NULL,'v'},
{"column", required_argument, NULL,'c'},
{"columns", required_argument, NULL,'c'},
{NULL, 0, NULL, 0}
};
@ -433,7 +433,8 @@ int main(int argc, char **argv)
if (strcmp(optarg, "auto") == 0)
cols = COLUMNS_AUTO;
else
cols = strtosize_or_err(optarg, "foo");
cols = strtosize_or_err(optarg,
_("failed to parse columns"));
break;
case 'V':
print_version(EXIT_SUCCESS);

View file

@ -42,7 +42,7 @@ are very often different from the beginning.
include::man-common/help-version.adoc[]
*-c* *--content*::
*-c*, *--content*::
Consider only file content, not attributes, when determining whether two files are equal. Same as *-pot*.
*-b*, *--io-size* _size_::

View file

@ -471,7 +471,7 @@ static void write_output(struct logger_ctl *ctl, const char *const msg)
union {
struct cmsghdr cmh;
char control[CMSG_SPACE(sizeof(struct ucred))];
} cbuf;
} cbuf = { .control = { 0 } };
#endif
/* 4) add extra \n to make sure message is terminated */

View file

@ -746,6 +746,10 @@ static struct node *dparser_compile1(struct parser *parser, struct node *last)
int ntype;
switch (jtype) {
case SCOLS_JSON_STRING:
case SCOLS_JSON_ARRAY_STRING:
case SCOLS_JSON_ARRAY_NUMBER:
/* We handles SCOLS_JSON_ARRAY_* as a string
* till we implement operators for arrays. */
ntype = NODE_STR;
break;
case SCOLS_JSON_NUMBER:

View file

@ -145,7 +145,7 @@ static const struct colinfo infos[] = {
0, SCOLS_FL_RIGHT, SCOLS_JSON_STRING,
N_("device type (blk, char, or nodev)") },
[COL_ENDPOINTS] = { "ENDPOINTS",
0, SCOLS_FL_WRAP, SCOLS_JSON_STRING,
0, SCOLS_FL_WRAP, SCOLS_JSON_ARRAY_STRING,
N_("IPC endpoints information communicated with the fd") },
[COL_FLAGS] = { "FLAGS",
0, SCOLS_FL_RIGHT, SCOLS_JSON_STRING,
@ -1561,6 +1561,7 @@ static void __attribute__((__noreturn__)) usage(void)
for (i = 0; i < ARRAY_SIZE(infos); i++)
fprintf(out, " %16s %-10s%s\n", infos[i].name,
infos[i].json_type == SCOLS_JSON_STRING? "<string>":
infos[i].json_type == SCOLS_JSON_ARRAY_STRING? "<string>":
infos[i].json_type == SCOLS_JSON_NUMBER? "<number>":
"<boolean>",
_(infos[i].help));

View file

@ -184,7 +184,7 @@ static void create_nthreads(process_t *proc, size_t index)
}
LOG(2, (stderr, "%d: started thread [tid=%jd,index=%zu]\n",
proc->pid, (intmax_t) th->tid, th->index));
proc->pid, (intmax_t) (intptr_t) th->tid, th->index));
index += nobjects;
ncreated++;
}
@ -204,7 +204,7 @@ static void create_nthreads(process_t *proc, size_t index)
}
LOG(2, (stderr, "%d: thread exited [tid=%jd,return=%d]\n",
proc->pid, (intmax_t) th->tid, th->retval));
proc->pid, (intmax_t) (intptr_t) th->tid, th->retval));
}
free(threads);
@ -260,7 +260,7 @@ static void object_dump(size_t idx, object_t *obj)
fprintf(stderr, " uuid: <%s>\n", p);
fprintf(stderr, " idx: %zu\n", obj->idx);
fprintf(stderr, " process: %d\n", (int) obj->pid);
fprintf(stderr, " thread: %jd\n", (intmax_t) obj->tid);
fprintf(stderr, " thread: %jd\n", (intmax_t) (intptr_t) obj->tid);
fprintf(stderr, "}\n");
}

View file

@ -35,10 +35,13 @@ asciidoc_man_cmd = $(ASCIIDOCTOR) \
-a 'package-docdir=$(docdir)' \
-a 'VERSION=$(VERSION)' \
-a 'ADJTIME_PATH=$(ADJTIME_PATH)' \
--failure-level ERROR \
--load-path '$(top_srcdir)/tools' \
--require asciidoctor-unicodeconverter
if HAVE_ASCIIDOCTOR_FAILURE_LEVEL
asciidoc_man_cmd += --failure-level ERROR
endif
gen-mans: gen-trans
@set -e; \
for l in $(PO_LANGS); do \

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

38919
po-man/ko.po Normal file

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

38277
po-man/ro.po Normal file

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

513
po/ca.po

File diff suppressed because it is too large Load diff

468
po/cs.po

File diff suppressed because it is too large Load diff

466
po/da.po

File diff suppressed because it is too large Load diff

468
po/de.po

File diff suppressed because it is too large Load diff

468
po/es.po

File diff suppressed because it is too large Load diff

591
po/et.po

File diff suppressed because it is too large Load diff

591
po/eu.po

File diff suppressed because it is too large Load diff

601
po/fi.po

File diff suppressed because it is too large Load diff

468
po/fr.po

File diff suppressed because it is too large Load diff

591
po/gl.po

File diff suppressed because it is too large Load diff

472
po/hr.po

File diff suppressed because it is too large Load diff

601
po/hu.po

File diff suppressed because it is too large Load diff

601
po/id.po

File diff suppressed because it is too large Load diff

507
po/it.po

File diff suppressed because it is too large Load diff

466
po/ja.po

File diff suppressed because it is too large Load diff

468
po/ko.po

File diff suppressed because it is too large Load diff

465
po/nl.po

File diff suppressed because it is too large Load diff

468
po/pl.po

File diff suppressed because it is too large Load diff

468
po/pt.po

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

591
po/ru.po

File diff suppressed because it is too large Load diff

474
po/sk.po

File diff suppressed because it is too large Load diff

601
po/sl.po

File diff suppressed because it is too large Load diff

468
po/sr.po

File diff suppressed because it is too large Load diff

468
po/sv.po

File diff suppressed because it is too large Load diff

466
po/tr.po

File diff suppressed because it is too large Load diff

468
po/uk.po

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

471
po/vi.po

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -157,7 +157,7 @@ if BUILD_DMESG
bin_PROGRAMS += dmesg
MANPAGES += sys-utils/dmesg.1
dist_noinst_DATA += sys-utils/dmesg.1.adoc
dmesg_SOURCES = sys-utils/dmesg.c lib/monotonic.c
dmesg_SOURCES = sys-utils/dmesg.c lib/monotonic.c include/pager.h lib/pager.c
dmesg_LDADD = $(LDADD) libcommon.la libtcolors.la $(REALTIME_LIBS)
dmesg_CFLAGS = $(AM_CFLAGS)
check_PROGRAMS += test_dmesg

View file

@ -271,19 +271,12 @@ static int blkzone_report(struct blkzone_control *ctl)
break;
for (i = 0; i < zi->nr_zones; i++) {
/*
* blk_zone_report hasn't been packed since https://github.com/torvalds/linux/commit/b3e7e7d2d668de0102264302a4d10dd9d4438a42
* was merged. See https://github.com/util-linux/util-linux/issues/1083
*/
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Waddress-of-packed-member"
const struct blk_zone *entry = &zi->zones[i];
#pragma GCC diagnostic pop
unsigned int type = entry->type;
uint64_t start = entry->start;
uint64_t wp = entry->wp;
uint8_t cond = entry->cond;
uint64_t len = entry->len;
const struct blk_zone entry = zi->zones[i];
unsigned int type = entry.type;
uint64_t start = entry.start;
uint64_t wp = entry.wp;
uint8_t cond = entry.cond;
uint64_t len = entry.len;
uint64_t cap;
if (!len) {
@ -292,9 +285,9 @@ static int blkzone_report(struct blkzone_control *ctl)
}
if (has_zone_capacity(zi))
cap = zone_capacity(entry);
cap = zone_capacity(&entry);
else
cap = entry->len;
cap = entry.len;
if (only_capacity_sum) {
capacity_sum += cap;
@ -303,7 +296,7 @@ static int blkzone_report(struct blkzone_control *ctl)
", cap 0x%06"PRIx64", wptr 0x%06"PRIx64
" reset:%u non-seq:%u, zcond:%2u(%s) [type: %u(%s)]\n"),
start, len, cap, (type == 0x1) ? 0 : wp - start,
entry->reset, entry->non_seq,
entry.reset, entry.non_seq,
cond, condition_str[cond & (ARRAY_SIZE(condition_str) - 1)],
type, type_text[type]);
} else {
@ -311,7 +304,7 @@ static int blkzone_report(struct blkzone_control *ctl)
", wptr 0x%06"PRIx64
" reset:%u non-seq:%u, zcond:%2u(%s) [type: %u(%s)]\n"),
start, len, (type == 0x1) ? 0 : wp - start,
entry->reset, entry->non_seq,
entry.reset, entry.non_seq,
cond, condition_str[cond & (ARRAY_SIZE(condition_str) - 1)],
type, type_text[type]);
}

View file

@ -179,7 +179,13 @@ struct dmesg_control {
int kmsg; /* /dev/kmsg file descriptor */
ssize_t kmsg_first_read;/* initial read() return code */
char kmsg_buf[BUFSIZ];/* buffer to read kmsg data */
/*
* the kernel will give EINVAL if we do read() on /proc/kmsg with
* length insufficient for the next message. messages may be up to
* PRINTK_MESSAGE_MAX, which is defined as 2048, so we must be
* able to buffer at least that much in one call
*/
char kmsg_buf[2048]; /* buffer to read kmsg data */
usec_t since; /* filter records by time */
usec_t until; /* filter records by time */

View file

@ -470,6 +470,25 @@ static void warn_size(const char *filename, uint64_t size, uint64_t offset, int
filename);
}
static int find_unused(struct loopdev_cxt *lc)
{
int rc;
rc = loopcxt_find_unused(lc);
if (!rc)
return 0;
if (access(_PATH_DEV_LOOPCTL, F_OK) == 0 &&
access(_PATH_DEV_LOOPCTL, W_OK) != 0)
;
else
errno = -rc;
warn(_("cannot find an unused loop device"));
return rc;
}
static int create_loop(struct loopdev_cxt *lc,
int nooverlap, int lo_flags, int flags,
const char *file, uint64_t offset, uint64_t sizelimit,
@ -551,10 +570,8 @@ static int create_loop(struct loopdev_cxt *lc,
/* Note that loopcxt_{find_unused,set_device}() resets
* loopcxt struct.
*/
if (!hasdev && (rc = loopcxt_find_unused(lc))) {
warnx(_("cannot find an unused loop device"));
if (!hasdev && (rc = find_unused(lc)))
break;
}
if (flags & LOOPDEV_FL_OFFSET)
loopcxt_set_offset(lc, offset);
if (flags & LOOPDEV_FL_SIZELIMIT)
@ -868,18 +885,8 @@ int main(int argc, char **argv)
res = delete_all_loops(&lc);
break;
case A_FIND_FREE:
res = loopcxt_find_unused(&lc);
if (res) {
int errsv = errno;
if (access(_PATH_DEV_LOOPCTL, F_OK) == 0 &&
access(_PATH_DEV_LOOPCTL, W_OK) != 0)
;
else
errno = errsv;
warn(_("cannot find an unused loop device"));
} else
res = find_unused(&lc);
if (!res)
printf("%s\n", loopcxt_get_device(&lc));
break;
case A_SHOW:

View file

@ -206,6 +206,12 @@ static const struct id_part apple_part[] = {
{ 0x031, "Avalanche-A15" },
{ 0x032, "Blizzard-M2" },
{ 0x033, "Avalanche-M2" },
{ 0x034, "Blizzard-M2-Pro" },
{ 0x035, "Avalanche-M2-Pro" },
{ 0x036, "Sawtooth-A16" },
{ 0x037, "Everest-A16" },
{ 0x038, "Blizzard-M2-Max" },
{ 0x039, "Avalanche-M2-Max" },
{ -1, "unknown" },
};

View file

@ -55,7 +55,7 @@ fstrim_sources = files(
dmesg_sources = files(
'dmesg.c',
) + \
monotonic_c
monotonic_c + pager_c
ctrlaltdel_sources = files(
'ctrlaltdel.c',

View file

@ -184,6 +184,8 @@ Since util-linux 2.35, *mount* does not exit when user permissions are inadequat
For more details, see *fstab*(5). Only the user that mounted a filesystem can unmount it again. If any user should be able to unmount it, then use *users* instead of *user* in the _fstab_ line. The *owner* option is similar to the *user* option, with the restriction that the user must be the owner of the special file. This may be useful e.g. for _/dev/fd_ if a login script makes the console user owner of this device. The *group* option is similar, with the restriction that the user must be a member of the group of the special file.
The *user* mount option is accepted if no username is specified. If used in the format *user=someone*, the option is silently ignored and visible only for external mount helpers (/sbin/mount.<type>) for compatibility with some network filesystems.
=== Bind mount operation
Remount part of the file hierarchy somewhere else. The call is:
@ -1608,6 +1610,9 @@ The command *mount* does not pass the mount options *unbindable*, *runbindable*,
== ENVIRONMENT
*LIBMOUNT_FORCE_MOUNT2*={always|never|auto}::
force to use classic mount(2) system call (requires support for new file descriptors based mount API). The default is *auto*; in this case, libmount tries to be smart and use classic mount(2) only for well-known issues. If the new mount API is unavailable, libmount can still use traditional mount(2), although LIBMOUNT_FORCE_MOUNT2 is set to *never*.
*LIBMOUNT_FSTAB*=<path>::
overrides the default location of the _fstab_ file (ignored for suid)

Some files were not shown because too many files have changed in this diff Show more