]> git.ipfire.org Git - thirdparty/util-linux.git/log
thirdparty/util-linux.git
3 years agobuild-sys: release++ (v2.36.2) v2.36.2
Karel Zak [Fri, 12 Feb 2021 13:59:56 +0000 (14:59 +0100)] 
build-sys: release++ (v2.36.2)

Signed-off-by: Karel Zak <kzak@redhat.com>
3 years agodocs: update v2.36.2-ReleaseNotes
Karel Zak [Fri, 12 Feb 2021 13:58:42 +0000 (14:58 +0100)] 
docs: update v2.36.2-ReleaseNotes

Signed-off-by: Karel Zak <kzak@redhat.com>
3 years agodocs: update AUTHORS file
Karel Zak [Fri, 12 Feb 2021 13:57:07 +0000 (14:57 +0100)] 
docs: update AUTHORS file

Signed-off-by: Karel Zak <kzak@redhat.com>
3 years agopo: merge changes
Karel Zak [Fri, 12 Feb 2021 13:55:57 +0000 (14:55 +0100)] 
po: merge changes

Signed-off-by: Karel Zak <kzak@redhat.com>
3 years agopo: add sr.po (from translationproject.org)
Мирослав Николић [Fri, 12 Feb 2021 13:47:25 +0000 (14:47 +0100)] 
po: add sr.po (from translationproject.org)

3 years agopo: update sv.po (from translationproject.org)
Sebastian Rasmussen [Fri, 12 Feb 2021 13:47:25 +0000 (14:47 +0100)] 
po: update sv.po (from translationproject.org)

3 years agopo: update hr.po (from translationproject.org)
Božidar Putanec [Fri, 12 Feb 2021 13:47:25 +0000 (14:47 +0100)] 
po: update hr.po (from translationproject.org)

3 years agotests: be explicit with file permissions for cramfs
Karel Zak [Tue, 9 Feb 2021 17:02:13 +0000 (18:02 +0100)] 
tests: be explicit with file permissions for cramfs

Signed-off-by: Karel Zak <kzak@redhat.com>
3 years agotests: don't rely on scsi_debug partitions
Karel Zak [Thu, 11 Feb 2021 11:44:44 +0000 (12:44 +0100)] 
tests: don't rely on scsi_debug partitions

The disk layout as created by scsi_debug depends on kernel version.
Let's make the partition sizes hardcoded in our tests than rely on
kernel.

Signed-off-by: Karel Zak <kzak@redhat.com>
3 years agolibfdisk: (dos) fix last possible sector calculation
Karel Zak [Thu, 11 Feb 2021 10:49:56 +0000 (11:49 +0100)] 
libfdisk: (dos) fix last possible sector calculation

* rename 'last' to 'first' as we use this value as the first available free
  sector rather than last used

* use '-1' when calculate last partition sector to compare with last
  disk sector

* improve debug messages

Fixes: https://github.com/karelzak/util-linux/issues/1249
Signed-off-by: Karel Zak <kzak@redhat.com>
3 years agoagetty: tty eol defaults to REPRINT
Sami Loone [Tue, 9 Feb 2021 09:46:36 +0000 (10:46 +0100)] 
agetty: tty eol defaults to REPRINT

Adapting tty eol settings from defaults misbehaves as CTRL('r') aka
REPRINT is confused with CR. Consequently --skip-login does not set
tty CR<->NL translations and thus acts against advertised CR as eol
default.

[kzak@redhat.com:
   It seems this issue has been introduced by commit f566447 where we
   merged sulogin and agetty terminal initialization together to the file
   include/ttyutils.h.

  The original agetty has really used .eol=13 (aka CR) for the default.
  The problem is invisible for sulogin(1) because it always asks for a
  password and .eol= is set to NL/CR, the same agetty when it asks for
  username.]

Addresses: https://github.com/karelzak/util-linux/pull/1247
Signed-off-by: Karel Zak <kzak@redhat.com>
3 years agorfkill: stop execution when rfkill device cannot be opened
Sami Kerola [Fri, 23 Oct 2020 19:39:24 +0000 (20:39 +0100)] 
rfkill: stop execution when rfkill device cannot be opened

Without this two error messages are printed when rfkill device
cannot be opened.

    $ rfkill
    rfkill: cannot open /dev/rfkill: No such file or directory
    rfkill: cannot read /dev/rfkill: Bad file descriptor

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
3 years agoswitch_root: check if mount point to move even exists
Thomas Deutschmann [Mon, 8 Feb 2021 14:30:25 +0000 (15:30 +0100)] 
switch_root: check if mount point to move even exists

Signed-off-by: Thomas Deutschmann <whissi@gentoo.org>
3 years agolibmount: (py) do not use pointer as an integer value
Karel Zak [Wed, 10 Feb 2021 09:47:27 +0000 (10:47 +0100)] 
libmount: (py) do not use pointer as an integer value

Signed-off-by: Karel Zak <kzak@redhat.com>
3 years agoblkdiscard: fix compiler warnings [-Wmaybe-uninitialized]
Karel Zak [Mon, 14 Dec 2020 14:56:55 +0000 (15:56 +0100)] 
blkdiscard: fix compiler warnings [-Wmaybe-uninitialized]

