]> git.ipfire.org Git - thirdparty/util-linux.git/log
thirdparty/util-linux.git
3 years agohardlink: cleanup man page
Karel Zak [Fri, 5 Feb 2021 10:42:44 +0000 (11:42 +0100)] 
hardlink: cleanup man page

Signed-off-by: Karel Zak <kzak@redhat.com>
3 years agohardlink: s/DEBUG/VERBOSE/
Karel Zak [Fri, 5 Feb 2021 10:13:13 +0000 (11:13 +0100)] 
hardlink: s/DEBUG/VERBOSE/

We usually use "debug" for very detailed information. For end-user
information is better to talk about "verbose" output.

Signed-off-by: Karel Zak <kzak@redhat.com>
3 years agohardlink: translate verbose messages
Karel Zak [Fri, 5 Feb 2021 10:09:50 +0000 (11:09 +0100)] 
hardlink: translate verbose messages

Signed-off-by: Karel Zak <kzak@redhat.com>
3 years agohardlink: cleanup summary
Karel Zak [Fri, 5 Feb 2021 10:06:48 +0000 (11:06 +0100)] 
hardlink: cleanup summary

Signed-off-by: Karel Zak <kzak@redhat.com>
3 years agohardlink: use size_to_human_string()
Karel Zak [Fri, 5 Feb 2021 09:58:29 +0000 (10:58 +0100)] 
hardlink: use size_to_human_string()

Signed-off-by: Karel Zak <kzak@redhat.com>
3 years agohardlink: use only err.h to print errors and warnings
Karel Zak [Thu, 4 Feb 2021 12:56:45 +0000 (13:56 +0100)] 
hardlink: use only err.h to print errors and warnings

Signed-off-by: Karel Zak <kzak@redhat.com>
3 years agohardlink: use monotonic time like other utils
Karel Zak [Thu, 4 Feb 2021 12:43:05 +0000 (13:43 +0100)] 
hardlink: use monotonic time like other utils

- use out gettime_monotonic()
- use timeval for calculation rather than double

Signed-off-by: Karel Zak <kzak@redhat.com>
3 years agohardlink: use errx() when parse options
Karel Zak [Thu, 4 Feb 2021 12:23:32 +0000 (13:23 +0100)] 
hardlink: use errx() when parse options

Don't waste time with some cleanup on --exclude and --include regex
errors.

Signed-off-by: Karel Zak <kzak@redhat.com>
3 years agohardlink: use err() if possible
Karel Zak [Thu, 4 Feb 2021 12:14:51 +0000 (13:14 +0100)] 
hardlink: use err() if possible

Signed-off-by: Karel Zak <kzak@redhat.com>
3 years agohardlink: cleanup --minimum-size stuff
Karel Zak [Thu, 4 Feb 2021 12:06:56 +0000 (13:06 +0100)] 
hardlink: cleanup --minimum-size stuff

* use uintmax_t
* use strtosize_or_err()
* add info about suffixes to man page

Signed-off-by: Karel Zak <kzak@redhat.com>
3 years agohardlink: move default to options initialization
Karel Zak [Thu, 4 Feb 2021 11:54:45 +0000 (12:54 +0100)] 
hardlink: move default to options initialization

Signed-off-by: Karel Zak <kzak@redhat.com>
3 years agohardlink: cleanup usage()
Karel Zak [Thu, 4 Feb 2021 11:50:10 +0000 (12:50 +0100)] 
hardlink: cleanup usage()

Let's make --help more util-linux compatible.

Signed-off-by: Karel Zak <kzak@redhat.com>
3 years agohardlink: use our xalloc.h
Karel Zak [Thu, 4 Feb 2021 11:19:34 +0000 (12:19 +0100)] 
hardlink: use our xalloc.h

Signed-off-by: Karel Zak <kzak@redhat.com>
3 years agohardlink: check and use sys/xattr.h
Karel Zak [Thu, 4 Feb 2021 11:14:13 +0000 (12:14 +0100)] 
hardlink: check and use sys/xattr.h

Signed-off-by: Karel Zak <kzak@redhat.com>
3 years agohardlink: use PRCE2 posix header file
Karel Zak [Thu, 4 Feb 2021 11:06:53 +0000 (12:06 +0100)] 
hardlink: use PRCE2 posix header file

