]> git.ipfire.org Git - thirdparty/util-linux.git/log
thirdparty/util-linux.git
2 years agopo: update es.po (from translationproject.org)
Antonio Ceballos Roa [Mon, 31 Jan 2022 11:42:32 +0000 (12:42 +0100)] 
po: update es.po (from translationproject.org)

2 years agopo: update de.po (from translationproject.org)
Mario Blättermann [Mon, 31 Jan 2022 11:42:31 +0000 (12:42 +0100)] 
po: update de.po (from translationproject.org)

2 years agopo: update cs.po (from translationproject.org)
Petr Písař [Mon, 31 Jan 2022 11:42:31 +0000 (12:42 +0100)] 
po: update cs.po (from translationproject.org)

2 years agotests: update build-sys test
Karel Zak [Mon, 31 Jan 2022 11:38:49 +0000 (12:38 +0100)] 
tests: update build-sys test

Signed-off-by: Karel Zak <kzak@redhat.com>
2 years agobuild-sys: add cryptsetup config-gen template
Karel Zak [Mon, 31 Jan 2022 10:50:42 +0000 (11:50 +0100)] 
build-sys: add cryptsetup config-gen  template

Signed-off-by: Karel Zak <kzak@redhat.com>
2 years agofstrim: Add fstab option X-fstrim.notrim
Stanislav Brabec [Mon, 31 Jan 2022 09:53:20 +0000 (10:53 +0100)] 
fstrim: Add fstab option X-fstrim.notrim

Sometimes it makes sense to skip fstrim for selected file mounts, but
still be able to use fstrim.service.

Add a possibility to specify "X-fstrim.notrim" in fstab.

Do not use "notrim", as it collides with the kernel rbd driver.

[kzak@redhat.com: - rename x-fstrim to X-fstrim]

Signed-off-by: Stanislav Brabec <sbrabec@suse.cz>
Signed-off-by: Karel Zak <kzak@redhat.com>
2 years agoMerge branch 'patch-2' of https://github.com/mariobl/util-linux
Karel Zak [Mon, 31 Jan 2022 09:12:16 +0000 (10:12 +0100)] 
Merge branch 'patch-2' of https://github.com/mariobl/util-linux

* 'patch-2' of https://github.com/mariobl/util-linux:
  Improve markup in findmnt.8.adoc

2 years agohwclock: get/set param cleanup
Karel Zak [Mon, 31 Jan 2022 09:05:29 +0000 (10:05 +0100)] 
hwclock: get/set param cleanup

* move all code to hwclock-rtc.c
* use ul_strtou64() to simplify code
* use base=0 for ul_strtou64() to handle 10 and 16 base
* allocate for strtok() (we keep command line options read-only)

Signed-off-by: Karel Zak <kzak@redhat.com>
2 years agoImprove markup in findmnt.8.adoc
Mario Blättermann [Sat, 29 Jan 2022 11:25:16 +0000 (12:25 +0100)] 
Improve markup in findmnt.8.adoc

2 years agohwclock: cleanup hwclock_params[] use
Karel Zak [Fri, 28 Jan 2022 11:15:39 +0000 (12:15 +0100)] 
hwclock: cleanup hwclock_params[] use

* remove it from header file
* keep it 'static const'

Signed-off-by: Karel Zak <kzak@redhat.com>
2 years agodocs: document --param-get, --param-set
Bastian Krause [Fri, 21 Jan 2022 15:45:03 +0000 (16:45 +0100)] 
docs: document --param-get, --param-set

Signed-off-by: Bastian Krause <bst@pengutronix.de>
2 years agohwclock: add --param-set option
Bastian Krause [Fri, 21 Jan 2022 15:09:43 +0000 (16:09 +0100)] 
hwclock: add --param-set option

Implement the RTC_PARAM_SET RTC ioctl in hwclock. The ioctl interface was
introduced with [1], which went mainline in Kernel v5.16. The parameters
are independent of hardware/driver. This means we can read and set
parameters in a generic way.

The new --param-set hwclock function accepts aliases for parameters
currently existent (Kernel v5.16). They can be extended later on. As
fallback and for values, hexadecimal (if prefixed with 0x) and decimal
values, as defined in [2], are accepted.

Example:

  $ hwclock --param-set bsm=0x0

[1] https://lore.kernel.org/all/20211018151933.76865-1-alexandre.belloni@bootlin.com/
[2] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/include/uapi/linux/rtc.h

Signed-off-by: Bastian Krause <bst@pengutronix.de>
2 years agohwclock: add --param-get option
Bastian Krause [Fri, 21 Jan 2022 15:09:35 +0000 (16:09 +0100)] 
hwclock: add --param-get option

Implement the RTC_PARAM_GET RTC ioctl in hwclock. The ioctl interface was
introduced with [1], which went mainline in Kernel v5.16. The parameters
are independent of hardware/driver. This means we can read and set
parameters in a generic way.

The new --param-get hwclock function accepts aliases for parameters
currently existent (Kernel v5.16). They can be extended later on. As
fallback, hexadecimal (if prefixed with 0x) and decimal values, as
defined in [2], are accepted.

Example:

  $ hwclock --param-get features

[1] https://lore.kernel.org/all/20211018151933.76865-1-alexandre.belloni@bootlin.com/
[2] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/include/uapi/linux/rtc.h

Signed-off-by: Bastian Krause <bst@pengutronix.de>
2 years agohwclock: increase indent in help text
Bastian Krause [Fri, 21 Jan 2022 15:06:41 +0000 (16:06 +0100)] 
hwclock: increase indent in help text

This leaves more space for a longer option in a future commit.