sys-utils/blkdiscard.c: In function 'main':
sys-utils/blkdiscard.c:304:33: warning: 'now.tv_usec' may be used uninitialized in this function [-Wmaybe-uninitialized]
sys-utils/blkdiscard.c:152:17: note: 'now.tv_usec' was declared here
sys-utils/blkdiscard.c:305:37: warning: 'now.tv_sec' may be used uninitialized in this function [-Wmaybe-uninitialized]
sys-utils/blkdiscard.c:152:17: note: 'now.tv_sec' was declared here
sys-utils/blkdiscard.c:304:33: warning: 'last.tv_usec' may be used uninitialized in this function [-Wmaybe-uninitialized]
sys-utils/blkdiscard.c:152:22: note: 'last.tv_usec' was declared here
sys-utils/blkdiscard.c:305:65: warning: 'last.tv_sec' may be used uninitialized in this function [-Wmaybe-uninitialized]
sys-utils/blkdiscard.c:152:22: note: 'last.tv_sec' was declared here

Signed-off-by: Karel Zak <kzak@redhat.com>
3 years agohwclock: fix compiler warnings [-Wmaybe-uninitialized]
Karel Zak [Mon, 14 Dec 2020 14:56:55 +0000 (15:56 +0100)] 
hwclock: fix compiler warnings [-Wmaybe-uninitialized]

sys-utils/hwclock-rtc.c: In function 'synchronize_to_clock_tick_rtc':
sys-utils/hwclock.c:169:28: warning: 'now.tv_usec' may be used uninitialized in this function [-Wmaybe-uninitialized]
sys-utils/hwclock-rtc.c:215:24: note: 'now.tv_usec' was declared here
sys-utils/hwclock.c:168:28: warning: 'now.tv_sec' may be used uninitialized in this function [-Wmaybe-uninitialized]
sys-utils/hwclock-rtc.c:215:24: note: 'now.tv_sec' was declared here
sys-utils/hwclock.c:169:28: warning: 'begin.tv_usec' may be used uninitialized in this function [-Wmaybe-uninitialized]
sys-utils/hwclock-rtc.c:215:17: note: 'begin.tv_usec' was declared here
sys-utils/hwclock.c:168:28: warning: 'begin.tv_sec' may be used uninitialized in this function [-Wmaybe-uninitialized]
sys-utils/hwclock-rtc.c:215:17: note: 'begin.tv_sec' was declared here

Signed-off-by: Karel Zak <kzak@redhat.com>
3 years agoscriptlive: fix compiler warnings [-Wmaybe-uninitialized]
Karel Zak [Mon, 14 Dec 2020 14:56:55 +0000 (15:56 +0100)] 
scriptlive: fix compiler warnings [-Wmaybe-uninitialized]

term-utils/scriptlive.c: In function 'process_next_step':
term-utils/scriptlive.c:125:4: warning: 'now.tv_usec' may be used uninitialized in this function [-Wmaybe-uninitialized]
term-utils/scriptlive.c:122:19: note: 'now.tv_usec' was declared here
term-utils/scriptlive.c:125:4: warning: 'now.tv_sec' may be used uninitialized in this function [-Wmaybe-uninitialized]
term-utils/scriptlive.c:122:19: note: 'now.tv_sec' was declared here

Signed-off-by: Karel Zak <kzak@redhat.com>
3 years agoscript: fix compiler warnings [-Wmaybe-uninitialized]
Karel Zak [Mon, 14 Dec 2020 14:56:55 +0000 (15:56 +0100)] 
script: fix compiler warnings [-Wmaybe-uninitialized]

term-utils/script.c: In function 'log_close.part.0.isra':
term-utils/script.c:306:3: warning: 'now.tv_usec' may be used uninitialized in this function [-Wmaybe-uninitialized]
term-utils/script.c:303:18: note: 'now.tv_usec' was declared here
term-utils/script.c:306:3: warning: 'now.tv_sec' may be used uninitialized in this function [-Wmaybe-uninitialized]
term-utils/script.c:303:18: note: 'now.tv_sec' was declared here

Signed-off-by: Karel Zak <kzak@redhat.com>
3 years agogithub: remove cifuzz from stable branch
Karel Zak [Wed, 10 Feb 2021 09:31:23 +0000 (10:31 +0100)] 
github: remove cifuzz from stable branch

It requires many changes from the master branch to make fuzzer usable.
For now it's overkill to backport it to the stable/2.36

Signed-off-by: Karel Zak <kzak@redhat.com>
3 years agolibmount: fix /{etc,proc}/filesystems use
Karel Zak [Tue, 9 Feb 2021 09:36:04 +0000 (10:36 +0100)] 
libmount: fix /{etc,proc}/filesystems use

* always update context->helper
* consolidate helper and syscall status use

Signed-off-by: Karel Zak <kzak@redhat.com>
3 years agologin: use full tty path for PAM_TTY
Karel Zak [Wed, 3 Feb 2021 13:45:15 +0000 (14:45 +0100)] 
login: use full tty path for PAM_TTY

pam_set_item() man page:
 PAM_TTY
   The terminal name: prefixed by /dev/ if it is a device file;
   for graphical, X-based, applications the value for this item
   should be the $DISPLAY variable.

It seems for example pam_timestamp module is not robust enough to
differentiate between /dev/ and pty/0 and it assumes that '/' in the
path always means '/dev/' prefix ...

Fixes: https://github.com/karelzak/util-linux/issues/1242
Signed-off-by: Karel Zak <kzak@redhat.com>
3 years agosu: use full tty path for PAM_TTY
Karel Zak [Wed, 3 Feb 2021 13:45:15 +0000 (14:45 +0100)] 
su: use full tty path for PAM_TTY

pam_set_item() man page:
 PAM_TTY
   The terminal name: prefixed by /dev/ if it is a device file;
   for graphical, X-based, applications the value for this item
   should be the $DISPLAY variable.

It seems for example pam_timestamp module is not robust enough to
differentiate between /dev/ and pty/0 and it assumes that '/' in the
path always means '/dev/' prefix ...