Signed-off-by: Karel Zak <kzak@redhat.com>
3 years agohardlink: cleanup includes and types
Karel Zak [Thu, 4 Feb 2021 10:12:21 +0000 (11:12 +0100)] 
hardlink: cleanup includes and types

* use config.h like other code on package
* use c.h and remove from code stuff defined in the header file
* remove FALSE/TRUE redefinition

Signed-off-by: Karel Zak <kzak@redhat.com>
3 years agohardlink: replace with code from Debian
Karel Zak [Thu, 4 Feb 2021 09:42:53 +0000 (10:42 +0100)] 
hardlink: replace with code from Debian

The current version used in util-linux is based on original code from
Jakub Jelinek.

The new version is based on Debian implementation from
https://salsa.debian.org/jak/hardlink.  This new version uses nftw()
to walk on directories tree and organize internal data binary tree
(tsearch() and twalk()). This new version provides more features like
--ignore-{mode,owner,time}, --respect-xattrs, --respect-name,
--include, --keep-oldest, --minimize, --maximize, etc.

Note that the new version uses -f for --respect-name, the old version
uses -f to hardlinking across filesystems (very probably rarely unused
feature).

Addresses: https://github.com/karelzak/util-linux/issues/808
Signed-off-by: Karel Zak <kzak@redhat.com>
3 years agoci: trigger CiFuzz for the master branch only
Evgeny Vereshchagin [Mon, 15 Feb 2021 13:25:19 +0000 (13:25 +0000)] 
ci: trigger CiFuzz for the master branch only

CIFuzz and OSS-Fuzz are in sync with the master branch so it would
probably make sense to avoid running it for long-lived branches.

Inspired by https://github.com/karelzak/util-linux/pull/1248#issuecomment-776342252

Signed-off-by: Evgeny Vereshchagin <evvers@ya.ru>
3 years agotests: don't reply on scsi_debug partitions
Karel Zak [Thu, 11 Feb 2021 11:44:44 +0000 (12:44 +0100)] 
tests: don't reply 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 agoMerge branch 'switch_root-check-if-mounted' of https://github.com/Whissi/util-linux
Karel Zak [Wed, 10 Feb 2021 09:52:16 +0000 (10:52 +0100)] 
Merge branch 'switch_root-check-if-mounted' of https://github.com/Whissi/util-linux

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 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 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 agobuild-sys: add --disable-scriptutils
Karel Zak [Mon, 8 Feb 2021 14:01:33 +0000 (15:01 +0100)] 
build-sys: add --disable-scriptutils

This new ./configure option disables script, scriptreplay ans
scriptlive.

Fixes: https://github.com/karelzak/util-linux/issues/1244
Signed-off-by: Karel Zak <kzak@redhat.com>
3 years agolibsmartcols: remove unnecessary code
Karel Zak [Mon, 8 Feb 2021 13:47:38 +0000 (14:47 +0100)] 
libsmartcols: remove unnecessary code

Fixes: https://github.com/karelzak/util-linux/pull/1243
Signed-off-by: Karel Zak <kzak@redhat.com>
3 years agogithub: fix distcheck job
Karel Zak [Fri, 5 Feb 2021 14:21:56 +0000 (15:21 +0100)] 
github: fix distcheck job

Signed-off-by: Karel Zak <kzak@redhat.com>
3 years agogithub: add 'distcheck' workflow job
Karel Zak [Fri, 5 Feb 2021 14:03:49 +0000 (15:03 +0100)] 
github: add 'distcheck' workflow job

Signed-off-by: Karel Zak <kzak@redhat.com>
3 years agoMerge branch 'gh-actions-bionic' of https://github.com/mrc0mmand/util-linux
Karel Zak [Fri, 5 Feb 2021 09:29:26 +0000 (10:29 +0100)] 
Merge branch 'gh-actions-bionic' of https://github.com/mrc0mmand/util-linux