Signed-off-by: Bastian Krause <bst@pengutronix.de>
2 years agofindmnt: add to the man page note about SOURCES
Karel Zak [Fri, 28 Jan 2022 10:28:06 +0000 (11:28 +0100)] 
findmnt: add to the man page note about SOURCES

References: https://github.com/util-linux/util-linux/pull/1576
Signed-off-by: Karel Zak <kzak@redhat.com>
2 years agofindmnt: allow SOURCES field even without '--fstab'
Goffredo Baroncelli [Sat, 22 Jan 2022 14:08:08 +0000 (15:08 +0100)] 
findmnt: allow SOURCES field even without '--fstab'

The SOURCES output field was fully enabled only when "--fstab" is
enabled too. This patch enables SOURCES even without "--fstab".

$ ./findmnt -o TARGET,SOURCES
TARGET                                        SOURCES
/                                             /dev/sdg3
├─/mnt/btrfs-raid1                            /dev/sdb2
│                                             /dev/sde2
│                                             /dev/sda2
└─/tmp/t                                      /dev/mapper/pool-v2
                                              /dev/mapper/pool-v1

If '--fstab' is passed, and in fstab the filesystem is referred by UUID,
only one UUID for filesystem is showed:

$ ./findmnt -o TARGET,SOURCES --fstab
TARGET                         SOURCES
/                              UUID=d7a06504-cc14-435d-a5df-674da09c2894
/mnt/btrfs-raid1               UUID=b39b0b27-ff80-4cb4-bf48-0be939ff0788

However if you pass '-e', all the devices are showed

$ ./findmnt -o TARGET,SOURCES --fstab -e
TARGET                         SOURCES
/                              /dev/sdg3
/mnt/btrfs-raid1               /dev/sdb2
                               /dev/sde2
                               /dev/sda2

[kzak@redhat.com: - support all tags (not only LABEL or UUID),
                  - fix small memory leak,
                  - simplify code]

Signed-off-by: Goffredo Baroncelli <kreijack@inwind.it>
Signed-off-by: Karel Zak <kzak@redhat.com>
2 years agofindmnt: fix compiler warning [-Werror=sign-compare]
Karel Zak [Fri, 28 Jan 2022 08:32:52 +0000 (09:32 +0100)] 
findmnt: fix compiler warning [-Werror=sign-compare]

misc-utils/findmnt.c:1496:43: error: comparison of integer expressions
of different signedness: ‘int’ and ‘long unsigned int’
[-Werror=sign-compare]

References: 68191a41174a691ac290a04171e9932f2028435a
Signed-off-by: Karel Zak <kzak@redhat.com>
2 years agoMerge branch 'output-all' of https://github.com/t-8ch/util-linux
Karel Zak [Fri, 28 Jan 2022 08:31:18 +0000 (09:31 +0100)] 
Merge branch 'output-all' of https://github.com/t-8ch/util-linux

2 years agoMerge branch 'mount-nosymfollow' of https://github.com/jwilk-forks/util-linux
Karel Zak [Fri, 28 Jan 2022 08:26:39 +0000 (09:26 +0100)] 
Merge branch 'mount-nosymfollow' of https://github.com/jwilk-forks/util-linux

* 'mount-nosymfollow' of https://github.com/jwilk-forks/util-linux:
  mount: Allow bind-mounting with "nosymfollow"

2 years agofindmnt: properly exclude poll columns from --output-all
Thomas Weißschuh [Thu, 27 Jan 2022 17:00:12 +0000 (18:00 +0100)] 
findmnt: properly exclude poll columns from --output-all

Previously columns excluded from --output-all where in fact stored as
column index 0. This however is COL_ACTION which is a polled column
leading to the following error:

findmnt --output-all
findmnt: ACTION column is requested, but --poll is not enabled

Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
2 years agolibfdisk: don't use too small free segments by default
Karel Zak [Thu, 27 Jan 2022 12:38:59 +0000 (13:38 +0100)] 
libfdisk: don't use too small free segments by default

Signed-off-by: Karel Zak <kzak@redhat.com>
2 years agolibfdisk: (gpt) align size of partition by default
Karel Zak [Thu, 27 Jan 2022 09:50:45 +0000 (10:50 +0100)] 
libfdisk: (gpt) align size of partition by default

LastUsableLBA (field in GPT header) is calculated to use all free
space on the device. The problem is that size of this area is
unaligned to optimal I/O (or physical sector size) on devices where
the logical sector is 512 bytes, but the physical sector size is 4K.
(Note that after LastUsableLBA is backup GPT header and size of this
backup is calculated by logical sectors.)

The problem is visible for the last partition on the device because
this partition ends on LastUsableLBA.

The ideal solution would be align directly LastUsableLBA number in the
GPT header. Unfortunately, this solution is useless for libfdisk,
because we have to be backwardly compatible with sfdisk scripts
generated by old versions where is explicitly specified partition
size.

It seems usable compromise is to align only last partition if the size
of the partition is unspecified or specified by relative number
(+100M) -- in this case we already align partition, so there is no
change in fdisk semantic (well, last partition will be smaller than in
previous libfdisk versions).

The unaligned partition size is a problem for dm-crypt where device
size is used dynamically, and when unaligned, DM uses 512-bytes with a
negative impact on performance.

Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=2044108
Addresses: https://marc.info/?l=dm-crypt&m=164306225923513&w=2
Signed-off-by: Karel Zak <kzak@redhat.com>
2 years agomount: Allow bind-mounting with "nosymfollow"
Jakub Wilk [Wed, 26 Jan 2022 20:30:04 +0000 (21:30 +0100)] 
mount: Allow bind-mounting with "nosymfollow"