Fixes: https://github.com/karelzak/util-linux/issues/1242
Signed-off-by: Karel Zak <kzak@redhat.com>
3 years agofsck.cramfs: fix fsck.cramfs crashes on blocksizes > 4K
ToddRK [Thu, 28 Jan 2021 11:44:41 +0000 (12:44 +0100)] 
fsck.cramfs: fix fsck.cramfs crashes on blocksizes > 4K

fsck.cramfs crashes when extracting a cramfs image with a 16KB blocksize.
The read_buffer is hardcoded for a 4KB blocksize.  When using a blocksize
larger than 4KB, the program's code uses indexes that go past the end of the
allocated space for the read_buffer and this causes the crash.

The following changes fix the problem for me in the latest 2.36.1 release of
fsck.cramfs.c.  However there are hardcoded values of 4096 in the code that
might cause problems under other circumstances and I have not attempted to
fix those.

[kzak@redhat.com: - some coding style changes to code]

Fixes: https://github.com/karelzak/util-linux/issues/1232
Signed-off-by: ToddRK <ToddRK@example.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
3 years agolibmount: add vboxsf, virtiofs to pseudo filesystems
Shahid Laher [Wed, 20 Jan 2021 18:04:33 +0000 (18:04 +0000)] 
libmount: add vboxsf, virtiofs to pseudo filesystems

Filesystems provided by a hypervisor for guest kernels:
* vboxsf: Linux 5.6
* virtiofs: Linux 5.4

Signed-off-by: Shahid Laher <govellius@gmail.com>
3 years agolibmount: do not canonicalize ZFS source dataset
Karel Zak [Thu, 14 Jan 2021 11:45:28 +0000 (12:45 +0100)] 
libmount: do not canonicalize ZFS source dataset

Fixes: https://github.com/karelzak/util-linux/issues/1231
Addresses: https://github.com/systemd/systemd/issues/18188
Addresses: https://github.com/openzfs/zfs/pull/11295
Signed-off-by: Karel Zak <kzak@redhat.com>
3 years agolib/loopdev: make is_loopdev() more robust
Karel Zak [Tue, 12 Jan 2021 10:43:31 +0000 (11:43 +0100)] 
lib/loopdev: make is_loopdev() more robust

It seems the current kernel can create a loop devices with a different
major number. For example

  # losetup /dev/loop12345678 file.img
  # lsblk /dev/loop12345678
  NAME          MAJ:MIN    RM SIZE RO TYPE MOUNTPOINT
  loop12345678   15:811342  0   5M  0 loop

We need a way how to verify the device is loopdev also when the device is
not associated with any backing file -- in this case there is no "loop"
directory in /sys/dev/block/<maj:min>/, but we can cannonicalize this sysfs
symlink as it points to /sys/devices/virtual/block/loop<n> (see "loop" in
the path).

Note that without this change losetup is not able to list and delete
the loop device.

Addresses: https://github.com/karelzak/util-linux/issues/1202
Signed-off-by: Karel Zak <kzak@redhat.com>
3 years agolibblkid: make gfs2 prober more extendible
Karel Zak [Mon, 11 Jan 2021 10:58:16 +0000 (11:58 +0100)] 
libblkid: make gfs2 prober more extendible

The current GFS2 prober hard codes superblock constants, but these
constants are affected by GFS2 development.

Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=1913844
Signed-off-by: Karel Zak <kzak@redhat.com>
3 years agolibfdisk: (script) ignore empty values for start and size
Gaël PORTAY [Sat, 9 Jan 2021 10:03:34 +0000 (05:03 -0500)] 
libfdisk: (script) ignore empty values for start and size

Signed-off-by: Gaël PORTAY <gael.portay@collabora.com>
3 years agosys-utils: mount.8: fix a typo
Eric Biggers [Thu, 31 Dec 2020 04:05:57 +0000 (20:05 -0800)] 
sys-utils: mount.8: fix a typo

It should be "inode", not "i-node".

Signed-off-by: Eric Biggers <ebiggers@google.com>
3 years agofstab.5: NTFS and FAT volume IDs use upper case
Heinrich Schuchardt [Thu, 31 Dec 2020 00:32:54 +0000 (01:32 +0100)] 
fstab.5: NTFS and FAT volume IDs use upper case

The man-page indicates that mount expects UUIDs to be lower case.

Mention that NTFS and FAT volume IDs are to be specified in upper case.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
3 years agoShow the 'r' option in the help menu
Vincent McIntyre [Sat, 2 Jan 2021 00:02:35 +0000 (11:02 +1100)] 
Show the 'r' option in the help menu

3 years agolibfdisk: ignore 33553920 byte optimal I/O size
Ryan Finnie [Sun, 27 Dec 2020 18:01:26 +0000 (10:01 -0800)] 
libfdisk: ignore 33553920 byte optimal I/O size

33553920 byte optimal I/O size arises from badly-implemented USB SATA
adapters reporting 0xffff 512 byte sectors (32 MiB - 512).  Commit
acb7651f8897ae73d0f45dd75bc87630001c61b9 indirectly addresses this by
ignoring the optimal I/O size if it's not a multiple of the physical
sector size.  That works if the physical sector size is 4096, but
33553920 optimal is allowed for 512 physical.

This commit explicitly ignores 33553920, as there is no legitimate
situation where this number would be the real optimal I/O size.

Signed-off-by: Ryan Finnie <ryan@finnie.org>
Closes: https://github.com/karelzak/util-linux/issues/1221
3 years agotests: add checksum for cramfs/mkfs for LE:16384 (ia64)
Anatoly Pugachev [Sat, 19 Dec 2020 18:36:00 +0000 (21:36 +0300)] 
tests: add checksum for cramfs/mkfs for LE:16384 (ia64)