* 'gh-actions-bionic' of https://github.com/mrc0mmand/util-linux:
  ci: run the build test for each pull request
  ci: build both w/ and w/o sanitizers on GH Actions
  ci: code cleanup
  ci: deal with uninstrumented binaries using instrumented libs
  text-utils: correctly detect ASan under clang
  ci: use the correct compiler version
  ci: 'downgrade' Ubuntu version to Bionic

3 years agobuild-sys: fix schedutils/sched_attr.h include
Karel Zak [Fri, 5 Feb 2021 09:23:04 +0000 (10:23 +0100)] 
build-sys: fix schedutils/sched_attr.h include

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 agobuild-sys: cleanup uclampset dependencies
Karel Zak [Tue, 2 Feb 2021 15:32:51 +0000 (16:32 +0100)] 
build-sys: cleanup uclampset dependencies

chrt requires sched_setattr() or sched_setscheduler(), the both is
covered by have_schedsetter variable in ./configure.ac. This variable
is useless for uclampset, because it requires sched_setattr(). Let's
make it more explicit for uclampset.

Signed-off-by: Karel Zak <kzak@redhat.com>
3 years agouclampset: cleanup --hel output
Karel Zak [Tue, 2 Feb 2021 11:40:39 +0000 (12:40 +0100)] 
uclampset: cleanup --hel output

Signed-off-by: Karel Zak <kzak@redhat.com>
3 years agoinclude/pathnames: cleanup /proc/sys/kernel use
Karel Zak [Tue, 2 Feb 2021 11:39:57 +0000 (12:39 +0100)] 
include/pathnames: cleanup /proc/sys/kernel use

Signed-off-by: Karel Zak <kzak@redhat.com>
3 years agoMerge branch 'uclampset-v3' of https://github.com/qais-yousef/util-linux
Karel Zak [Tue, 2 Feb 2021 15:53:50 +0000 (16:53 +0100)] 
Merge branch 'uclampset-v3' of https://github.com/qais-yousef/util-linux

* 'uclampset-v3' of https://github.com/qais-yousef/util-linux:
  uclampset: Plumb in bash-completion
  uclampset: Plump into the build system
  uclampset: Add man page
  Add uclampset schedutil
  Move sched_attr struct and syscall definitions into header file

3 years agouclampset: Plumb in bash-completion
Qais Yousef [Tue, 13 Oct 2020 15:04:14 +0000 (16:04 +0100)] 
uclampset: Plumb in bash-completion

Signed-off-by: Qais Yousef <qais.yousef@arm.com>
3 years agouclampset: Plump into the build system
Qais Yousef [Tue, 13 Oct 2020 15:04:06 +0000 (16:04 +0100)] 
uclampset: Plump into the build system

Signed-off-by: Qais Yousef <qais.yousef@arm.com>
3 years agouclampset: Add man page
Qais Yousef [Tue, 13 Oct 2020 15:03:57 +0000 (16:03 +0100)] 
uclampset: Add man page

Signed-off-by: Qais Yousef <qais.yousef@arm.com>
3 years agoAdd uclampset schedutil
Qais Yousef [Tue, 13 Oct 2020 15:03:44 +0000 (16:03 +0100)] 
Add uclampset schedutil

Utilization clamping is a new kernel feature that got merged in 5.3. It
allows controlling the performance of a process by manipulating the
utilization such that the task appears bigger or smaller than what it
really is.

There's a system-wide control to to restrict what maximum values the
process are allowed to use.

Man page added in a later patch attempts to explain the usage in more
detail.

Signed-off-by: Qais Yousef <qais.yousef@arm.com>
3 years agoagetty: Allow --init-string on a virtual console
Ivan Mironov [Mon, 1 Feb 2021 16:58:27 +0000 (21:58 +0500)] 
agetty: Allow --init-string on a virtual console

This option has valid use cases on virtual consoles. Example:
enabling screen blanking in the same way as `setterm --blank ...`
does.

Signed-off-by: Ivan Mironov <mironov.ivan@gmail.com>
3 years agoeject: cleanup before successful exit
Karel Zak [Mon, 1 Feb 2021 11:21:18 +0000 (12:21 +0100)] 
eject: cleanup before successful exit