Signed-off-by: Jakub Wilk <jwilk@jwilk.net>
2 years agolibfdisk: incorrect GUID for NetBSD
Siu Ching Pong -Asuka Kenji- [Tue, 25 Jan 2022 21:37:23 +0000 (05:37 +0800)] 
libfdisk: incorrect GUID for NetBSD

Fixes: https://github.com/util-linux/util-linux/issues/1580
Signed-off-by: Karel Zak <kzak@redhat.com>
2 years agoloopdev: Do not treat errors when detecting overlap as fatal
Jan Kara [Thu, 20 Jan 2022 12:16:39 +0000 (13:16 +0100)] 
loopdev: Do not treat errors when detecting overlap as fatal

When looking for overlapping loop device we can fail getting some loop
device properties when we race with device autoclear. Just squelsh these
errors and try next loop device.

Signed-off-by: Jan Kara <jack@suse.cz>
2 years agoloopdev: Properly translate errors from ul_path_read_*()
Jan Kara [Thu, 20 Jan 2022 12:16:38 +0000 (13:16 +0100)] 
loopdev: Properly translate errors from ul_path_read_*()

A few callsites do not translate error from ul_path_read_*() and just
treat it as error code leading to confusing EPERM errors.

Signed-off-by: Jan Kara <jack@suse.cz>
2 years agomount: Fix race in loop device reuse code
Jan Kara [Thu, 20 Jan 2022 11:47:05 +0000 (12:47 +0100)] 
mount: Fix race in loop device reuse code

Small timing changes in the kernel loop device handling broke the
following loop:

while :; do mount -o loop,ro isofs.iso isofs/; umount isofs/; done

which quickly reports:
mount: /mnt: can't read superblock on /dev/loop0.
umount: /mnt: not mounted.

And this loop is broken because of a subtle interaction with
systemd-udevd that also opens the loop device. The race seems to be in
mount(8) handling itself and the altered kernel timing makes it happen.
It look like:

bash                                systemd-udevd
  mount -o loop,ro isofs.iso isofs/
    /dev/loop0 is created and bound to isofs.iso, autoclear is set for
    loop0
                                    opens /dev/loop0
  umount isofs/
  loop0 still lives because systemd-udev still has device open
  mount -o loop,ro isofs.iso isofs/
    gets to mnt_context_setup_loopdev()
      loopcxt_find_overlap()
      sees loop0 is still valid and with proper parameters
      reuse = true;
                                    close /dev/loop0
                                      last fd closed => loop0 is
                                        cleaned up
      loopcxt_get_fd()
        opens loop0 but it is no longer the device we wanted!
    calls mount(2) which fails because we cannot read from the loop device

Fix the problem by rechecking that loop device is still attached after
opening the device. This makes sure the kernel will not autoclear the
device anymore.

Signed-off-by: Jan Kara <jack@suse.cz>
2 years agoscript: add separator to header, update tests
Karel Zak [Tue, 25 Jan 2022 15:31:02 +0000 (16:31 +0100)] 
script: add separator to header, update tests

* add separator before "<not executed on terminal>"
* update test (due to 4d8edee5eeb3ea5457eeff321bca7dd64108eb8f)

Signed-off-by: Karel Zak <kzak@redhat.com>
2 years agoscript: don't use \n when we log COMMAND
Karel Zak [Tue, 25 Jan 2022 15:18:31 +0000 (16:18 +0100)] 
script: don't use \n when we log COMMAND

The timing file format as well as typescript header do not expect line
breaks. Replaces it white-space.

Signed-off-by: Karel Zak <kzak@redhat.com>
2 years agoscript: add COMMAND= to log header
Karel Zak [Tue, 25 Jan 2022 15:05:46 +0000 (16:05 +0100)] 
script: add COMMAND= to log header

Fixes: https://github.com/util-linux/util-linux/pull/1566
Co-Author: Henrik Bach <bach.henrik@gmail.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
2 years agouuidd: Whitelist libuuid clock file
Stanislav Brabec [Tue, 25 Jan 2022 10:50:21 +0000 (11:50 +0100)] 
uuidd: Whitelist libuuid clock file

Return back ProtectSystem to strict, and enable access to
/var/lib/libuuid only.

Note: As LIBUUID_CLOCK_FILE does not use @localstatedir@, we use
/var here as well.

Signed-off-by: Ali Abdallah <ali.abdallah@suse.com>
Signed-off-by: Stanislav Brabec <sbrabec@suse.cz>
Signed-off-by: Karel Zak <kzak@redhat.com>
2 years agobuild-sys: generate all man pages for distribution tarball
Karel Zak [Tue, 25 Jan 2022 10:04:13 +0000 (11:04 +0100)] 
build-sys: generate all man pages for distribution tarball

Now "make dist" and "make distcheck" follows autoconf. It means that
disabled tools or tools that cannot compile are ignored, and man-pages
for these tools are not generated. This is a problem for people
without asciidoctor (adoc -> man generator).

Fixes: https://github.com/util-linux/util-linux/issues/1577
Signed-off-by: Karel Zak <kzak@redhat.com>
2 years agodocs: add man-common/in-bytes.adoc
Karel Zak [Mon, 24 Jan 2022 14:38:43 +0000 (15:38 +0100)] 
docs: add man-common/in-bytes.adoc

This commit unifies and improves --bytes option.

Fixes: https://github.com/util-linux/util-linux/issues/1572
Signed-off-by: Karel Zak <kzak@redhat.com>
2 years agouuidd: fix open/lock state issue
Karel Zak [Mon, 24 Jan 2022 13:08:08 +0000 (14:08 +0100)] 
uuidd: fix open/lock state issue