Signed-off-by: Anatoly Pugachev <matorola@gmail.com>
3 years agoconfigure: test -a|o is not POSIX
Issam E. Maghni [Thu, 17 Dec 2020 00:16:11 +0000 (19:16 -0500)] 
configure: test -a|o is not POSIX

3 years agolsblk: read SCSI_IDENT_SERIAL also from udev
Karel Zak [Mon, 14 Dec 2020 10:38:04 +0000 (11:38 +0100)] 
lsblk: read SCSI_IDENT_SERIAL also from udev

Addresses: https://github.com/karelzak/util-linux/issues/1143
Signed-off-by: Karel Zak <kzak@redhat.com>
3 years agolosetup: fix wrong printf() format specifier for ino_t data type
Manuel Bentele [Sat, 5 Dec 2020 22:51:27 +0000 (23:51 +0100)] 
losetup: fix wrong printf() format specifier for ino_t data type

Since the range of the ino_t data type is platform-specific (depending on
the wordsize), a usage of the fixed format specifier %PRIu64 is not correct
for ino_t on some 32-bit architectures, eg. ARM (Raspberry Pi 1). This issue
may lead to undefinied output and is not reported by gcc (in version 10.2.0
and 8.3.0-6+rpi1) even though -Wformat is enabled by -Wall. Therefore it is
most likely that it seems to be a false negative error in gcc's format
specifier check, so that this issue was never detected before.

This change fixes the issue by the use of a cast, since there is no
platform-independent format specifier for ino_t available. The wrong format
specifier %PRIu64 is replaced by %ju, where its corresponding variable of
type ino_t is casted to uintmax_t. The type uintmax_t represents the largest
platform-specific unsigned integer, so that all integer values are preserved
for a platform-independent printing.

Fixes: https://github.com/karelzak/util-linux/issues/1211
Signed-off-by: Manuel Bentele <development@manuel-bentele.de>
3 years agolslogins: call close() for usable FD [coverity scan]
Karel Zak [Wed, 25 Nov 2020 13:02:11 +0000 (14:02 +0100)] 
lslogins: call close() for usable FD [coverity scan]

Signed-off-by: Karel Zak <kzak@redhat.com>
3 years agolibblkid: drbdmanage: use blkid_probe_strncpy_uuid instead of blkid_probe_set_id_label
Pali Rohár [Sun, 22 Nov 2020 18:44:09 +0000 (19:44 +0100)] 
libblkid: drbdmanage: use blkid_probe_strncpy_uuid instead of blkid_probe_set_id_label

Function blkid_probe_strncpy_uuid() is better suitable for setting UUID
than function blkid_probe_set_id_label().

Signed-off-by: Pali Rohár <pali.rohar@gmail.com>
3 years agosetpriv: small clean-up.
Érico Rolim [Fri, 20 Nov 2020 15:33:23 +0000 (12:33 -0300)] 
setpriv: small clean-up.

- Add _() calls for some strings which were missing it.
- In print_caps(), use the same error checking done in
  list_known_caps(); it is expected that libcap-ng will always return a
  string, even if it's only "cap_%d".

3 years agolib/signames: change license to public domain
Karel Zak [Thu, 19 Nov 2020 11:04:08 +0000 (12:04 +0100)] 
lib/signames: change license to public domain

The file is simple list of signal names and trivial function to search
in the list. We do not need any extra license here and as public
domain it will be more portable to other tools (GPL and BSD) in the
util-linux.

All previous contributors (Sami, Niklas and me) agree with this change.

Signed-off-by: Karel Zak <kzak@redhat.com>
3 years agoumount: ignore --no-canonicalize,-c for non-root users
Karel Zak [Thu, 19 Nov 2020 10:12:06 +0000 (11:12 +0100)] 
umount: ignore --no-canonicalize,-c for non-root users

It seems better to ignore this option than drop-permissions and later
exit with EPERMs. This change makes umount(8) more compatible with
fuser user umounts by systemd where -c is used to reduce overhead etc.

Addresses: https://github.com/karelzak/util-linux/issues/1192
Signed-off-by: Karel Zak <kzak@redhat.com>
3 years agohwclock: do not assume __NR_settimeofday_time32
Pino Toscano [Tue, 17 Nov 2020 10:32:45 +0000 (11:32 +0100)] 
hwclock: do not assume __NR_settimeofday_time32

Check that __NR_settimeofday_time32 exists before trying to use it as
syscall number.

Signed-off-by: Pino Toscano <toscano.pino@tiscali.it>
3 years agobuild-sys: do not build plymouth-ctrl.c w/ disabled plymouth
Pino Toscano [Tue, 17 Nov 2020 10:27:48 +0000 (11:27 +0100)] 
build-sys: do not build plymouth-ctrl.c w/ disabled plymouth

Do not build plymouth-ctrl.c in agetty and sulogin in case the plymouth
support is disabled.

Signed-off-by: Pino Toscano <toscano.pino@tiscali.it>
3 years agosetpriv: allow using [-+]all for capabilities.
Érico Rolim [Wed, 18 Nov 2020 14:35:26 +0000 (11:35 -0300)] 
setpriv: allow using [-+]all for capabilities.

The initial change to lib/caputils that allowed this was commit
5d95818757941bc609e5aeec5e2218f7d35a6e19, which made it possible to
trust the value returned by cap_last_cap().

The error message was also somewhat misleading, since cap_last_cap()
being smaller than CAP_LAST_CAP happens when setpriv itself is built
with kernel headers older than the currently running kernel, not due to
libcap-ng.