Fixes: https://github.com/karelzak/util-linux/issues/1239
Signed-off-by: Karel Zak <kzak@redhat.com>
3 years agoci: run the build test for each pull request
Frantisek Sumsal [Sat, 30 Jan 2021 18:13:16 +0000 (19:13 +0100)] 
ci: run the build test for each pull request

3 years agoci: build both w/ and w/o sanitizers on GH Actions
Frantisek Sumsal [Sat, 30 Jan 2021 17:43:33 +0000 (18:43 +0100)] 
ci: build both w/ and w/o sanitizers on GH Actions

3 years agoci: code cleanup
Frantisek Sumsal [Sat, 30 Jan 2021 17:33:26 +0000 (18:33 +0100)] 
ci: code cleanup

3 years agoci: deal with uninstrumented binaries using instrumented libs
Frantisek Sumsal [Fri, 29 Jan 2021 21:01:02 +0000 (22:01 +0100)] 
ci: deal with uninstrumented binaries using instrumented libs

All `eject` tests were failing under ASan, since they call /bin/mount,
which is uninstrumented, but it picks up the instrumented `libblkid`
library, causing ASan to complain:

gcc:
ASan runtime does not come first in initial library list; you should either link runtime to your application or manually preload it with LD_PRELOAD.
eject: unmount of `/home/runner/work/util-linux/util-linux/tests/output/eject/umount-by-disk-mounted-mnt' failed

clang:
/bin/umount: symbol lookup error: /home/runner/work/util-linux/util-linux/.libs/libblkid.so.1: undefined symbol: __sancov_lowest_stack
eject: unmount of `/home/runner/work/util-linux/util-linux/tests/output/eject/umount-by-disk-mounted-mnt' failed

Subsequently, all tests which require the `scsi_debug` module get skipped,
since it's still in use due to the failed umount:

fdisk: align 512/4K                   ... SKIPPED (cannot remove scsi_debug module (rmmod))
fdisk: align 512/4K +alignment_offset ... SKIPPED (cannot remove scsi_debug module (rmmod))
fdisk: align 512/4K +MD               ... SKIPPED (cannot remove scsi_debug module (rmmod))

In case of gcc this can be easily resolved by setting $LD_PRELOAD to the
respective ASan library. clang makes this a bit more difficult, since it
compiles the ASan library statically, so firstly we need to force dynamic
linking (via -shared-asan), and then add the runtime DSO path to the
linker cache, since it's in a non-standard path.

3 years agotext-utils: correctly detect ASan under clang
Frantisek Sumsal [Sat, 30 Jan 2021 12:12:42 +0000 (13:12 +0100)] 
text-utils: correctly detect ASan under clang

__SANITIZE_ADDRESS__ is not defined when compiling with clang, so cover
both use cases with a special set of macros

3 years agoci: use the correct compiler version
Frantisek Sumsal [Fri, 29 Jan 2021 18:00:56 +0000 (19:00 +0100)] 
ci: use the correct compiler version

3 years agoci: 'downgrade' Ubuntu version to Bionic
Frantisek Sumsal [Fri, 29 Jan 2021 17:13:13 +0000 (18:13 +0100)] 
ci: 'downgrade' Ubuntu version to Bionic

Since the current Ubuntu Focal image in GH Actions is missing the
`kernel-modules-extra` package with the `scsi_debug` module[0], let's
change the distro flag from `ubuntu-20.04` (Focal) to `ubuntu-latest`
(currently Bionic, as Focal is still in the beta phase).

[0] https://github.community/t/missing-scsi-debug-linux-kernel-module-on-gh-actions/157698

3 years agoMove sched_attr struct and syscall definitions into header file
Qais Yousef [Tue, 13 Oct 2020 15:03:35 +0000 (16:03 +0100)] 
Move sched_attr struct and syscall definitions into header file

So that we can re-use them in other files.

Signed-off-by: Qais Yousef <qais.yousef@arm.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 agolib: use ul_prefix for close_all_fds() and mkdir_p()
Karel Zak [Thu, 28 Jan 2021 09:27:21 +0000 (10:27 +0100)] 
lib: use ul_prefix for close_all_fds() and mkdir_p()

The names are too generic and it makes problems in static libraries.

