]> git.ipfire.org Git - thirdparty/util-linux.git/log
thirdparty/util-linux.git
20 months agopo: add ro.po (from translationproject.org)
Remus-Gabriel Chelu [Mon, 4 Dec 2023 12:20:13 +0000 (13:20 +0100)] 
po: add ro.po (from translationproject.org)

20 months agopo: update es.po (from translationproject.org)
Antonio Ceballos Roa [Mon, 4 Dec 2023 12:20:13 +0000 (13:20 +0100)] 
po: update es.po (from translationproject.org)

20 months agolsfd: fix memory leak in append_filter_expr()
Karel Zak [Thu, 2 Nov 2023 11:42:55 +0000 (12:42 +0100)] 
lsfd: fix memory leak in append_filter_expr()

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

20 months agolsfd: avoid undefined behavior
Thomas Weißschuh [Sun, 19 Nov 2023 16:21:25 +0000 (17:21 +0100)] 
lsfd: avoid undefined behavior

Passing a pointer to a different datatype to tfind() then were inserted
evokes undefines behavior.
This triggers UBSAN as shown below.

Instead pass the proper structs.

```
../misc-utils/lsfd.c:513:27: runtime error: member access within misaligned address 0x7ffe9ee6495c for type 'struct proc', which requires 8 byte alignment
0x7ffe9ee6495c: note: pointer points here
  1a 1a 1a 1a 01 00 00 00  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  d0 49 e6 9e fe 7f 00 00
              ^
    #0 0x56159cfa4a3b in proc_tree_compare ../misc-utils/lsfd.c:513
    #1 0x7f9dd4d2d743 in __tfind (/usr/lib/libc.so.6+0x10f743) (BuildId: 8bfe03f6bf9b6a6e2591babd0bbc266837d8f658)
    #2 0x56159cfa4ac3 in get_proc ../misc-utils/lsfd.c:518
    #3 0x56159cfe217b in anon_pidfd_get_name ../misc-utils/lsfd-unkn.c:203
    #4 0x56159cfe1040 in unkn_fill_column ../misc-utils/lsfd-unkn.c:93
    #5 0x56159cfaaa37 in fill_column ../misc-utils/lsfd.c:1178
    #6 0x56159cfaaac5 in convert_file ../misc-utils/lsfd.c:1193
    #7 0x56159cfaac4f in convert ../misc-utils/lsfd.c:1212
    #8 0x56159cfb2b54 in main ../misc-utils/lsfd.c:2317
    #9 0x7f9dd4c45ccf  (/usr/lib/libc.so.6+0x27ccf) (BuildId: 8bfe03f6bf9b6a6e2591babd0bbc266837d8f658)
    #10 0x7f9dd4c45d89 in __libc_start_main (/usr/lib/libc.so.6+0x27d89) (BuildId: 8bfe03f6bf9b6a6e2591babd0bbc266837d8f658)
    #11 0x56159cfa3c34 in _start (util-linux/build-meson/lsfd+0x41c34) (BuildId: 35fece1a205f96a2dbfe7a0e93b658530de675c4)
```

Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
(cherry picked from commit 816109f6ffb99d3a7aee1ff6c3467803dcd7939c)

20 months agolsfd: (man) fix the form for the optional argument of --inet option
Masatake YAMATO [Wed, 12 Jul 2023 15:02:12 +0000 (00:02 +0900)] 
lsfd: (man) fix the form for the optional argument of --inet option

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
(cherry picked from commit d0fe6e42fc18f11367e5ee6275c2619f9f61e892)

20 months agoAdd Phytium FTC310 & FTC664 support
zuoqian [Wed, 29 Nov 2023 02:57:52 +0000 (02:57 +0000)] 
Add Phytium FTC310 & FTC664 support

Signed-off-by: zuoqian <zuoqian2023@gmail.com>
(cherry picked from commit c5d9cc4c787b8e58f918c901ee5a92286bf891e8)

20 months agoAdd Phytium FTC862 cpu model.
unknown [Tue, 12 Sep 2023 08:11:43 +0000 (16:11 +0800)] 
Add Phytium FTC862 cpu model.
fix:#2486

(cherry picked from commit b36a79254087107e2ddd9032a131832508ddb7f8)

20 months agolibmount: accept '\' as escape for options separator
Karel Zak [Tue, 28 Nov 2023 13:40:48 +0000 (14:40 +0100)] 
libmount: accept '\' as escape for options separator

The libmount library can accept any characters as an option value when
the value is quoted (e.g., foo="b,a,r"). However, overlayfs users have
been using '\' as an escape character (e.g., lowerdir=foo\,bar).

Although this escaping mechanism was never officially supported by
libmount/mount, it worked for the old mount(2) API because it kept the
options string unparsed for the mount(2) syscall.

The introduction of the new mount API, which utilizes fsconfig(2) per
option, has brought attention to this issue.

This patch addresses the problem by introducing official support for
'\' as an escape character for options separator.