(cherry picked from commit 93de9f687d1640fff963f26b7db474eef3746532)

3 years agolib/procutils: improve proc_is_procfs(), add test
Karel Zak [Fri, 20 Nov 2020 09:38:01 +0000 (10:38 +0100)] 
lib/procutils: improve proc_is_procfs(), add test

* add delay between attempts
* zeroize errno and check for EAGAIN (like in other code)
* add small test program
   ./test_procutils --is-procfs [<dir>]

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

3 years agolib/caputils: add fall back for last cap using prctl.
Érico Rolim [Sun, 15 Nov 2020 04:34:41 +0000 (01:34 -0300)] 
lib/caputils: add fall back for last cap using prctl.

This allows the rest of the programs using cap_last_cap to trust the
value returned by it, since it will either be obtained from procfs
(straight from kernel) or with prctl.

Also checked if the file under /proc is actually mounted in a procfs.

(cherry picked from commit 5d95818757941bc609e5aeec5e2218f7d35a6e19)

3 years agolib/procutils: add proc_is_procfs helper.
Érico Rolim [Wed, 18 Nov 2020 17:07:10 +0000 (14:07 -0300)] 
lib/procutils: add proc_is_procfs helper.

Also add missing include in procutils.h for the definition of pid_t.

(cherry picked from commit e411b8a63d4a44ac191b5ca032c4639b12d4b838)

3 years agolibmount: don't use "symfollow" for helpers on user mounts
Karel Zak [Thu, 19 Nov 2020 08:49:16 +0000 (09:49 +0100)] 
libmount: don't use "symfollow" for helpers on user mounts

Addresses: https://github.com/karelzak/util-linux/issues/1193
Signed-off-by: Karel Zak <kzak@redhat.com>
3 years agobuild-sys: release++ (v2.36.1) v2.36.1
Karel Zak [Mon, 16 Nov 2020 10:51:33 +0000 (11:51 +0100)] 
build-sys: release++ (v2.36.1)

Signed-off-by: Karel Zak <kzak@redhat.com>
3 years agodocs: update v2.36.1-ReleaseNotes
Karel Zak [Mon, 16 Nov 2020 10:49:12 +0000 (11:49 +0100)] 
docs: update v2.36.1-ReleaseNotes

Signed-off-by: Karel Zak <kzak@redhat.com>
3 years agodocs: update AUTHORS file
Karel Zak [Mon, 16 Nov 2020 10:47:08 +0000 (11:47 +0100)] 
docs: update AUTHORS file

Signed-off-by: Karel Zak <kzak@redhat.com>
3 years agotests: an attempt to get around https://github.com/karelzak/util-linux/issues/1110
Evgeny Vereshchagin [Tue, 28 Jul 2020 08:04:35 +0000 (08:04 +0000)] 
tests: an attempt to get around https://github.com/karelzak/util-linux/issues/1110

Signed-off-by: Evgeny Vereshchagin <evvers@ya.ru>
3 years agopo: merge changes
Karel Zak [Mon, 16 Nov 2020 10:26:07 +0000 (11:26 +0100)] 
po: merge changes

Signed-off-by: Karel Zak <kzak@redhat.com>
3 years agopo: update es.po (from translationproject.org)
Antonio Ceballos Roa [Mon, 16 Nov 2020 10:21:19 +0000 (11:21 +0100)] 
po: update es.po (from translationproject.org)

3 years agopo: update cs.po (from translationproject.org)
Petr Písař [Mon, 16 Nov 2020 10:21:19 +0000 (11:21 +0100)] 
po: update cs.po (from translationproject.org)

3 years agolscpu: Even more Arm part numbers
Jeremy Linton [Tue, 10 Nov 2020 16:05:04 +0000 (10:05 -0600)] 
lscpu: Even more Arm part numbers

Over the past two years Arm has published further MIDR/part numbers
on https://developer.arm.com/ip-products/processors/cortex-a.

Lets sync the arm_part structure for A65, A76AE, A77 and A78*.

Signed-off-by: Jeremy Linton <jeremy.linton@arm.com>
3 years agolibblkid: limit amount of parsed partitions
Samanta Navarro [Tue, 10 Nov 2020 10:48:04 +0000 (11:48 +0100)] 
libblkid: limit amount of parsed partitions

The linux kernel does not support more than 256 partitions
(DISK_MAX_PARTS). The atari and mac block devices have no such limits.

Use dos logical partition limit for atari as well (100).
Use the kernel limit for mac (256).

Signed-off-by: Samanta Navarro <ferivoz@riseup.net>
3 years agowipefs: (man) add hint to erase on partitions and disk
Karel Zak [Mon, 9 Nov 2020 11:54:18 +0000 (12:54 +0100)] 
wipefs: (man) add hint to erase on partitions and disk

Addresses: https://github.com/karelzak/util-linux/issues/1177
Signed-off-by: Karel Zak <kzak@redhat.com>
3 years agoflock: keep -E exit status more restrictive
Karel Zak [Mon, 9 Nov 2020 09:53:23 +0000 (10:53 +0100)] 
flock: keep -E exit status more restrictive

Addresses: https://github.com/karelzak/util-linux/issues/1180
Signed-off-by: Karel Zak <kzak@redhat.com>
3 years agolibblkid: allow a lot of mac partitions
Samanta Navarro [Sun, 8 Nov 2020 11:45:18 +0000 (11:45 +0000)] 
libblkid: allow a lot of mac partitions

If the map count is set to INT_MAX then the for loop does not stop
because its check is never false.

I have not found a correct upper limit. The other partition logics have
a maximum amount (exception is atari.c).