Addresses: https://gitlab.com/cryptsetup/cryptsetup/-/issues/623
Signed-off-by: Karel Zak <kzak@redhat.com>
3 years agogithub: enable ci-build for all basic branches
Karel Zak [Tue, 26 Jan 2021 14:52:41 +0000 (15:52 +0100)] 
github: enable ci-build for all basic branches

Signed-off-by: Karel Zak <kzak@redhat.com>
3 years agodocs: update TODO
Karel Zak [Tue, 26 Jan 2021 14:51:26 +0000 (15:51 +0100)] 
docs: update TODO

Signed-off-by: Karel Zak <kzak@redhat.com>
3 years agotravis: remove old ubuntu
Karel Zak [Tue, 26 Jan 2021 14:23:29 +0000 (15:23 +0100)] 
travis: remove old ubuntu

Ubuntu 12.04 LTS (Precise Pangolin) -- from April 2012 to April 2017.

It's more and more difficult to keep code and tests in all details
compatible with it 4 years dead distro.

Signed-off-by: Karel Zak <kzak@redhat.com>
3 years agogithub: make sure compiler is defined
Karel Zak [Tue, 26 Jan 2021 11:39:22 +0000 (12:39 +0100)] 
github: make sure compiler is defined

Signed-off-by: Karel Zak <kzak@redhat.com>
3 years agogithub: CC fix export
Karel Zak [Tue, 26 Jan 2021 11:09:01 +0000 (12:09 +0100)] 
github: CC fix export

Signed-off-by: Karel Zak <kzak@redhat.com>
3 years agogithub: export CC and CXX
Karel Zak [Tue, 26 Jan 2021 10:56:33 +0000 (11:56 +0100)] 
github: export CC and CXX

Signed-off-by: Karel Zak <kzak@redhat.com>
3 years agotests: skip hwclock/systohc on GH Actions
Karel Zak [Tue, 26 Jan 2021 10:54:38 +0000 (11:54 +0100)] 
tests: skip hwclock/systohc on GH Actions

It seems the delay on GH is too large to get proper result for this
tests. We already ignore it on Travis.

Signed-off-by: Karel Zak <kzak@redhat.com>
3 years agotests: mark ul/basic as KNOWN_FAIL
Karel Zak [Tue, 26 Jan 2021 10:39:10 +0000 (11:39 +0100)] 
tests: mark ul/basic as KNOWN_FAIL

It works locally and on Travis, but fail on Github Actions.

Signed-off-by: Karel Zak <kzak@redhat.com>
3 years agotests: migrate from ext3 to ext2
Karel Zak [Tue, 26 Jan 2021 10:11:14 +0000 (11:11 +0100)] 
tests: migrate from ext3 to ext2

Signed-off-by: Karel Zak <kzak@redhat.com>
3 years agotests: dump more information about CFS and block devices
Karel Zak [Tue, 26 Jan 2021 09:30:01 +0000 (10:30 +0100)] 
tests: dump more information about CFS and block devices

Signed-off-by: Karel Zak <kzak@redhat.com>
3 years agogithub: remove distcheck
Karel Zak [Tue, 26 Jan 2021 08:44:44 +0000 (09:44 +0100)] 
github: remove distcheck

Signed-off-by: Karel Zak <kzak@redhat.com>
3 years agogithub: cleanup cibuild.sh
Karel Zak [Mon, 25 Jan 2021 16:32:17 +0000 (17:32 +0100)] 
github: cleanup cibuild.sh

Signed-off-by: Karel Zak <kzak@redhat.com>
3 years agogithub: fix btrfs package name
Karel Zak [Mon, 25 Jan 2021 16:13:51 +0000 (17:13 +0100)] 
github: fix btrfs package name

Signed-off-by: Karel Zak <kzak@redhat.com>
3 years agogithub: fix cibuild typo
Karel Zak [Mon, 25 Jan 2021 15:57:06 +0000 (16:57 +0100)] 
github: fix cibuild typo

Signed-off-by: Karel Zak <kzak@redhat.com>
3 years agogithub: add build workflow
Karel Zak [Mon, 25 Jan 2021 15:51:51 +0000 (16:51 +0100)] 
github: add build workflow