Suggested-by: Miklos Szeredi <miklos@szeredi.hu>
References: https://lore.kernel.org/all/CAOQ4uxhgUSPkYAV8SJu-SFszkJcVO3-M4DXf46nJUtXODrPk2g@mail.gmail.com/T/#ma8e6cfc1ce7229abc089e03eed99b23b90d701e5
Signed-off-by: Karel Zak <kzak@redhat.com>
(cherry picked from commit f6c29efa929cb8c741591ab38061e7921d53a997)

20 months agotests: add ts_skip_docker
Thomas Weißschuh [Wed, 31 May 2023 15:27:38 +0000 (17:27 +0200)] 
tests: add ts_skip_docker

Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
(cherry picked from commit 023e77d26a12aa632266e2a967e944bcbf9c8a12)

20 months agoMerge branch 'stable-2.39/bcachefs-fixes' of https://github.com/t-8ch/util-linux...
Karel Zak [Mon, 27 Nov 2023 10:25:29 +0000 (11:25 +0100)] 
Merge branch 'stable-2.39/bcachefs-fixes' of https://github.com/t-8ch/util-linux into PR/stable-v2.39.3

* 'stable-2.39/bcachefs-fixes' of https://github.com/t-8ch/util-linux:
  tests: skip broken tests on docker
  libblkid: (bcachefs) add support for sub-device labels
  libblkid: (bcachefs) adapt to major.minor version

20 months agotests: skip broken tests on docker
Thomas Weißschuh [Wed, 31 May 2023 15:31:01 +0000 (17:31 +0200)] 
tests: skip broken tests on docker

Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
(cherry picked from commit d53284bb1e40f19ac065e52ff9df97d2caf60259)

20 months agolibblkid: (bcachefs) add support for sub-device labels
Thomas Weißschuh [Tue, 26 Sep 2023 07:43:35 +0000 (09:43 +0200)] 
libblkid: (bcachefs) add support for sub-device labels

Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
(cherry picked from commit da91337a8109beb461c889ffe32701d3cb95aee2)

20 months agolibblkid: (bcachefs) adapt to major.minor version
Thomas Weißschuh [Sun, 9 Jul 2023 18:03:57 +0000 (20:03 +0200)] 
libblkid: (bcachefs) adapt to major.minor version

The version superblock field has been split into a major and minor
version part in the upstream code.
Adapt libblkid to it.

Link: https://lore.kernel.org/linux-bcachefs/20230709171551.2349961-11-kent.overstreet@linux.dev/
Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
(cherry picked from commit 8beea162ce1c2f5a7565044b68434efbb96f0697)

20 months agolibuuid: avoid truncate clocks.txt to improve performance
Goldwyn Rodrigues [Tue, 10 Oct 2023 23:08:59 +0000 (18:08 -0500)] 
libuuid: avoid truncate clocks.txt to improve performance

Instead of explicitly truncating clocks.txt file, pad with
whitespaces in the end of file.
This is done to improve performance of libuuid on xfs
filesystems. Instead of truncating the file, pad it with whitespaces.
This is anyways used as a failsafe method in case truncate fails.

The reason why this regression was introduced was because of:
869ae85dae64 ("xfs: flush new eof page on truncate to avoid post-eof corruption")