The loop itself wouldn't be endless. If the iteration reaches block 0
then the signature will be wrong. This means that map count = INT_MAX
case would fail even if such a setup would be correct on disk.

Signed-off-by: Samanta Navarro <ferivoz@riseup.net>
3 years agolibblkid: fix memory leak in config parser
Samanta Navarro [Sun, 8 Nov 2020 11:44:55 +0000 (11:44 +0000)] 
libblkid: fix memory leak in config parser

Multiple occurrences of CACHE_FILE lead to memory leaks.
Also if last occurrence of CACHE_FILE is empty then cache file is not
set to NULL again.

An example /etc/blkid.conf could be:

CACHE_FILE=/tmp/cache1
CACHE_FILE=/tmp/cache2
CACHE_FILE=

I would expect that CACHE_FILE is empty but actually it is still
/tmp/cache2.

Signed-off-by: Samanta Navarro <ferivoz@riseup.net>
3 years agosfdisk: fix backward --move-data
Karel Zak [Fri, 6 Nov 2020 10:38:51 +0000 (11:38 +0100)] 
sfdisk: fix backward --move-data

* fix final message where number of moved sectors overflow number of
  all moved sectors

* align last step size before we use it for backward mode source and
  destination offsets calculation

Addresses: https://github.com/karelzak/util-linux/issues/1176
Signed-off-by: Karel Zak <kzak@redhat.com>
3 years agosfdisk: correct --json --dump false exclusive
Dimitri John Ledkov [Wed, 4 Nov 2020 12:35:38 +0000 (12:35 +0000)] 
sfdisk: correct --json --dump false exclusive

`--json` implies `--dump`, thus `--json --dump` must be
allowed. `--list-free` is incompatible with `--dump`, and thus also
with `--json`. Currently `--json --dump` is prohibited, even though
`--list-free` is not specified at all.

Regression introduced in 03154d2cf25c1d5ce908da9e72d324004b8d5722.

Signed-off-by: Dimitri John Ledkov <xnox@ubuntu.com>
3 years agowhereis: support zst compressed man pages
Samanta Navarro [Wed, 4 Nov 2020 11:33:00 +0000 (11:33 +0000)] 
whereis: support zst compressed man pages

Add zst as extension for manual pages. Current version of man-db
supports zst extension out of the box.

Signed-off-by: Samanta Navarro <ferivoz@riseup.net>
3 years agowhereis: fix out of boundary read
Samanta Navarro [Wed, 4 Nov 2020 11:32:00 +0000 (11:32 +0000)] 
whereis: fix out of boundary read

If whereis encounters a short file name then an out of boundary
read can occur.

Signed-off-by: Samanta Navarro <ferivoz@riseup.net>
3 years agosfdisk: (docs) add more information about GPT attribute bits
Karel Zak [Wed, 4 Nov 2020 09:29:30 +0000 (10:29 +0100)] 
sfdisk: (docs) add more information about GPT attribute bits

Addresses: https://github.com/karelzak/util-linux/issues/1171
Signed-off-by: Karel Zak <kzak@redhat.com>
3 years agolib/randutils: rename random_get_bytes()
Sami Kerola [Mon, 2 Nov 2020 22:26:18 +0000 (22:26 +0000)] 
lib/randutils: rename random_get_bytes()

Rename random_get_bytes() to avoid colliding a Solaris library function that
has the same name.

Reported-by: Sad Clouds <cryintothebluesky@gmail.com>
Reference: https://lore.kernel.org/util-linux/20201101141608.ba365cf67d92ee3973226de9@gmail.com/
Reference: https://blogs.oracle.com/solaris/solaris-random-number-generation-v2
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
3 years agocast NULL to char * when using execl
Egor Chelak [Thu, 29 Oct 2020 17:49:07 +0000 (19:49 +0200)] 
cast NULL to char * when using execl

When calling variadic functions, NULL must be explicitly cast to a
desired type.
This is noted in the exec(3) manpage.

The call in newgrp.c was changed for consistency.

Signed-off-by: Egor Chelak <egor.chelak@gmail.com>
3 years agovipw: fix short write handling in copyfile
Egor Chelak [Thu, 29 Oct 2020 17:06:13 +0000 (19:06 +0200)] 
vipw: fix short write handling in copyfile

Since `off` and `nr` approach each other, the for-loop ends prematurely
when at least half of the buffer was written.  I think under certain
conditions this could cause the copy to be incomplete.

Signed-off-by: Egor Chelak <egor.chelak@gmail.com>
3 years agolibmount: Fix 0x%u usage
Dr. David Alan Gilbert [Sat, 17 Oct 2020 12:05:34 +0000 (13:05 +0100)] 
libmount: Fix 0x%u usage

There's a couple of places which use varients on "0x%u" in format strings;
that's almost always wrong - you either want 0x%x or just %u.  In libmount's
case it's flags, so I'm assuming the intention really is hex.  In the ja.po
case it's %u in the original msgid.

Signed-off-by: Dr. David Alan Gilbert <dave@treblig.org>
3 years agosfdisk: do not free device name too soon [coverity scan]
Sami Kerola [Sun, 9 Aug 2020 12:58:10 +0000 (13:58 +0100)] 
sfdisk: do not free device name too soon [coverity scan]

Fixes use after free error.

CID: 360798
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
3 years agologin: close() only a file descriptor that is open [coverity scan]
Sami Kerola [Sun, 9 Aug 2020 12:34:00 +0000 (13:34 +0100)] 
login: close() only a file descriptor that is open [coverity scan]

CID: 360819
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
3 years agologin: ensure getutxid() does not use uninitialized variable [coverity scan]
Sami Kerola [Sat, 8 Aug 2020 19:06:42 +0000 (20:06 +0100)] 
login: ensure getutxid() does not use uninitialized variable [coverity scan]