* warn on open/lock state issue
* remove ProtectSystem=strict from systemd service setting, because it
  makes clock state file read-only

  openat(AT_FDCWD, "/var/lib/libuuid/clock.txt",
     O_RDWR|O_CREAT|O_CLOEXEC, 0660) = -1 EROFS (Read-only file system)

Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=2040366
Signed-off-by: Karel Zak <kzak@redhat.com>
2 years agolibmount: fix UID check for FUSE umount [CVE-2021-3995]
Karel Zak [Wed, 24 Nov 2021 12:53:25 +0000 (13:53 +0100)] 
libmount: fix UID check for FUSE umount [CVE-2021-3995]

Improper UID check allows an unprivileged user to unmount FUSE
filesystems of users with similar UID.

Signed-off-by: Karel Zak <kzak@redhat.com>
2 years agolibblkid: optimize ioctl calls in blkid_probe_set_device()
Karel Zak [Fri, 21 Jan 2022 13:49:47 +0000 (14:49 +0100)] 
libblkid: optimize ioctl calls in blkid_probe_set_device()

* call FDGETFDCSTAT only for block devices
* don't check floppies for device-mapper, CD-ROM features or zones

Signed-off-by: Karel Zak <kzak@redhat.com>
2 years agofindmnt: (verify) support fstype patterns
Karel Zak [Fri, 21 Jan 2022 11:57:29 +0000 (12:57 +0100)] 
findmnt: (verify) support fstype patterns

mount(8) supports fstype patterns/lists (like "udf,iso9660") in fstab.
Let's support the same by --verify.

Signed-off-by: Karel Zak <kzak@redhat.com>
2 years agofindmnt: add reason to "cannot detect on-disk filesystem type" warning
Karel Zak [Fri, 21 Jan 2022 11:24:43 +0000 (12:24 +0100)] 
findmnt: add reason to "cannot detect on-disk filesystem type" warning

References: https://unix.stackexchange.com/questions/563688/findmnt-verify-gives-warning-cannot-detect-on-disk-filesystem-type
Signed-off-by: Karel Zak <kzak@redhat.com>
2 years agofindmnt: (verify) ignore passno for btrfs
Karel Zak [Fri, 21 Jan 2022 11:10:44 +0000 (12:10 +0100)] 
findmnt: (verify) ignore passno for btrfs

 "Traditional filesystems need to run their respective fsck utility in case
 the filesystem was not unmounted cleanly and the log needs to be replayed
 before mount. This is not needed for btrfs. You should set fs_passno to 0."

 https://btrfs.wiki.kernel.org/index.php/FAQ#When_will_Btrfs_have_a_fsck_like_tool.3F"

Fixes: https://github.com/util-linux/util-linux/issues/1575
Signed-off-by: Karel Zak <kzak@redhat.com>
2 years agoMerge branch 'mkswap-pagesize' of https://github.com/jwilk-forks/util-linux
Karel Zak [Fri, 21 Jan 2022 10:24:27 +0000 (11:24 +0100)] 
Merge branch 'mkswap-pagesize' of https://github.com/jwilk-forks/util-linux

* 'mkswap-pagesize' of https://github.com/jwilk-forks/util-linux:
  mkswap: (adoc) suggest looking up page size portably

2 years agoMerge branch 'mount-spelling' of https://github.com/jwilk-forks/util-linux
Karel Zak [Fri, 21 Jan 2022 10:23:35 +0000 (11:23 +0100)] 
Merge branch 'mount-spelling' of https://github.com/jwilk-forks/util-linux

* 'mount-spelling' of https://github.com/jwilk-forks/util-linux:
  mount: (adoc) fix comma splice

2 years agolibblkid: reset errno after failed floppy test
Karel Zak [Fri, 21 Jan 2022 10:21:48 +0000 (11:21 +0100)] 
libblkid: reset errno after failed floppy test

Signed-off-by: Karel Zak <kzak@redhat.com>
2 years agomkswap: (adoc) suggest looking up page size portably
Jakub Wilk [Thu, 20 Jan 2022 18:16:09 +0000 (19:16 +0100)] 
mkswap: (adoc) suggest looking up page size portably

Signed-off-by: Jakub Wilk <jwilk@jwilk.net>
2 years agomount: (adoc) fix comma splice
Jakub Wilk [Thu, 20 Jan 2022 18:00:16 +0000 (19:00 +0100)] 
mount: (adoc) fix comma splice

Signed-off-by: Jakub Wilk <jwilk@jwilk.net>
2 years agolibblkid: reopen floppy without O_NONBLOCK
Karel Zak [Mon, 17 Jan 2022 11:37:13 +0000 (12:37 +0100)] 
libblkid: reopen floppy without O_NONBLOCK

Vladimir Sementsov-Ogievskiy wrote:
> The commit "floppy: reintroduce O_NDELAY fix" was removed from kernel,
> so we faced the bug described and discussed here:
> https://bugzilla.suse.com/show_bug.cgi?id=3D1181018
>
> Discussion in kernel list on reverting the commit:
> https://www.spinics.net/lists/stable/msg493061.html
>
> In short, I can quote Jiri Kosina's comment:
>
>   opening floppy device node with O_NONBLOCK is asking for all kinds
>   of trouble
>
> So opening floppy with O_NONBLOCK in blkid leads to failure of blkid,
> probable failure of mount and unpleasant error messages in dmesg (see
> also patch 02 for details).

Based on patch from Vladimir.

CC: Jiri Kosina <jkosina@suse.cz>
Reported-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
Reviewed-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
Tested-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
2 years agounshare: fix typo in uint_to_id()
Karel Zak [Tue, 18 Jan 2022 11:46:58 +0000 (12:46 +0100)] 
unshare: fix typo in uint_to_id()

