]> git.ipfire.org Git - thirdparty/util-linux.git/log
thirdparty/util-linux.git
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

2 years agoReturn immediately when quit is seen
Anya [Tue, 21 Dec 2021 14:26:28 +0000 (14:26 +0000)] 
Return immediately when quit is seen

When a quit character is seen, immediately return that command, as it is the correct operation to perform in this case.

A bigger fix is needed here, in that we need to have a *queue* of operations to perform, rather than a single one

2 years agolscpu: add additional arm cpu part numbers
Ali Saidi [Fri, 17 Dec 2021 15:34:15 +0000 (09:34 -0600)] 
lscpu: add additional arm cpu part numbers

Add additional cpu part numbers I can find publicaly available

Signed-off-by: Ali Saidi <alisaidi@amazon.com>
2 years agolsfd.1.adoc: Fix markup
Mario Blättermann [Thu, 16 Dec 2021 12:40:40 +0000 (13:40 +0100)] 
lsfd.1.adoc: Fix markup

2 years agofdisk: open device in nonblock mode
changlianzhi [Thu, 16 Dec 2021 02:56:25 +0000 (10:56 +0800)] 
fdisk: open device in nonblock mode

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

Signed-off-by: changlianzhi <changlianzhi@uniontech.com>
2 years agoman pages: Fix punctuation, wording and markup
Mario Blättermann [Wed, 15 Dec 2021 14:03:05 +0000 (15:03 +0100)] 
man pages: Fix punctuation, wording and markup

2 years agosu: Verify default SIGCHLD handling.
Tobias Stoeckmann [Sat, 23 Oct 2021 11:44:23 +0000 (13:44 +0200)] 
su: Verify default SIGCHLD handling.

The SIGCHLD handler could have been ignored by parent process.
Make sure that we have default handling activated.

Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
2 years agofindmnt: (verify) add hint about systemctl daemon-reload
Karel Zak [Mon, 13 Dec 2021 12:34:42 +0000 (13:34 +0100)] 
findmnt: (verify) add hint about systemctl daemon-reload

Let's inform that systemd uses stuff older than fstab.

Signed-off-by: Karel Zak <kzak@redhat.com>
2 years agomount: add hint about systemctl daemon-reload
Karel Zak [Mon, 13 Dec 2021 12:22:56 +0000 (13:22 +0100)] 
mount: add hint about systemctl daemon-reload

This commit implements an extra hint for systemd based distros to
inform users that units currently used by systemd are older than
fstab.  This situation is usually unwanted, and 'systemctl
daemon-reload' is recommended.

The message is printed only on terminal to avoid extra messages in
logs, etc.

Addresses: https://github.com/systemd/systemd/pull/20476
Signed-off-by: Karel Zak <kzak@redhat.com>
2 years agoinclude/c: add cmp_timespec() and cmp_stat_mtime()
Karel Zak [Mon, 13 Dec 2021 12:19:18 +0000 (13:19 +0100)] 
include/c: add cmp_timespec() and cmp_stat_mtime()

It's like timercmp() in libc, but for timespec and for stat.st_mtim
(or stat.st_mtime for old struct stat versions).

Signed-off-by: Karel Zak <kzak@redhat.com>
2 years agobuild-sys: add USE_SYSTEMD
Karel Zak [Mon, 13 Dec 2021 12:13:05 +0000 (13:13 +0100)] 
build-sys: add USE_SYSTEMD

Add info that systemd support is expected for tools where we do not
link with any systemd libs, but we want to support some systemd stuff.

Signed-off-by: Karel Zak <kzak@redhat.com>
2 years agolibblkid: check blkid_get_cache() return value [coverity scan]
Karel Zak [Fri, 10 Dec 2021 15:22:07 +0000 (16:22 +0100)] 
libblkid: check blkid_get_cache() return value [coverity scan]

CID 374488:  Error handling issues  (CHECKED_RETURN)
Calling "blkid_get_cache" without checking return value (as is done elsewhere 4 out of 5 times).

It's probably unnecessary as we check the cache pointer later, but let's
make it more robust for static analyzers.

Signed-off-by: Karel Zak <kzak@redhat.com>
2 years agoMerge branch 'lsfd-blkdev' of https://github.com/masatake/util-linux
Karel Zak [Fri, 10 Dec 2021 14:20:28 +0000 (15:20 +0100)] 
Merge branch 'lsfd-blkdev' of https://github.com/masatake/util-linux