Signed-off-by: Karel Zak <kzak@redhat.com>
3 years agolibmount: allow --read-only for not-root users
Karel Zak [Mon, 25 Jan 2021 10:11:05 +0000 (11:11 +0100)] 
libmount: allow --read-only for not-root users

The command "mount -r" was supported for non-root users in very old
mount(8) versions. Unfortunately, in this case libmount replaces all
mount options from command line by options from fstab. We need
exception for MS_RDONLY.

Fixes: https://github.com/karelzak/util-linux/issues/1235
Signed-off-by: Karel Zak <kzak@redhat.com>
3 years agotravis: use verbose mode (V=1) for make
Karel Zak [Mon, 25 Jan 2021 08:23:16 +0000 (09:23 +0100)] 
travis: use verbose mode (V=1) for make

Signed-off-by: Karel Zak <kzak@redhat.com>
3 years agobuild-sys: add restrict keyword fallback
Karel Zak [Fri, 22 Jan 2021 12:28:02 +0000 (13:28 +0100)] 
build-sys: add restrict keyword fallback

Signed-off-by: Karel Zak <kzak@redhat.com>
3 years agolibuuid: improve "restrict" keyword use
Karel Zak [Fri, 22 Jan 2021 09:44:01 +0000 (10:44 +0100)] 
libuuid: improve "restrict" keyword use

gcc (Ubuntu/Linaro 4.6.3-1ubuntu5) 4.6.3 on travis-ci returns:

 libuuid/src/unparse.c:42:67: error: ‘restrict’ undeclared here (not in a function)
 libuuid/src/unparse.c: In function ‘uuid_fmt’:

Signed-off-by: Karel Zak <kzak@redhat.com>
3 years agoMerge branch 'fix-vms' of https://github.com/Govelius/util-linux
Karel Zak [Thu, 21 Jan 2021 11:01:19 +0000 (12:01 +0100)] 
Merge branch 'fix-vms' of https://github.com/Govelius/util-linux

3 years agofix compiler warnings
Karel Zak [Thu, 21 Jan 2021 09:26:25 +0000 (10:26 +0100)] 
fix compiler warnings

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 agowipefs: fix compiler warning
Karel Zak [Wed, 20 Jan 2021 08:20:54 +0000 (09:20 +0100)] 
wipefs: fix compiler warning

misc-utils/wipefs.c: In function ‘main’:
misc-utils/wipefs.c:838:3: error: ‘for’ loop initial declarations are only allowed in C99 mode
misc-utils/wipefs.c:838:3: note: use option -std=c99 or -std=gnu99 to compile your code

Signed-off-by: Karel Zak <kzak@redhat.com>
3 years agotests: improve u64 use in ipcs test
Karel Zak [Tue, 19 Jan 2021 15:25:33 +0000 (16:25 +0100)] 
tests: improve u64 use in ipcs test

UINT64_MAX is 18446744073709551615, but 2^64 is 18446744073709551616.
We also need to use kbytes in all calculation in the test than bytes
as ipcs by default do not use bytes anymore.

Signed-off-by: Karel Zak <kzak@redhat.com>
3 years agolsblk: fix filesystem array allocation
Karel Zak [Tue, 19 Jan 2021 13:59:01 +0000 (14:59 +0100)] 
lsblk: fix filesystem array allocation

Signed-off-by: Karel Zak <kzak@redhat.com>
3 years agoipcs: fallback for overflow
Karel Zak [Mon, 18 Jan 2021 15:04:18 +0000 (16:04 +0100)] 
ipcs: fallback for overflow

The previous commit 7a08784ab053d6aa30db990cbec1fd35b34ed00a reduced
number of situation when we need fallback when kbytes calculated for
shmall pages, but there is still possible to see overflows.

This patch add fallback also for kbytes.

Signed-off-by: Karel Zak <kzak@redhat.com>
3 years agotests: set shmmni to 32k
Karel Zak [Mon, 18 Jan 2021 12:22:26 +0000 (13:22 +0100)] 
tests: set shmmni to 32k

Linux kernel since 6730e6580177d13f4612767873cb5a533ad63c61 checks for
limits and kernel ipc/utils.h defines

 #define IPCMNI_SHIFT         15
 #define IPCMNI               (1 << IPCMNI_SHIFT)