Reported-by: Daniel Gerber <dg@atufi.org>
Signed-off-by: Karel Zak <kzak@redhat.com>
2 years agounshare: Fix doc comments
Sean Anderson [Sat, 15 Jan 2022 16:29:26 +0000 (11:29 -0500)] 
unshare: Fix doc comments

Several doc comments use the wrong terminology, or have mismatches
descriptions. Fix them.

Fixes: ff5dc96eb ("unshare: Add options to map blocks of user/group IDs")
Signed-off-by: Sean Anderson <seanga2@gmail.com>
Reported-by: Daniel Gerber <dg@atufi.org>
2 years agolib/strutils: make sure mem2strcpy() buffer is zeroized
Karel Zak [Tue, 18 Jan 2022 11:30:11 +0000 (12:30 +0100)] 
lib/strutils: make sure mem2strcpy() buffer is zeroized

Let's make the function robust for work with strings and uninitialized
buffers.

Reported-by: Sean Anderson <seanga2@gmail.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
2 years agolscpu: remove unintended change
Karel Zak [Mon, 17 Jan 2022 15:24:21 +0000 (16:24 +0100)] 
lscpu: remove unintended change

Signed-off-by: Karel Zak <kzak@redhat.com>
2 years agotests: update lscpu output
Karel Zak [Mon, 17 Jan 2022 13:10:36 +0000 (14:10 +0100)] 
tests: update lscpu output

References: f592b88d0cd965e20ca1f492cadb3b8c8fd48a40
Signed-off-by: Karel Zak <kzak@redhat.com>
2 years agolibblkid: remove unnecessary ifdef
Karel Zak [Mon, 17 Jan 2022 11:36:11 +0000 (12:36 +0100)] 
libblkid: remove unnecessary ifdef

Signed-off-by: Karel Zak <kzak@redhat.com>
2 years agoMerge branch 'master' of https://github.com/mupuf/util-linux
Karel Zak [Mon, 17 Jan 2022 10:32:58 +0000 (11:32 +0100)] 
Merge branch 'master' of https://github.com/mupuf/util-linux

* 'master' of https://github.com/mupuf/util-linux:
  meson: do not generate fstrim.service if we do not have systemd

2 years agoMerge branch 'more-zero' of https://github.com/stoeckmann/util-linux
Karel Zak [Mon, 17 Jan 2022 10:31:08 +0000 (11:31 +0100)] 
Merge branch 'more-zero' of https://github.com/stoeckmann/util-linux

* 'more-zero' of https://github.com/stoeckmann/util-linux:
  more: improve zero size handling

2 years agomore: improve zero size handling
Tobias Stoeckmann [Sun, 16 Jan 2022 21:14:23 +0000 (22:14 +0100)] 
more: improve zero size handling

Sami Kerola pointed out that /proc contains files with zero size but
content in ec4153cc28c718e064a1992a76a63ec7696d33a6.

Eventually fixes for better type handling have been committed with
ba105bb5eb0052ee7d85d0903ad4ae9e87114930 and error handling when "more"
is called with directories in 32a4efc5675ca238d382a0027f7f4723b8b3af28.

This commit fixes a regression and wrong file size handling:

checkf ends execution prematurely if st.st_size is 0. The idea was to
skip the check_magic call which would otherwise claim that a text file
would not be one, e.g. /proc/self/wchan would fail otherwise. This has
two consequences:

1. The last check in checkf is never true, because if st_size is 0 we
   already left the function (file_size and st_size are both off_t).

Proof of Concept (use a window with less lines than /proc/cpuinfo):

$ echo "hello world" > /tmp/more-poc
$ more /tmp/more-poc /proc/cpuinfo
- Press space to switch to next file
- You see >100% in status line

2. Leaving early does not set the close on exit flag for empty files.

3. Since the last line is never reached, ~(off_t)0 is never set, which
   implies that the check in display_file is never true.

The st.st_size = 0 case is supposed to be special. Simplify this
regression fix by considering ctl->file_size = 0 to be special. This
eleminates the ~(off_t)0 magic, which would be -1.

Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
2 years agomeson: do not generate fstrim.service if we do not have systemd
Martin Roukala (né Peres) [Sun, 16 Jan 2022 11:25:35 +0000 (13:25 +0200)] 
meson: do not generate fstrim.service if we do not have systemd

When systemd is disabled, the variable `systemdsystemunitdir` is
missing, and thus we cannot install fstrim.service to it.

This commit simply disables installing this service if systemd is not
found or disabled.

Signed-off-by: Martin Roukala (né Peres) <martin.roukala@mupuf.org>
2 years agolspcu: Print dummy modelname if none present
Thomas Weißschuh [Sat, 15 Jan 2022 08:54:08 +0000 (09:54 +0100)] 
lspcu: Print dummy modelname if none present

The logic in print_summary_cputype() starts a new hierarchy level under
the CPUs "Model name" entry. If the model is unknown the hierarchy level
will be skipped. This is visually confusing in the human-readable
version and changes the schema of the JSON tree.

2 years agolsblk: sort usage() output
Karel Zak [Wed, 12 Jan 2022 15:08:08 +0000 (16:08 +0100)] 
lsblk: sort usage() output

Signed-off-by: Karel Zak <kzak@redhat.com>
2 years agolsblk: add --noempty
Karel Zak [Wed, 12 Jan 2022 15:06:59 +0000 (16:06 +0100)] 
lsblk: add --noempty

Signed-off-by: Karel Zak <kzak@redhat.com>
2 years agodocs: add link to GitHub TODO items
Karel Zak [Wed, 12 Jan 2022 14:24:59 +0000 (15:24 +0100)] 
docs: add link to GitHub TODO items