* 'lsfd-blkdev' of https://github.com/masatake/util-linux:
  tests: (lsfd) call ts_skip_nonroot earlier
  lsfd: fix a typo in comment
  lsfd: declare local variables at the beginning of block
  tests: (lsfd) add a case for listing a fd opening a block device
  tests: (lsfd) add a factory for opening a block device to the helper command
  lsfd: use the list of block devices in /proc/devices for decoding SOURCE column
  lsfd: add a helper function for reading bdevs in /prode/devices
  lsfd: move the code for reading /proc/devices to lsfd.c

2 years agolibblkid/src/probe: check for ENOMEDIUM from ioctl(CDROM_LAST_WRITTEN)
Jeremi Piotrowski [Wed, 8 Dec 2021 17:09:53 +0000 (09:09 -0800)] 
libblkid/src/probe: check for ENOMEDIUM from ioctl(CDROM_LAST_WRITTEN)

The CD device on Azure VMs returns CDS_DISC_OK from CDROM_DRIVE_STATUS even
when no disc is present. In that case an ENOMEDIUM from CDROM_LAST_WRITTEN
follows. Catch that and return error to prevent probing which results in
hundreds of "unaligned transfer" warnings in the kernel logbuffer.

Signed-off-by: Jeremi Piotrowski <jpiotrowski@microsoft.com>
2 years agotests: (lsfd) call ts_skip_nonroot earlier
Masatake YAMATO [Wed, 8 Dec 2021 15:33:49 +0000 (00:33 +0900)] 
tests: (lsfd) call ts_skip_nonroot earlier

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
2 years agolsfd: fix a typo in comment
Masatake YAMATO [Wed, 8 Dec 2021 06:11:05 +0000 (15:11 +0900)] 
lsfd: fix a typo in comment

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
2 years agolsfd: declare local variables at the beginning of block
Masatake YAMATO [Wed, 8 Dec 2021 05:55:06 +0000 (14:55 +0900)] 
lsfd: declare local variables at the beginning of block

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
2 years agotests: (lsfd) add a case for listing a fd opening a block device
Masatake YAMATO [Wed, 8 Dec 2021 15:44:50 +0000 (00:44 +0900)] 
tests: (lsfd) add a case for listing a fd opening a block device

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
2 years agotests: (lsfd) add a factory for opening a block device to the helper command
Masatake YAMATO [Wed, 8 Dec 2021 13:30:57 +0000 (22:30 +0900)] 
tests: (lsfd) add a factory for opening a block device to the helper command

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
2 years agofindmnt: add SOURCES column to print all devices with the same tag
Karel Zak [Thu, 9 Dec 2021 12:20:50 +0000 (13:20 +0100)] 
findmnt: add SOURCES column to print all devices with the same tag

It's the same like TARGETS for lsblk (the same device is possible to
mount on more mountpoints). Here in findmnt we support by a new column
SOURCES scenario when more devices (filesystems) use the same tag
(LABEL, UUID, e.g.).

For example:

$ findmnt --fstab -oTARGET,SOURCES --evaluate --json UUID=b45897ca-ffc4-4089-8404-5d6072f5aee1
{
   "filesystems": [
      {
         "target": "/mnt/test",
         "sources": [
             "/dev/sdb1", "/dev/sdc"
         ]
      }
   ]
}

Fixes: https://github.com/util-linux/util-linux/issues/1078
Signed-off-by: Karel Zak <kzak@redhat.com>
2 years agosfdisk add --backup-pt-sectors
Karel Zak [Thu, 9 Dec 2021 11:07:16 +0000 (12:07 +0100)] 
sfdisk add --backup-pt-sectors

The current option --backup is usable only when used with others sfdisk
commands. The new command --backup-pt-sectors create backup and exit.

Signed-off-by: Karel Zak <kzak@redhat.com>
2 years agoisfdisk: improve --backup documentation
Karel Zak [Thu, 9 Dec 2021 09:56:07 +0000 (10:56 +0100)] 
isfdisk: improve --backup documentation

* add reference to backup section
* add note that backup is done always after startup
* remove TODO item about --backup, it seems that back after open is
  only way how we can make it with current libfdisk, because
  fdisk_locate_disklabel() returns current in-memory rather than on-disk
  situation.

Addresses: https://github.com/util-linux/util-linux/issues/850
Signed-off-by: Karel Zak <kzak@redhat.com>
2 years agolslocks: add INODE and MAJ:MIN columns
Karel Zak [Wed, 8 Dec 2021 15:55:03 +0000 (16:55 +0100)] 
lslocks: add INODE and MAJ:MIN columns

This is useful for use-cases (for example shell scripts) where
we cannot filter by PIDs.

Addresses: https://github.com/util-linux/util-linux/issues/1527
Signed-off-by: Karel Zak <kzak@redhat.com>