it means 32768 (aka shortint max). Let's use it in our tests too to
avoid "Invalid argument" when write to /proc/sys/kernel/shmmni.

Signed-off-by: Karel Zak <kzak@redhat.com>
3 years agoipcs: Avoid shmall overflows
Vasilis Liaskovitis [Fri, 15 Jan 2021 14:00:11 +0000 (15:00 +0100)] 
ipcs: Avoid shmall overflows

Avoid computing the number of bytes in shmall, by only
computing and printing the number of Kbytes. This avoids
some overflows, e.g.

$ echo "4503599627370496" > /proc/sys/kernel/shmall
$ ipcs -l | grep 'max total shared memory'
Before:
max total shared memory (kbytes) = 18014398509481980
After:
max total shared memory (kbytes) = 18014398509481984

$ echo "99993599627370500" > /proc/sys/kernel/shmall
99993599627370500
$ ipcs -l | grep 'max total shared memory'
Before:
max total shared memory (kbytes) = 18014398509481980
After:
max total shared memory (kbytes) = 399974398509482000

v1->v2:
  Print the non-overflow KB value only for IPC_UNIT_KB and
IPC_UNIT_DEFAULT.
  This way --bytes and --human options will still get an expected
output
  (but not avoiding the overflow).

Signed-off-by: Vasilis Liaskovitis <vliaskovitis@suse.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
3 years agofindmnt: add option to list all fs-independent flags
Roberto Bergantinos Corpas [Tue, 12 Jan 2021 10:58:53 +0000 (11:58 +0100)] 
findmnt: add option to list all fs-independent flags

It might be useful for security auditing purposes list all possible
mount flags/options including default set which are normally not listed.

This patch adds "--vfs-all" option to list all fs-independent flags
on VFS-OPTIONS column, as well as libmount funcionality to accomplish
it.

i.e.:

$ findmnt -o VFS-OPTIONS
VFS-OPTIONS
rw,relatime
rw,nosuid,nodev,noexec,relatime
rw,nosuid,nodev,noexec,relatime
ro,nosuid,nodev,noexec
...

$ findmnt --vfs-all -o VFS-OPTIONS
VFS-OPTIONS
rw,exec,suid,dev,async,loud,nomand,atime,noiversion,diratime,relatime,nostrictatime,nolazytime,symfollow
rw,noexec,nosuid,nodev,async,loud,nomand,atime,noiversion,diratime,relatime,nostrictatime,nolazytime,symfollow
rw,noexec,nosuid,nodev,async,loud,nomand,atime,noiversion,diratime,relatime,nostrictatime,nolazytime,symfollow
ro,noexec,nosuid,nodev,async,loud,nomand,atime,noiversion,diratime,norelatime,nostrictatime,nolazytime,symfollow
...

[kzak@redhat.com: - cleanup coding style and comments]

Signed-off-by: Roberto Bergantinos Corpas <rbergant@redhat.com>
Signed-off-by: Karel Zak <kzak@redhat.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/selinux-utils: tiny cleanup
Karel Zak [Wed, 13 Jan 2021 14:04:02 +0000 (15:04 +0100)] 
lib/selinux-utils: tiny cleanup

Signed-off-by: Karel Zak <kzak@redhat.com>
3 years agomkswap: remove deprecated SELinux matchpathcon()
Karel Zak [Wed, 13 Jan 2021 13:58:43 +0000 (14:58 +0100)] 
mkswap: remove deprecated SELinux matchpathcon()

Signed-off-by: Karel Zak <kzak@redhat.com>
3 years agochfs-chfn: remove deprecated selinux_check_passwd_access()
Karel Zak [Wed, 13 Jan 2021 13:25:12 +0000 (14:25 +0100)] 
chfs-chfn: remove deprecated selinux_check_passwd_access()

Signed-off-by: Karel Zak <kzak@redhat.com>
3 years agolib/selinux-utils: cleanup function names
Karel Zak [Wed, 13 Jan 2021 12:33:41 +0000 (13:33 +0100)] 
lib/selinux-utils: cleanup function names

Signed-off-by: Karel Zak <kzak@redhat.com>
3 years agobuild-sys: move selinux_utils.c
Karel Zak [Wed, 13 Jan 2021 12:30:31 +0000 (13:30 +0100)] 
build-sys: move selinux_utils.c