Signed-off-by: Karel Zak <kzak@redhat.com>
2 years agobuild-sys: improve setns, unshare and prlimit checks
Karel Zak [Wed, 12 Jan 2022 14:01:46 +0000 (15:01 +0100)] 
build-sys: improve setns, unshare and prlimit checks

Addresses: https://github.com/util-linux/util-linux/issues/1526
Signed-off-by: Karel Zak <kzak@redhat.com>
2 years agoMerge branch 'master' of https://github.com/anya-evergreen/util-linux
Karel Zak [Tue, 11 Jan 2022 13:17:03 +0000 (14:17 +0100)] 
Merge branch 'master' of https://github.com/anya-evergreen/util-linux

* 'master' of https://github.com/anya-evergreen/util-linux:
  Return immediately when quit is seen

2 years agoMerge branch 'sys-utils-unshare-pdeathsig-race' of https://github.com/earlchew/util...
Karel Zak [Tue, 11 Jan 2022 12:55:30 +0000 (13:55 +0100)] 
Merge branch 'sys-utils-unshare-pdeathsig-race' of https://github.com/earlchew/util-linux

* 'sys-utils-unshare-pdeathsig-race' of https://github.com/earlchew/util-linux:
  unshare: Fix PDEATHSIG race for --kill-child

2 years agoMerge branch 'sys-utils-unshare-fork-signal-handling' of https://github.com/earlchew...
Karel Zak [Tue, 11 Jan 2022 12:55:20 +0000 (13:55 +0100)] 
Merge branch 'sys-utils-unshare-fork-signal-handling' of https://github.com/earlchew/util-linux

* 'sys-utils-unshare-fork-signal-handling' of https://github.com/earlchew/util-linux:
  unshare: Propagate inherited signal handling to forked child

2 years agoblkid: don't print all devices if only garbage specified
Karel Zak [Mon, 10 Jan 2022 15:32:44 +0000 (16:32 +0100)] 
blkid: don't print all devices if only garbage specified

There is small regression. The old version (before
64cfe6ac37631a6347bd4005c72dd2d37e737f5e) returns nothing when

  # blkid /dontexist

specified on command line.

Signed-off-by: Karel Zak <kzak@redhat.com>
2 years agounshare: Propagate inherited signal handling to forked child
Earl Chew [Sun, 9 Jan 2022 22:01:21 +0000 (14:01 -0800)] 
unshare: Propagate inherited signal handling to forked child

In #1086, signal(3) is used along with SIG_IGN,
and SIG_DFL, to prevent premature termination of
the parent. The present approach causes the
forked child to have different inherited
signal handling behaviour than original
behaviour inherited by the parent.

$ /usr/bin/unshare cat /proc/self/status | grep Sig
SigQ:   0/15523
SigPnd: 0000000000000000
SigBlk: 0000000000000000
SigIgn: 0000000000000000
SigCgt: 0000000000000000

$ /usr/bin/unshare --fork cat /proc/self/status | grep Sig
SigQ:   0/15523
SigPnd: 0000000000000000
SigBlk: 0000000000000000
SigIgn: 0000000000004002
SigCgt: 0000000000000000

As a consequence, if the command is killed, the
outcome is different if --fork is used:

$ /usr/bin/unshare sh -c 'kill $$' ; echo $?
Terminated
143

$ /usr/bin/unshare --fork sh -c 'kill $$' ; echo $?
0

Instead use sigprocmask(2) to ensure that signal
handling behaviour is propagated from the grandparent
to the forked child.

Signed-off-by: Earl Chew <earl_chew@yahoo.com>
2 years agounshare: Fix PDEATHSIG race for --kill-child
Earl Chew [Sat, 1 Jan 2022 22:44:47 +0000 (14:44 -0800)] 
unshare: Fix PDEATHSIG race for --kill-child

Kill the child explicitly should the parent terminate
just before the child invokes prctl(PR_SET_PDEATHSIG).

The underlying issue can be reproduced as follows:

  #!/bin/bash

  rm -f /tmp/unshare.log.*
  strace -ff -tt -o /tmp/unshare.log /usr/bin/unshare --kill-child --fork true
  head -1 /tmp/unshare.log.*

  while : ; do
    PARENT=$(
      /usr/bin/unshare --kill-child --fork bash -c 'echo $PPID' &
      sleep 0 # sleep 0.00$RANDOM
      kill -9 $! 2>/dev/null
    )
    [ "$PARENT" != 1 ] || { echo "$PARENT" ; break ; }
  done

Signed-off-by: Earl Chew <earl_chew@yahoo.com>
2 years agolibfdisk: (gpt) provide last LBA where is partitions array
Karel Zak [Fri, 7 Jan 2022 13:05:36 +0000 (14:05 +0100)] 
libfdisk: (gpt) provide last LBA where is partitions array

Addresses: https://github.com/util-linux/util-linux/issues/1554
Signed-off-by: Karel Zak <kzak@redhat.com>
2 years agosulogin: fix compiler warning [-Werror=implicit-fallthrough=]
Karel Zak [Fri, 7 Jan 2022 12:49:40 +0000 (13:49 +0100)] 
sulogin: fix compiler warning [-Werror=implicit-fallthrough=]

and make sure errno is reset before read()

Signed-off-by: Karel Zak <kzak@redhat.com>
2 years agoMerge branch 'syslog-su-pid' of https://github.com/thesamesam/util-linux
Karel Zak [Fri, 7 Jan 2022 12:47:58 +0000 (13:47 +0100)] 
Merge branch 'syslog-su-pid' of https://github.com/thesamesam/util-linux

* 'syslog-su-pid' of https://github.com/thesamesam/util-linux:
  su: use LOG_PID for syslog