Field ut.ut_pid is uninitialized when calling getutxline().  The safest
option is to ensure all struct data is initialized in the function.

CID: 360793
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
3 years agolib/pager: fix improper use of negative value [coverity scan]
Sami Kerola [Sat, 8 Aug 2020 19:02:01 +0000 (20:02 +0100)] 
lib/pager: fix improper use of negative value [coverity scan]

The close(2) cannot accept a negative number.

CID: 360777
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
3 years agounshare: fix bad bit shift operation [coverity scan]
Sami Kerola [Sat, 8 Aug 2020 18:45:30 +0000 (19:45 +0100)] 
unshare: fix bad bit shift operation [coverity scan]

Variable cap was 32 bits and shifting it by 64 bits resulted to the shift
going over a variable boundary.

CID: 360799
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
Signed-off-by: Karel Zak <kzak@redhat.com>
3 years agohardlink: fix hardlink pcre leak
Sami Kerola [Sat, 8 Aug 2020 18:05:29 +0000 (19:05 +0100)] 
hardlink: fix hardlink pcre leak

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
3 years agodo not require sys/syscall.h on non-linux platforms
Eric Simpson [Tue, 13 Oct 2020 16:55:05 +0000 (12:55 -0400)] 
do not require sys/syscall.h on non-linux platforms

In order to build util-linux on other platforms (such as IBM i), do not require the linux-specific sys/syscall.h.

3 years agotests: update atari partx tests
Karel Zak [Tue, 13 Oct 2020 16:34:39 +0000 (18:34 +0200)] 
tests: update atari partx tests

Signed-off-by: Karel Zak <kzak@redhat.com>
3 years agofstrim: remove fstab condition from fstrim.timer
Dusty Mabe [Tue, 13 Oct 2020 15:26:16 +0000 (11:26 -0400)] 
fstrim: remove fstab condition from fstrim.timer

In 9995da0 we added support to fstrim to be able to fall back to
`/proc/self/mountinfo` if `/etc/fstab` didn't exist, but we forgot
to remove the `/etc/fstab` condition from the timer. Let's remove
that condition from the timer so we can go back to periodically
running `fstrim.service`.

3 years agotests: update atari blkid tests
Karel Zak [Tue, 13 Oct 2020 14:29:19 +0000 (16:29 +0200)] 
tests: update atari blkid tests

The old images of the atari label are truncated and in-table stored
sizes do not match with real images sizes -- libblkid checks it now.

I have no idea how to generate ICD format, let's ignore it in tests
for now.

Signed-off-by: Karel Zak <kzak@redhat.com>
3 years agolibblkid: make Atari more robust
Karel Zak [Tue, 13 Oct 2020 14:19:20 +0000 (16:19 +0200)] 
libblkid: make Atari more robust

* ignore large disks
* check in-table stored device size
* check bad sectors list
* check partition dimensions against in-table device size

Addresses: https://github.com/karelzak/util-linux/issues/1159
Signed-off-by: Karel Zak <kzak@redhat.com>
3 years agolosetup: increase limit of setup attempts
Karel Zak [Tue, 13 Oct 2020 10:55:44 +0000 (12:55 +0200)] 
losetup: increase limit of setup attempts

Signed-off-by: Karel Zak <kzak@redhat.com>
3 years agolosetup: avoid infinite busy loop
Karel Zak [Tue, 13 Oct 2020 08:31:42 +0000 (10:31 +0200)] 
losetup: avoid infinite busy loop

issue report:
 if i run the heavy duty test from #16859 a couple of times I can get
 the loopback layer in the kernel into a state where there's a loopback
 block device allocated, that you can open, but where both LOOP_CLR_FD
 and _SET_FD fail with EBUSY. and /dev/loop-control still returns it as
 the next free one...  weird state util-linux losetup when called to
 allocate a new device then freezes

This commit:
* restrict number of attempts to 16
* use 200000ms sleep between attempts
* add note about non-atomic loop device setup to the man page

Reported-by: Lennart Poettering <lennart@poettering.net>
Signed-off-by: Karel Zak <kzak@redhat.com>
3 years agolib/sysfs: fix doble free [coverity scan]
Karel Zak [Fri, 9 Oct 2020 11:46:35 +0000 (13:46 +0200)] 
lib/sysfs: fix doble free [coverity scan]

Signed-off-by: Karel Zak <kzak@redhat.com>
3 years agolibblkid: fix Atari prober logic
Karel Zak [Fri, 9 Oct 2020 11:06:08 +0000 (13:06 +0200)] 
libblkid: fix Atari prober logic

Addresses: https://github.com/karelzak/util-linux/issues/1159
Addresses: https://github.com/karelzak/util-linux/issues/1116
Signed-off-by: Karel Zak <kzak@redhat.com>
3 years agodocs: add hint about make install-strip and link to Documentation/
Karel Zak [Tue, 6 Oct 2020 13:35:09 +0000 (15:35 +0200)] 
docs: add hint about make install-strip and link to Documentation/

Signed-off-by: Karel Zak <kzak@redhat.com>
3 years agolib: add missing headers to .c files
Karel Zak [Tue, 6 Oct 2020 13:03:45 +0000 (15:03 +0200)] 
lib: add missing headers to .c files

Signed-off-by: Karel Zak <kzak@redhat.com>
3 years agobuild-sys: exclude GPL from libcommon
Karel Zak [Tue, 6 Oct 2020 11:26:36 +0000 (13:26 +0200)] 
build-sys: exclude GPL from libcommon