Signed-off-by: Karel Zak <kzak@redhat.com>
3 years agobuild-sys: remove fallback for security_context_t
Karel Zak [Wed, 13 Jan 2021 12:12:19 +0000 (13:12 +0100)] 
build-sys: remove fallback for security_context_t

It seems like overkill to provide this #ifdef. For example coreutils
use "char *" for all selinux contexts (since 2014).

Signed-off-by: Karel Zak <kzak@redhat.com>
3 years agolibblkid: fix comment block
Karel Zak [Wed, 13 Jan 2021 10:00:34 +0000 (11:00 +0100)] 
libblkid: fix comment block

The command block with /** triggers gtkdoc; don't use it for regular
comments.

Signed-off-by: Karel Zak <kzak@redhat.com>
3 years agoMerge branch 'autoconf-2.70' of https://github.com/kerolasa/util-linux
Karel Zak [Tue, 12 Jan 2021 10:53:36 +0000 (11:53 +0100)] 
Merge branch 'autoconf-2.70' of https://github.com/kerolasa/util-linux

* 'autoconf-2.70' of https://github.com/kerolasa/util-linux:
  build-sys: silence non-POSIX variable name warning
  build-sys: update to autoconf 2.70

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 agobuild-sys: silence non-POSIX variable name warning
Sami Kerola [Thu, 24 Dec 2020 20:22:59 +0000 (20:22 +0000)] 
build-sys: silence non-POSIX variable name warning

Easiest way to get rid of the following warning is to ignore the warning.
This might cause people who use non-GNU make to have hard time, but are
there such people compiling this project?

sys-utils/Makemodule.am:226: warning: addprefix sys-utils/,$(SETARCH_LINKS: non-POSIX variable name
sys-utils/Makemodule.am:226: (probably a GNU make extension)

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
3 years agobuild-sys: update to autoconf 2.70
Sami Kerola [Thu, 24 Dec 2020 11:12:14 +0000 (11:12 +0000)] 
build-sys: update to autoconf 2.70

Reference: https://lwn.net/Articles/839395/
Reviewed-by: Chris Hofstaedtler <zeha@debian.org>
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
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 agolsblk: use MOUNTTARGETS in default output
Karel Zak [Mon, 11 Jan 2021 09:46:16 +0000 (10:46 +0100)] 
lsblk: use MOUNTTARGETS in default output

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 agolsblk: use MOUNTPOINTS in --fs
Karel Zak [Fri, 8 Jan 2021 12:45:14 +0000 (13:45 +0100)] 
lsblk: use MOUNTPOINTS in --fs

Signed-off-by: Karel Zak <kzak@redhat.com>
3 years agolsblk: add FSROOTS column
Karel Zak [Fri, 8 Jan 2021 12:33:30 +0000 (13:33 +0100)] 
lsblk: add FSROOTS column

It displays filesystem root attached to system, for example
btrfs with two mounted subvolumes:

$ lsblk -oNAME,SIZE,MOUNTPOINTS,FSROOTS /dev/sdc1
NAME SIZE MOUNTPOINTS FSROOTS
sdc1  50M /mnt/A      /foo
  /mnt/B      /bar

Signed-off-by: Karel Zak <kzak@redhat.com>
3 years agolsblk: print all device mountpoints
Karel Zak [Fri, 8 Jan 2021 12:20:50 +0000 (13:20 +0100)] 
lsblk: print all device mountpoints

* add libmount FS to struct lsblk_device

* add new column MOUNTPOINTS (pl.) with multi-line cells to display
  all mountpoints relevant for the device

* the old MOUNTPOINT is backwardly compatible and it (usually) displays the
  last device mountpoint from /proc/self/mountinfo

For example btrfs with more subvolumes:

 $ lsblk -o+MOUNTPOINTS /dev/sdc1
 NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT MOUNTPOINTS
 sdc1   8:33   0  50M  0 part /mnt/test  /mnt/A
                                         /mnt/test
                                         /mnt/B

Note, in this case MOUNTPOINT displays mount point where is mounted
root of the filesystem.

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