2 years agosulogin: Display all kinds of errno during password input.
Shigeki Morishima [Wed, 21 Jul 2021 02:04:32 +0000 (11:04 +0900)] 
sulogin: Display all kinds of errno during password input.

If some error happens during password input, all kinds of errno will be
displayed for investigation of the problem.

Signed-off-by: Shigeki Morishima <s.morishima@fujitsu.com>
2 years agosu: use LOG_PID for syslog
Sam James [Fri, 7 Jan 2022 01:54:41 +0000 (01:54 +0000)] 
su: use LOG_PID for syslog

Enable PID in syslog lines for `su`.

In Gentoo Linux, we recently switched `su` providers from
shadow to util-linux.

It was notiiced that syslog output differs slightly
with util-linux (no PID):
```
Jan  7 20:00:50 localhost su: (to root) root on pts/5
Jan  7 20:00:50 localhost su: pam_unix(su:session): session opened for user root(uid=0) by sam(uid=0)
```
... whereas shadow's `su` gave (with PID):
```
Jan  7 20:52:50 localhost su[22245]: Successful su for root by root
Jan  7 20:52:50 localhost su[22245]: + /dev/pts/5 root:root
```

This change enables PID logging to give shadow-like syslog
output for `su`:
```
Jan  7 20:54:32 localhost su[10827]: (to root) root on pts/6
Jan  7 20:54:32 localhost su[10827]: pam_unix(su:session): session opened for user root(uid=0) by sam(uid=0)
```

Signed-off-by: Sam James <sam@gentoo.org>
2 years agolibfdisk: (gpt) make fdisk -x output more readable
Karel Zak [Thu, 6 Jan 2022 13:52:50 +0000 (14:52 +0100)] 
libfdisk: (gpt) make fdisk -x output more readable

The field "First LBA" is confusing; let's use "First usable LBA" as
it's the official UEFI name for the field.

Addresses: https://github.com/util-linux/util-linux/issues/1554
Signed-off-by: Karel Zak <kzak@redhat.com>
2 years agoagetty: resolve tty name even if stdin is specified
tamz [Thu, 6 Jan 2022 10:56:58 +0000 (11:56 +0100)] 
agetty: resolve tty name even if stdin is specified

[kzak@redhat.com: - use "const" for options->tty (and friends)
                    as expected by get_terminal_name()]

Addresses: https://github.com/util-linux/util-linux/issues/1546
Signed-off-by: tamz <totemz@protonmail.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
2 years agolosetup: Add missing pipe to man example for setting up loop device
Vojtech Trefny [Thu, 6 Jan 2022 08:11:27 +0000 (09:11 +0100)] 
losetup: Add missing pipe to man example for setting up loop device

"-f" and "loopdev" cannot be used together, the pipe was lost
when converting the man pages to asciidoc.

Signed-off-by: Vojtech Trefny <vtrefny@redhat.com>
2 years agolibsmartcols: fix lines groups for multi-line cells
Karel Zak [Wed, 5 Jan 2022 10:15:36 +0000 (11:15 +0100)] 
libsmartcols: fix lines groups for multi-line cells

Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=2031303
Signed-off-by: Karel Zak <kzak@redhat.com>
2 years agolibsmartcols: add multi-line cells to samples
Karel Zak [Wed, 5 Jan 2022 10:04:05 +0000 (11:04 +0100)] 
libsmartcols: add multi-line cells to samples

Signed-off-by: Karel Zak <kzak@redhat.com>
2 years agomeson: fix bash_completion.get_variable() use
Karel Zak [Tue, 4 Jan 2022 11:57:52 +0000 (12:57 +0100)] 
meson: fix bash_completion.get_variable() use

Addresses: https://github.com/util-linux/util-linux/pull/1549
Signed-off-by: Karel Zak <kzak@redhat.com>
2 years agotests: update mountinfo files
Karel Zak [Tue, 4 Jan 2022 11:55:25 +0000 (12:55 +0100)] 
tests: update mountinfo files

References: 166e87368ae88bf31112a30e078cceae637f4cdb
Signed-off-by: Karel Zak <kzak@redhat.com>
2 years agomeson: keep bash-completion symlinks in variable
Karel Zak [Tue, 4 Jan 2022 11:17:41 +0000 (12:17 +0100)] 
meson: keep bash-completion symlinks in variable

This is small consolidation, let's call meson_make_symlink from one
place in loop.

Addresses: https://github.com/util-linux/util-linux/pull/1549
Signed-off-by: Karel Zak <kzak@redhat.com>
2 years agobuild-sys: install lastb bash-completion
Karel Zak [Tue, 4 Jan 2022 11:05:58 +0000 (12:05 +0100)] 
build-sys: install lastb bash-completion

Signed-off-by: Karel Zak <kzak@redhat.com>
2 years agolibmount: remove support for deleted mount table entries
Karel Zak [Tue, 4 Jan 2022 09:37:55 +0000 (10:37 +0100)] 
libmount: remove support for deleted mount table entries

The "(deleted)" suffix has been originally used by kernel for deleted
mountpoints. Since kernel commit 9d4d65748a5ca26ea8650e50ba521295549bf4e3
(Dec 2014) kernel does not use this suffix for mount stuff in /proc at
all. Let's remove this support from libmount too.

Signed-off-by: Karel Zak <kzak@redhat.com>
2 years agomount: (man) fix example
Karel Zak [Mon, 3 Jan 2022 12:23:54 +0000 (13:23 +0100)] 
mount: (man) fix example