An attempt to move the clocks.txt to /run (tmpfs) has been attempted before
[1] and with commit ab2e7dd17 ("libuuid: move clock state file from
/var/lib to /var/run"). The latter was reverted.

[1] https://www.spinics.net/lists/util-linux-ng/msg17331.html

Signed-off-by: Goldwyn Rodrigues <rgoldwyn@suse.com>
20 months agolibuuid/src/gen_uuid.c: fix cs_min declaration
Fabrice Fontaine [Tue, 7 Nov 2023 17:43:57 +0000 (18:43 +0100)] 
libuuid/src/gen_uuid.c: fix cs_min declaration

Define cs_min through a define and not a const int to avoid the
following build failure with -O0 raised since version 2.39 and
https://github.com/util-linux/util-linux/commit/2fa4168c8bc9d5438bc1dfadda293c7c21b6fa59:

libuuid/src/gen_uuid.c: In function 'uuid_generate_time_generic':
libuuid/src/gen_uuid.c:536:33: error: initializer element is not constant
  THREAD_LOCAL int  cache_size = cs_min;
                                 ^~~~~~

For consistency, also use define for cs_max and cs_factor

Fixes:
 - http://autobuild.buildroot.org/results/2f80a5cdb523cc3c8c0f3693607a1be036b2ae98

Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
20 months agolibmount: fix possible NULL dereference [coverity scan]
Karel Zak [Mon, 6 Nov 2023 10:40:27 +0000 (11:40 +0100)] 
libmount: fix possible NULL dereference [coverity scan]

Signed-off-by: Karel Zak <kzak@redhat.com>
20 months agomeson: install wall executable with group 'tty'
Christian Hesse [Thu, 2 Nov 2023 10:37:33 +0000 (11:37 +0100)] 
meson: install wall executable with group 'tty'

... for proper permissions.

20 months agomeson: install write executable with group 'tty'
Christian Hesse [Tue, 31 Oct 2023 07:38:15 +0000 (08:38 +0100)] 
meson: install write executable with group 'tty'

... to fix:

write: effective gid does not match group of /dev/pts/3

20 months agolibmount: improve mnt_table_next_child_fs()
Karel Zak [Thu, 2 Nov 2023 09:41:03 +0000 (10:41 +0100)] 
libmount: improve mnt_table_next_child_fs()

The function utilizes the struct libmnt_itr to iterate through the mountinfo file
but neglects the direction specified by the iterator. This a bug. The application
must manage the direction, as, for instance, umount(8) requires the children of
the mountpoint in reverse order.

Fixes: https://github.com/util-linux/util-linux/issues/2552
Signed-off-by: Karel Zak <kzak@redhat.com>
20 months agodocs: add SPDX to boilerplate.c
Karel Zak [Wed, 1 Nov 2023 13:58:57 +0000 (14:58 +0100)] 
docs: add SPDX to boilerplate.c

Signed-off-by: Karel Zak <kzak@redhat.com>
20 months agodisk-utils: add SPDX and Copyright notices
Karel Zak [Wed, 1 Nov 2023 13:47:41 +0000 (14:47 +0100)] 
disk-utils: add SPDX and Copyright notices

Explicitly state the license (usually GPL-2.0-or-later; our default)
and include copyright statements in all files to prevent false positive
reports from license analysis tools. Add also add SPDX-License-Identifier
tag to all files.

Signed-off-by: Karel Zak <kzak@redhat.com>
20 months agoinclude/audit-arch: add missing SPDX
Karel Zak [Wed, 1 Nov 2023 12:56:01 +0000 (13:56 +0100)] 
include/audit-arch: add missing SPDX

Signed-off-by: Karel Zak <kzak@redhat.com>
20 months agosetterm: avoid restoring flags from uninitialized memory
Chris Hofstaedtler [Tue, 31 Oct 2023 13:52:26 +0000 (14:52 +0100)] 
setterm: avoid restoring flags from uninitialized memory

Depending on the used compiler and flags, previously either F_SETFL was called
with 0 or with a random value. Never with the intended previous flags.

[kzak@redhat.com: - tiny coding style change]

Signed-off-by: Chris Hofstaedtler <zeha@debian.org>
Tested-by: Emanuele Rocca <ema@debian.org>
Signed-off-by: Karel Zak <kzak@redhat.com>
20 months agoFix man page for col to correct documentation error
Connor-GH [Sat, 21 Oct 2023 22:58:36 +0000 (17:58 -0500)] 
Fix man page for col to correct documentation error

20 months agoUpdate col.c to fix option mistake
Connor-GH [Sat, 21 Oct 2023 22:55:49 +0000 (17:55 -0500)] 
Update col.c to fix option mistake

20 months agoumount: handle bindmounts during --recursive
Thomas Weißschuh [Tue, 17 Oct 2023 16:06:15 +0000 (18:06 +0200)] 
umount: handle bindmounts during --recursive

Fixes #2551

Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
20 months agolscpu: fix caches separator for --parse=<list>
Karel Zak [Thu, 12 Oct 2023 22:03:15 +0000 (00:03 +0200)] 
lscpu: fix caches separator for --parse=<list>

Fixes: https://github.com/util-linux/util-linux/issues/2544
Signed-off-by: Karel Zak <kzak@redhat.com>
20 months agoUse empty libuser config file.
Anatoly Pugachev [Thu, 12 Oct 2023 11:13:02 +0000 (14:13 +0300)] 
Use empty libuser config file.

In case of an absence /etc/libuser.conf, use empty file by pointing
LIBUSER_CONF to /dev/null. This allows chfn/gecos to pass without error.

PS: The "libuser" library is no longer maintained, and it was recommended
by the original author to not use it anymore.

20 months agolibblkid: exfat: fix fail to find volume label
Yuezhang Mo [Wed, 11 Oct 2023 10:42:11 +0000 (18:42 +0800)] 
libblkid: exfat: fix fail to find volume label

Commit f98b56326 set the maximum number of iterations to 10000.
If the volume label is after the 10000th entry, the volume label
will not be found. So this commit sets the maximum number of
iterations to correct value 256×1024×1024/32.

Fixes: f98b56326 ("libblkid: [exfat] Limit maximum number of iterations in find_label")
Signed-off-by: Yuezhang Mo <Yuezhang.Mo@sony.com>
Reviewed-by: Andy Wu <Andy.Wu@sony.com>
Reviewed-by: Aoyama Wataru <wataru.aoyama@sony.com>
20 months agoblkpr: store return value of getopt_long in int
Thomas Weißschuh [Wed, 11 Oct 2023 05:20:43 +0000 (07:20 +0200)] 
blkpr: store return value of getopt_long in int

getopt_long returns an int. Don't try to store it in a char.

See #2538.

Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
20 months agolib/path: Set errno in case of fgets failure
Tobias Stoeckmann [Tue, 10 Oct 2023 19:00:48 +0000 (21:00 +0200)] 
lib/path: Set errno in case of fgets failure

Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
20 months agoautotools: fix AC_DEFINE_UNQUOTED() use
Karel Zak [Mon, 9 Oct 2023 10:18:31 +0000 (12:18 +0200)] 
autotools: fix AC_DEFINE_UNQUOTED() use

Let's use AC_DEFINE_UNQUOTED() for string-like content, otherwise use
a simple AC_DEFINE().

Signed-off-by: Karel Zak <kzak@redhat.com>
20 months agoautotools: fix librtas check
Karel Zak [Mon, 9 Oct 2023 10:15:20 +0000 (12:15 +0200)] 
autotools: fix librtas check

Fixes: https://github.com/util-linux/util-linux/discussions/2527
Signed-off-by: Karel Zak <kzak@redhat.com>
20 months agolib/path: fix typos
Tobias Stoeckmann [Sun, 8 Oct 2023 18:51:07 +0000 (20:51 +0200)] 
lib/path: fix typos

Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
20 months agolib/path: set errno in case of error
Tobias Stoeckmann [Sun, 8 Oct 2023 18:47:53 +0000 (20:47 +0200)] 
lib/path: set errno in case of error

Some programs like lscpu expect errno to be set if ul_path_cpuparse
fails.

[kzak@redhat.com: - backport to stable/v2.39]

Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
Signed-off-by: Karel Zak <kzak@redhat.com>
20 months agolib/path: fix possible out of boundary access
Tobias Stoeckmann [Sun, 8 Oct 2023 18:41:29 +0000 (20:41 +0200)] 
lib/path: fix possible out of boundary access

If fgets reads from a file starting with a NUL byte in ul_path_cpuparse,
then the check for newline leads to an out of boundary access.

Proof of Concept (compile with --enable-asan):

1. Prepare /tmp/poc with required files
```
$ install -d /tmp/poc/sys/devices/system/cpu
$ dd if=/dev/zero of=/tmp/poc/sys/devices/system/cpu/possible bs=1 count=1
$ install -D /dev/null /tmp/poc/proc/cpuinfo
```

2. Run lscpu with sysroot option
```
$ lscpu --sysroot /tmp/poc
=================================================================
==78238==ERROR: AddressSanitizer: heap-buffer-overflow
```

Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
20 months agolibblkid: reset errno before calling probefuncs
Thomas Weißschuh [Mon, 2 Oct 2023 20:24:21 +0000 (22:24 +0200)] 
libblkid: reset errno before calling probefuncs

The probers optionally use errno to communicate error details.
When a leftover errno is set from libblkid internally this can confuse
the probers.

Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
Signed-off-by: Karel Zak <kzak@redhat.com>
20 months agosetpriv: fix group argument completion
Thomas Weißschuh [Mon, 2 Oct 2023 13:52:33 +0000 (15:52 +0200)] 
setpriv: fix group argument completion

Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
20 months agolibfdisk: reset errno before calling read()
Thomas Weißschuh [Mon, 2 Oct 2023 11:01:47 +0000 (13:01 +0200)] 
libfdisk: reset errno before calling read()

The else branch will be executed on short reads.
For those errno is not reset so a random left-over errno value may be
checked.

Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
20 months agoblkid: fix call to err_exclusive_options
Thomas Weißschuh [Mon, 2 Oct 2023 09:39:53 +0000 (11:39 +0200)] 
blkid: fix call to err_exclusive_options

err_exclusive_options needs to be passed the long options array,
otherwise it will crash.

Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
20 months agodocs: use HTTPS for GitHub clone URLs
Jakub Wilk [Mon, 2 Oct 2023 05:22:54 +0000 (07:22 +0200)] 
docs: use HTTPS for GitHub clone URLs

GitHub has dropped support for the git:// protocol:
https://github.blog/changelog/2022-03-15-removed-unencrypted-git-protocol-and-certain-ssh-keys/

20 months agolibblkid: (probe) handle probe without chain gracefully
Thomas Weißschuh [Wed, 27 Sep 2023 22:51:42 +0000 (00:51 +0200)] 
libblkid: (probe) handle probe without chain gracefully

Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
20 months agolib/idcache: always gracefully handle null cache
Thomas Weißschuh [Wed, 27 Sep 2023 22:40:28 +0000 (00:40 +0200)] 
lib/idcache: always gracefully handle null cache

The "get" functions already do this and some callers rely on it also for
"add" ones.

For completeness also handle it in free_idcache().

Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
20 months agoscript-playutils: close filestream in case ignore_line() fails
Thomas Weißschuh [Wed, 27 Sep 2023 21:30:27 +0000 (23:30 +0200)] 
script-playutils: close filestream in case ignore_line() fails

Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
20 months agolibblkid: (vxfs) report endianness
Thomas Weißschuh [Tue, 26 Sep 2023 22:49:04 +0000 (00:49 +0200)] 
libblkid: (vxfs) report endianness

Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
20 months agolibblkid: (ntfs) validate that sector_size is a power of two
Thomas Weißschuh [Mon, 25 Sep 2023 22:27:22 +0000 (00:27 +0200)] 
libblkid: (ntfs) validate that sector_size is a power of two

The NTFS prober reads data based off an offset of the sector size.
If the sector size is unaligned and the read data is cached then other
probers can read unaligned values.

Sector sizes for NTFS actually only make sense as power-of-two so
validate that and as a sideeffect avoid the unaligned reads.

Also add the reproducer from OSS-Fuzz that found this issue.

Fixes #2509

Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
20 months agolibsmartcols: handle nameless tables in export format
Thomas Weißschuh [Fri, 22 Sep 2023 09:20:36 +0000 (11:20 +0200)] 
libsmartcols: handle nameless tables in export format

fputs(NULL) is not allowed.

Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
20 months agoldattach: don't call exit() from signal handler
Thomas Weißschuh [Fri, 22 Sep 2023 18:21:38 +0000 (20:21 +0200)] 
ldattach: don't call exit() from signal handler

Instead use _exit().

Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
20 months agolslogins: fix realloc() loop allocation size
Thomas Weißschuh [Fri, 22 Sep 2023 18:08:22 +0000 (20:08 +0200)] 
lslogins: fix realloc() loop allocation size

If stat() fails the realloc loop would always try to allocate zero
bytes.

Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
20 months agolib/env: avoid underflow of read_all_alloc() return value
Thomas Weißschuh [Fri, 22 Sep 2023 09:19:37 +0000 (11:19 +0200)] 
lib/env: avoid underflow of read_all_alloc() return value

read_all_alloc() returns a negative error on failure.
When casting this to an unsigned type the failure check "< 1"
will not work.

Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
20 months agolibblkid: avoid memory leak of cachefile path
Thomas Weißschuh [Fri, 22 Sep 2023 09:20:04 +0000 (11:20 +0200)] 
libblkid: avoid memory leak of cachefile path

Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
20 months agolibmount: gracefully handle NULL path in mnt_resolve_target()
Thomas Weißschuh [Fri, 22 Sep 2023 09:30:57 +0000 (11:30 +0200)] 
libmount: gracefully handle NULL path in mnt_resolve_target()

Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
20 months agomore: avoid out-of-bound access
Thomas Weißschuh [Fri, 22 Sep 2023 17:53:24 +0000 (19:53 +0200)] 
more: avoid out-of-bound access

The realloc() needs to happen before that memory is used.

Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
20 months agolibfdisk: handle allocation failure in fdisk_new_partition
Thomas Weißschuh [Fri, 22 Sep 2023 17:35:01 +0000 (19:35 +0200)] 
libfdisk: handle allocation failure in fdisk_new_partition

Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
20 months agologin: Use pid_t for child_pid
Tobias Stoeckmann [Tue, 19 Sep 2023 18:45:40 +0000 (20:45 +0200)] 
login: Use pid_t for child_pid

Since child_pid keeps track of a PID, it should be of type pid_t
and not of type int.

Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
20 months agologin: move comment
Tobias Stoeckmann [Tue, 19 Sep 2023 18:42:03 +0000 (20:42 +0200)] 
login: move comment

In 0b4d75fae55b4a5ff8f65df8551c56cf1eeb9b08 the variable "timeout" has
been moved from global to local scope, but its comment was not.

Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
20 months agobuild-sys: fix libmount/src/hooks.c use
Karel Zak [Mon, 18 Sep 2023 11:08:57 +0000 (13:08 +0200)] 
build-sys: fix libmount/src/hooks.c use

Reported-by: Samuel Thibault <samuel.thibault@aquilenet.fr>
Signed-off-by: Karel Zak <kzak@redhat.com>
20 months agolscpu: Use 4K buffer size instead of BUFSIZ
Khem Raj [Fri, 15 Sep 2023 07:18:18 +0000 (00:18 -0700)] 
lscpu: Use 4K buffer size instead of BUFSIZ

Some lines in /proc/cpuinfo can be large e.g. flags and can then
truncate them in displaying them

BUFSIZ can vary quite a bit  e.g. glibc/linux systems its 8192
but on musl/linux and OSX its 1024, on mingW it is 256, some tests e.g.
x86_64-64cpu-linux6.2.tar.gz has added really long line for cpu flags
line which is greater than 1024 characters and hence this test fails
on musl because lscpu -s reports truncated string

Fixes x86_64-64cpu-linux6.2 tests

Signed-off-by: Khem Raj <raj.khem@gmail.com>
s

20 months agoautotools: fix typos
Karel Zak [Mon, 11 Sep 2023 18:27:37 +0000 (20:27 +0200)] 
autotools: fix typos

Signed-off-by: Karel Zak <kzak@redhat.com>
20 months agolibmount: make.stx_mnt_id use more robust
Karel Zak [Thu, 31 Aug 2023 08:30:55 +0000 (10:30 +0200)] 
libmount: make.stx_mnt_id use more robust

Signed-off-by: Karel Zak <kzak@redhat.com>
20 months agolibmount: report statx in features list
Karel Zak [Thu, 31 Aug 2023 08:26:37 +0000 (10:26 +0200)] 
libmount: report statx in features list

Let's make statx() support visible in "mount -V" output.

Signed-off-by: Karel Zak <kzak@redhat.com>
20 months agolibmount: fix statx() includes
Karel Zak [Wed, 23 Aug 2023 09:50:37 +0000 (11:50 +0200)] 
libmount: fix statx() includes

Using sys/stat.h and linux/stat is too tricky.h together. It seems
better to rely on libc and use sys/stat.h only. Users affected
by old libc must update to use recent util-linux.

Fixes: https://github.com/util-linux/util-linux/issues/2448
Signed-off-by: Karel Zak <kzak@redhat.com>
20 months agolibblkid: (vfat) avoid modifying shared buffer
Thomas Weißschuh [Tue, 29 Aug 2023 10:44:48 +0000 (12:44 +0200)] 
libblkid: (vfat) avoid modifying shared buffer

Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
20 months agolibblkid: (jmicron_raid) use checksum APIs
Thomas Weißschuh [Tue, 29 Aug 2023 10:31:35 +0000 (12:31 +0200)] 
libblkid: (jmicron_raid) use checksum APIs

Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
20 months agolibblkid: (jmicron_raid) avoid modifying shared buffer
Thomas Weißschuh [Tue, 29 Aug 2023 10:29:31 +0000 (12:29 +0200)] 
libblkid: (jmicron_raid) avoid modifying shared buffer

Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
20 months agolibblkid: (zonefs) avoid modifying shared buffer
Thomas Weißschuh [Tue, 29 Aug 2023 10:22:28 +0000 (12:22 +0200)] 
libblkid: (zonefs) avoid modifying shared buffer

Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
20 months agolosetup: fix JSON MAJ:MIN
Karel Zak [Mon, 28 Aug 2023 11:21:33 +0000 (13:21 +0200)] 
losetup: fix JSON MAJ:MIN

Fixes: https://github.com/util-linux/util-linux/issues/2460
Signed-off-by: Karel Zak <kzak@redhat.com>
20 months agolslogins: (man) fix -y option formatting
Thomas Weißschuh [Mon, 28 Aug 2023 07:30:59 +0000 (09:30 +0200)] 
lslogins: (man) fix -y option formatting

Fixes #2461

Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
20 months agoinclude: add DragonFlyBSD GPT partition types
Thomas Weißschuh [Mon, 28 Aug 2023 07:01:49 +0000 (09:01 +0200)] 
include: add DragonFlyBSD GPT partition types

Fixes #2462

Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
22 months agolibblkid: (bcachefs) fix size validation
Thomas Weißschuh [Wed, 23 Aug 2023 09:58:33 +0000 (11:58 +0200)] 
libblkid: (bcachefs) fix size validation

Avoid signed shift out-of-bounds.

Also mark the constants explitly as unsigned instead of casting.

Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
(cherry picked from commit befe455f59de8c7bc66b85ed52aae8cbc95325fa)

22 months agolibblkid: (bcachefs) fix compiler warning [-Werror=sign-compare]
Karel Zak [Wed, 23 Aug 2023 09:53:45 +0000 (11:53 +0200)] 
libblkid: (bcachefs) fix compiler warning [-Werror=sign-compare]

Addresses: https://github.com/util-linux/util-linux/pull/2427
Signed-off-by: Karel Zak <kzak@redhat.com>
(cherry picked from commit 17873d38fc97913c0a31d4bd08cfbfe45c4de5be)

22 months agolibblkid: (bcachefs) fix not detecting large superblocks
Colin Gillespie [Wed, 9 Aug 2023 08:28:07 +0000 (18:28 +1000)] 
libblkid: (bcachefs) fix not detecting large superblocks

Probing does not detect bcachefs filesystems with a superblock larger
than 4KiB. Bcachefs superblocks grow in size and can become much larger
than this.

Increase the superblock maximum size limit to 1MiB.

Validate the superblock isn't larger than the maximum size defined in
the superblocks layout section.

(cherry picked from commit 48d573797797650d96456979797c0155d58f61cb)

23 months agolibmount: Fix regression when mounting with atime
Filipe Manana [Thu, 17 Aug 2023 09:20:13 +0000 (10:20 +0100)] 
libmount: Fix regression when mounting with atime

A regression was introduced in v2.39 that causes mounting with the atime
option to fail:

  $ mkfs.ext4 -F /dev/sdi
  $ mount -o atime /dev/sdi /mnt/sdi
  mount: /mnt/sdi: not mount point or bad option.
         dmesg(1) may have more information after failed mount system call.

The failure comes from the mount_setattr(2) call returning -EINVAL. This
is because we pass an invalid value for the attr_clr argument. From a
strace capture we have:

  mount_setattr(4, "", AT_EMPTY_PATH, {attr_set=0, attr_clr=MOUNT_ATTR_NOATIME, propagation=0 /* MS_??? */, userns_fd=0}, 32) = -1 EINVAL (Invalid argument)

We can't pass MOUNT_ATTR_NOATIME to mount_setattr(2) through the attr_clr
argument because all atime options are exclusive, so in order to set atime
one has to pass MOUNT_ATTR__ATIME to attr_clr and leave attr_set as
MOUNT_ATTR_RELATIME (which is defined as a value of 0).

This can be read from the man page for mount_setattr(2) and also from the
kernel source:

  $ cat fs/namespace.c
  static int build_mount_kattr(const struct mount_attr *attr, size_t usize,
                               struct mount_kattr *kattr, unsigned int flags)
  {
      (...)
      /*
       * Since the MOUNT_ATTR_<atime> values are an enum, not a bitmap,
       * users wanting to transition to a different atime setting cannot
       * simply specify the atime setting in @attr_set, but must also
       * specify MOUNT_ATTR__ATIME in the @attr_clr field.
       * So ensure that MOUNT_ATTR__ATIME can't be partially set in
       * @attr_clr and that @attr_set can't have any atime bits set if
       * MOUNT_ATTR__ATIME isn't set in @attr_clr.
       */
      if (attr->attr_clr & MOUNT_ATTR__ATIME) {
          if ((attr->attr_clr & MOUNT_ATTR__ATIME) != MOUNT_ATTR__ATIME)
              return -EINVAL;

              /*
               * Clear all previous time settings as they are mutually
               * exclusive.
               */
              kattr->attr_clr |= MNT_RELATIME | MNT_NOATIME;
              switch (attr->attr_set & MOUNT_ATTR__ATIME) {
              case MOUNT_ATTR_RELATIME:
                  kattr->attr_set |= MNT_RELATIME;
                  break;
              case MOUNT_ATTR_NOATIME:
                  kattr->attr_set |= MNT_NOATIME;
                  break;
              case MOUNT_ATTR_STRICTATIME:
                  break;
              default:
                  return -EINVAL;
              }
    (...)

So fix this by setting attr_clr MOUNT_ATTR__ATIME if we want to clear any
atime related option.

Signed-off-by: Filipe Manana <fdmanana@kernel.org>
23 months agobuild-sys: release++ (v2.39.2) v2.39.2
Karel Zak [Thu, 17 Aug 2023 09:05:49 +0000 (11:05 +0200)] 
build-sys: release++ (v2.39.2)

Signed-off-by: Karel Zak <kzak@redhat.com>
23 months agodocs: update v2.39.2-ReleaseNotes
Karel Zak [Thu, 17 Aug 2023 09:04:21 +0000 (11:04 +0200)] 
docs: update v2.39.2-ReleaseNotes

Signed-off-by: Karel Zak <kzak@redhat.com>
23 months agodocs: update AUTHORS file
Karel Zak [Thu, 17 Aug 2023 09:00:54 +0000 (11:00 +0200)] 
docs: update AUTHORS file

Signed-off-by: Karel Zak <kzak@redhat.com>
23 months agopo-man: merge changes
Karel Zak [Thu, 17 Aug 2023 08:57:14 +0000 (10:57 +0200)] 
po-man: merge changes

Signed-off-by: Karel Zak <kzak@redhat.com>
23 months agopo: merge changes
Karel Zak [Thu, 17 Aug 2023 08:57:06 +0000 (10:57 +0200)] 
po: merge changes

Signed-off-by: Karel Zak <kzak@redhat.com>
23 months agopo-man: update sr.po (from translationproject.org)
Мирослав Николић [Thu, 17 Aug 2023 08:45:20 +0000 (10:45 +0200)] 
po-man: update sr.po (from translationproject.org)

23 months agopo: update sr.po (from translationproject.org)
Мирослав Николић [Thu, 17 Aug 2023 08:44:54 +0000 (10:44 +0200)] 
po: update sr.po (from translationproject.org)

23 months agopo: update ja.po (from translationproject.org)
Takeshi Hamasaki [Thu, 17 Aug 2023 08:44:54 +0000 (10:44 +0200)] 
po: update ja.po (from translationproject.org)

23 months agopo: update hr.po (from translationproject.org)
Božidar Putanec [Thu, 17 Aug 2023 08:44:54 +0000 (10:44 +0200)] 
po: update hr.po (from translationproject.org)

23 months agopo: update es.po (from translationproject.org)
Antonio Ceballos Roa [Thu, 17 Aug 2023 08:44:53 +0000 (10:44 +0200)] 
po: update es.po (from translationproject.org)

23 months agosetarch: add PER_LINUX_FDPIC fallback
Karel Zak [Tue, 15 Aug 2023 09:33:31 +0000 (11:33 +0200)] 
setarch: add PER_LINUX_FDPIC fallback

Fixes: https://github.com/util-linux/util-linux/issues/2436
Signed-off-by: Karel Zak <kzak@redhat.com>
23 months agolibblkid: fix topology chain types mismatch
Karel Zak [Mon, 14 Aug 2023 10:31:48 +0000 (12:31 +0200)] 
libblkid: fix topology chain types mismatch

Reported-by: https://github.com/util-linux/util-linux/pull/2430
References: https://github.com/util-linux/util-linux/commit/3ab9e699a8d90f55e0447516b7e05a8686180467
Signed-off-by: Karel Zak <kzak@redhat.com>
23 months agouuidd: improve man page for -cont-clock
Karel Zak [Wed, 9 Aug 2023 10:56:42 +0000 (12:56 +0200)] 
uuidd: improve man page for -cont-clock

Signed-off-by: Karel Zak <kzak@redhat.com>
23 months agozramctl: add hint about supported algorithms
Karel Zak [Wed, 9 Aug 2023 09:26:28 +0000 (11:26 +0200)] 
zramctl: add hint about supported algorithms

It seems the current list of the algorithms is confusing for
end-users, because it's inaccurate in many cases. Let's explain why
the list cannot be "perfect".

Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=2203324
Signed-off-by: Karel Zak <kzak@redhat.com>
23 months agomeson: check for HAVE_STRUCT_STATX_STX_MNT_ID
Karel Zak [Thu, 3 Aug 2023 11:39:32 +0000 (13:39 +0200)] 
meson: check for HAVE_STRUCT_STATX_STX_MNT_ID

References: c0136ac0c98b18208508fbcfac31a843e0bb8a37
Signed-off-by: Karel Zak <kzak@redhat.com>
23 months agoinclude: define pidfd syscalls if needed
Markus Mayer [Tue, 1 Aug 2023 20:08:24 +0000 (13:08 -0700)] 
include: define pidfd syscalls if needed

If the kernel headers are too old to provide the pidfd syscall numbers,
let's define them ourselves. This can be helpful while cross-compiling.
The runtime environment may provide a kernel that is new enough to
handle the calls, even if the toolchain doesn't.

Signed-off-by: Markus Mayer <mmayer@broadcom.com>
23 months agowall: do not error for ttys that do not exist
Mike Gilbert [Sat, 29 Jul 2023 21:32:57 +0000 (17:32 -0400)] 
wall: do not error for ttys that do not exist

Some wayland display managers (GDM) put strings like "seat0" in the
ut_line field of utmp entries. These are not valid tty devices.

Avoid writing a confusing error message for ttys that do not exist.

Bug: https://bugs.gentoo.org/911336
Signed-off-by: Mike Gilbert <floppym@gentoo.org>
23 months agocolumn: fix -l
Karel Zak [Wed, 2 Aug 2023 10:57:37 +0000 (12:57 +0200)] 
column: fix -l

The original implementation is complicated and broken.

It's possible to calculate the rest of the string (for the last
column) from the current position rather than calculate it
continuously. Use the last wcstok() result also means that it will
work as expected independently on "greedy" mode (skips repeating
separators.

 # printf 'a   b c d\n1 2 3 4\n' | ./column -t -o '|' -l3
 a|b|c d
 1|2|3 4

(see space between 'a' and 'b' on input)

References: 8ac75e31de0ece74515e98e0b22e54cc0a9808bd
Fixes: https://github.com/util-linux/util-linux/issues/1763
Signed-off-by: Karel Zak <kzak@redhat.com>
23 months agolscpu: Even more Arm part numbers (early 2023)
Jeremy Linton [Wed, 26 Jul 2023 20:54:20 +0000 (15:54 -0500)] 
lscpu: Even more Arm part numbers (early 2023)

There have been further MIDR/part numbers published
on https://developer.arm.com, they include:

Cortex-X4, Cortex-A520, Cortex-A720, Cortex-M85,
Cortex-M55 and Cortex-R52+.

Signed-off-by: Jeremy Linton <jeremy.linton@arm.com>
23 months agochrt: (man) add note about --sched-period lower limit
Karel Zak [Mon, 31 Jul 2023 10:41:39 +0000 (12:41 +0200)] 
chrt: (man) add note about --sched-period lower limit

References: https://github.com/util-linux/util-linux/pull/2393
Signed-off-by: Karel Zak <kzak@redhat.com>
23 months agomeson: add check for struct statx
Thomas Weißschuh [Thu, 3 Aug 2023 10:22:29 +0000 (12:22 +0200)] 
meson: add check for struct statx

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

If the systemcall is not available ENOSYS is returned.

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

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