The library is not distributed and almost all code in this ar(1)
archive is Public Domain or LGPL ... but let's avoid any doubts and do
not mix non-GPL and GPL code there.

Addresses: https://github.com/karelzak/util-linux/issues/1157
Signed-off-by: Karel Zak <kzak@redhat.com>
3 years agolib/procutils: use Public Domain for this file
Karel Zak [Tue, 6 Oct 2020 11:15:29 +0000 (13:15 +0200)] 
lib/procutils: use Public Domain for this file

It's was originally GPL, but all the current code in the file is from
me and I don't think it makes sense to use GPL here anymore. We need
to use lib/ files in LGPL as well as in GPL binaries, etc. Let's makes
things (build-system) less complicated.

Signed-off-by: Karel Zak <kzak@redhat.com>
3 years agoagetty: fix typo in manual page
Samanta Navarro [Sat, 3 Oct 2020 11:57:56 +0000 (11:57 +0000)] 
agetty: fix typo in manual page

3 years agochrt: use SCHED_FLAG_RESET_ON_FORK for sched_setattr()
Karel Zak [Thu, 1 Oct 2020 08:40:27 +0000 (10:40 +0200)] 
chrt: use SCHED_FLAG_RESET_ON_FORK for sched_setattr()

Reviewed by many people, used for years (but probably nobody uses
SCHED_DEADLINE with reset-on-fork), but we all missed:

- sched_setscheduler() uses SCHED_RESET_ON_FORK (0x40000000)
- sched_setattr() uses SCHED_FLAG_RESET_ON_FORK (0x01)

Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=1883013
Signed-off-by: Karel Zak <kzak@redhat.com>
3 years agofdisk: always report fdisk_create_disklabel() errors
Karel Zak [Wed, 30 Sep 2020 09:49:05 +0000 (11:49 +0200)] 
fdisk: always report fdisk_create_disklabel() errors

This is fdisk, cfdisk and sfdisk change to inform user about fdisk_create_disklabel()
issues.

Addresses: https://github.com/karelzak/util-linux/issues/1147
Signed-off-by: Karel Zak <kzak@redhat.com>
3 years agolibfdisk: (gpt) make sure device is large enough
Karel Zak [Wed, 30 Sep 2020 09:44:03 +0000 (11:44 +0200)] 
libfdisk: (gpt) make sure device is large enough

The current code creates GPT header and partitions arrays (with 128
entries ...) although there is no space for all the stuff. This patch
forces fdisk_create_disklabel() to return -ENOSPC if the last and first
usable LBA calculation is out of device size.

Addresses: https://github.com/karelzak/util-linux/issues/1147
Signed-off-by: Karel Zak <kzak@redhat.com>
3 years agolscpu: Add FUJITSU aarch64 A64FX cpupart
Shunsuke Nakamura [Mon, 28 Sep 2020 09:46:14 +0000 (18:46 +0900)] 
lscpu: Add FUJITSU aarch64 A64FX cpupart

Add an entry for FUJITSU aarch64 part A64FX.
I tested it on the FX1000.

Signed-off-by: Shunsuke Nakamura <nakamura.shun@fujitsu.com>
3 years agoblockdev: fix man page formatting
Jakub Wilk [Sat, 26 Sep 2020 16:15:42 +0000 (18:15 +0200)] 
blockdev: fix man page formatting

Signed-off-by: Jakub Wilk <jwilk@jwilk.net>
3 years agolscpu: avoid segfault on PowerPC systems with valid hardware configurations
Thomas Abraham [Thu, 24 Sep 2020 18:52:33 +0000 (14:52 -0400)] 
lscpu: avoid segfault on PowerPC systems with valid hardware configurations

ntypes greater than 1 is valid in some hardware configurations, and an assert()
on the value isn't necessary or very future proof

3 years agolsblk: fix SCSI_IDENT_SERIAL
Karel Zak [Thu, 24 Sep 2020 07:56:03 +0000 (09:56 +0200)] 
lsblk: fix SCSI_IDENT_SERIAL

It seems sg3_utils does not use ID_ prefix like other udev stuff.

Addresses: https://github.com/karelzak/util-linux/issues/1143
Signed-off-by: Karel Zak <kzak@redhat.com>
3 years agolsblk: read ID_SCSI_IDENT_SERIAL if available
Karel Zak [Wed, 23 Sep 2020 13:41:05 +0000 (15:41 +0200)] 
lsblk: read ID_SCSI_IDENT_SERIAL if available

This SERIAL comes from sg3_utils.

Addresses: https://github.com/karelzak/util-linux/issues/1143
Signed-off-by: Karel Zak <kzak@redhat.com>
3 years agolibfdisk: add "Linux /usr" and "Linux /usr verity" GPT partition types
nl6720 [Mon, 21 Sep 2020 15:20:16 +0000 (18:20 +0300)] 
libfdisk: add "Linux /usr" and "Linux /usr verity" GPT partition types

See https://systemd.io/DISCOVERABLE_PARTITIONS/ and https://github.com/systemd/systemd/pull/17101 .

Move ARM after x86-64, so that x86 and x86-64 are next to one another.

Signed-off-by: nl6720 <nl6720@gmail.com>
3 years agofallocate: fix --dig-holes at end of files
Gero Treuner [Thu, 10 Sep 2020 19:43:03 +0000 (21:43 +0200)] 
fallocate: fix --dig-holes at end of files

I discovered that making a file sparse with "fallocate -d filename"
fails on the last block of a file, because - usually being partial -
the system call only zeroes that part instead of deallocating the
block. See man fallocate(2) - section "Deallocating file space".

The expected call is punching the whole block beyond eof, which
doesn't change the file length because of flag FALLOC_FL_KEEP_SIZE.

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