Fixes: https://github.com/util-linux/util-linux/issues/1539
Signed-off-by: Karel Zak <kzak@redhat.com>
2 years agoMerge branch 'patch-3' of https://github.com/mariobl/util-linux
Karel Zak [Mon, 3 Jan 2022 12:19:25 +0000 (13:19 +0100)] 
Merge branch 'patch-3' of https://github.com/mariobl/util-linux

* 'patch-3' of https://github.com/mariobl/util-linux:
  lsfd.1.adoc: Fix markup
  man pages: Fix punctuation, wording and markup

2 years agoMerge branch 'master' of https://github.com/lishengyu/util-linux
Karel Zak [Mon, 3 Jan 2022 12:13:09 +0000 (13:13 +0100)] 
Merge branch 'master' of https://github.com/lishengyu/util-linux

* 'master' of https://github.com/lishengyu/util-linux:
  fdisk: when use fdisk -l, open device in nonblock mode

2 years agoMerge branch 'master' of https://github.com/HeroesLoveToRoujiamo/util-linux
Karel Zak [Mon, 3 Jan 2022 12:12:34 +0000 (13:12 +0100)] 
Merge branch 'master' of https://github.com/HeroesLoveToRoujiamo/util-linux

* 'master' of https://github.com/HeroesLoveToRoujiamo/util-linux:
  fdisk: open device in nonblock mode

2 years agoMerge branch 'meson' of https://github.com/t-8ch/util-linux
Karel Zak [Mon, 3 Jan 2022 12:06:47 +0000 (13:06 +0100)] 
Merge branch 'meson' of https://github.com/t-8ch/util-linux

* 'meson' of https://github.com/t-8ch/util-linux:
  meson: only install pkgconfig if library is built
  meson: install manpages and bash completions
  meson: install examples to correct directory
  meson: headers: Install headers
  meson: headers: use util-linux version of version defines

2 years agoMerge branch 'wording' of https://github.com/stoeckmann/util-linux
Karel Zak [Mon, 3 Jan 2022 12:03:40 +0000 (13:03 +0100)] 
Merge branch 'wording' of https://github.com/stoeckmann/util-linux

* 'wording' of https://github.com/stoeckmann/util-linux:
  Fix wording in comments and documentation

2 years agoMerge branch 'fix_in_man-page' of https://github.com/losh/util-linux
Karel Zak [Mon, 3 Jan 2022 12:03:06 +0000 (13:03 +0100)] 
Merge branch 'fix_in_man-page' of https://github.com/losh/util-linux

* 'fix_in_man-page' of https://github.com/losh/util-linux:
  Fix difference between short description and longer description by adding prefix

2 years agoMerge branch 'remove-duplicate' of https://github.com/surdina/util-linux
Karel Zak [Mon, 3 Jan 2022 12:01:30 +0000 (13:01 +0100)] 
Merge branch 'remove-duplicate' of https://github.com/surdina/util-linux

* 'remove-duplicate' of https://github.com/surdina/util-linux:
  Remove duplicate 'setlocale' call

2 years agoMerge branch 'typo_blkid_manpage' of https://github.com/sevenmaster/util-linux
Karel Zak [Mon, 3 Jan 2022 11:55:29 +0000 (12:55 +0100)] 
Merge branch 'typo_blkid_manpage' of https://github.com/sevenmaster/util-linux

* 'typo_blkid_manpage' of https://github.com/sevenmaster/util-linux:
  Fixed minor typo in blkid manpage

2 years agomeson: only install pkgconfig if library is built
Thomas Weißschuh [Thu, 30 Dec 2021 21:57:24 +0000 (22:57 +0100)] 
meson: only install pkgconfig if library is built

2 years agomeson: install manpages and bash completions
Thomas Weißschuh [Thu, 30 Dec 2021 15:35:03 +0000 (16:35 +0100)] 
meson: install manpages and bash completions

Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
2 years agomeson: install examples to correct directory
Thomas Weißschuh [Thu, 30 Dec 2021 15:33:33 +0000 (16:33 +0100)] 
meson: install examples to correct directory

Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
2 years agomeson: headers: Install headers
Thomas Weißschuh [Thu, 30 Dec 2021 15:31:10 +0000 (16:31 +0100)] 
meson: headers: Install headers

Fixes #1365

Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
2 years agomeson: headers: use util-linux version of version defines
Thomas Weißschuh [Thu, 30 Dec 2021 15:30:14 +0000 (16:30 +0100)] 
meson: headers: use util-linux version of version defines

This matches what autotools is doing.

Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
2 years agoFix wording in comments and documentation
Tobias Stoeckmann [Thu, 30 Dec 2021 12:49:47 +0000 (13:49 +0100)] 
Fix wording in comments and documentation

No functional change involved.

Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
2 years agofdisk: when use fdisk -l, open device in nonblock mode
lishengyu [Thu, 30 Dec 2021 12:07:34 +0000 (20:07 +0800)] 
fdisk: when use fdisk -l, open device in nonblock mode

When autoclose is set (kernel default) opening a CD-rom
device causes the tray to close.

Signed-off-by: lishengyu <lishengyu@uniontech.com>
2 years agoRemove duplicate 'setlocale' call
Alexandra Surdina [Mon, 27 Dec 2021 17:18:23 +0000 (18:18 +0100)] 
Remove duplicate 'setlocale' call

Co-authored by: khaleesi <contact@khaleesicodes.com>
Co-authored by: stoeckmann <tobias@stoeckmann.org>

2 years agoFix difference between short description and longer description by adding prefix
LoSh [Mon, 27 Dec 2021 16:03:14 +0000 (17:03 +0100)] 
Fix difference between short description and longer description by adding prefix

2 years agoFixed minor typo in blkid manpage
95p [Mon, 27 Dec 2021 16:03:18 +0000 (17:03 +0100)] 
Fixed minor typo in blkid manpage