]> git.ipfire.org Git - thirdparty/util-linux.git/log
thirdparty/util-linux.git
3 years agomeson: don't build po if no gettext
Rosen Penev [Wed, 18 May 2022 00:04:47 +0000 (17:04 -0700)] 
meson: don't build po if no gettext

3 years agoMerge branch 'hardlink-docs' of https://github.com/ferdnyc/util-linux
Karel Zak [Wed, 11 May 2022 08:21:34 +0000 (10:21 +0200)] 
Merge branch 'hardlink-docs' of https://github.com/ferdnyc/util-linux

* 'hardlink-docs' of https://github.com/ferdnyc/util-linux:
  hardlink: Fix man page docs for '-v/--verbose'
  hardlink: Wrap -b to 80 cols, in --help
  hardlink: Move reflink options in manpage
  hardlink: Move -c option in --help
  hardlink: Document '-c' option in manpage

3 years agofix time_t format
Rosen Penev [Tue, 3 May 2022 00:53:07 +0000 (17:53 -0700)] 
fix time_t format

Use musl's define to test for 64-bit time_t.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
3 years agofix various formats
Rosen Penev [Tue, 3 May 2022 00:43:32 +0000 (17:43 -0700)] 
fix various formats

Found with -Wformat.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
3 years agohardlink: Fix man page docs for '-v/--verbose'
FeRD (Frank Dana) [Mon, 9 May 2022 21:17:57 +0000 (17:17 -0400)] 
hardlink: Fix man page docs for '-v/--verbose'

Signed-off-by: FeRD (Frank Dana) <ferdnyc@gmail.com>
3 years agohardlink: Wrap -b to 80 cols, in --help
FeRD (Frank Dana) [Mon, 9 May 2022 21:14:48 +0000 (17:14 -0400)] 
hardlink: Wrap -b to 80 cols, in --help

Signed-off-by: FeRD (Frank Dana) <ferdnyc@gmail.com>
3 years agohardlink: Move reflink options in manpage
FeRD (Frank Dana) [Mon, 9 May 2022 11:32:44 +0000 (07:32 -0400)] 
hardlink: Move reflink options in manpage

The documentation for the --reflink and --skip-reflink options
felt sort of shoe-horned into the rest of the options, in the
man page. Reorder to match where they appear in the --help output.

Signed-off-by: FeRD (Frank Dana) <ferdnyc@gmail.com>
3 years agohardlink: Move -c option in --help
FeRD (Frank Dana) [Mon, 9 May 2022 11:31:13 +0000 (07:31 -0400)] 
hardlink: Move -c option in --help

The new placement mirrors its position in the manpage, and
keeps it grouped with the individual flags for which it
acts as a shorthand.

Signed-off-by: FeRD (Frank Dana) <ferdnyc@gmail.com>
3 years agohardlink: Document '-c' option in manpage
FeRD (Frank Dana) [Mon, 9 May 2022 11:20:26 +0000 (07:20 -0400)] 
hardlink: Document '-c' option in manpage

Signed-off-by: FeRD (Frank Dana) <ferdnyc@gmail.com>
3 years agofstrim: check for ENOSYS when using --quiet-unsupported
Narthorn [Sat, 7 May 2022 05:43:02 +0000 (07:43 +0200)] 
fstrim: check for ENOSYS when using --quiet-unsupported

Some filesystems like bindfs report ENOSYS (Function not implemented)
for the trim ioctl, which should be caught by --quiet-unsupported.

3 years agoMerge branch 'meson-fixups' of https://github.com/eli-schwartz/util-linux
Karel Zak [Thu, 5 May 2022 09:12:23 +0000 (11:12 +0200)] 
Merge branch 'meson-fixups' of https://github.com/eli-schwartz/util-linux

* 'meson-fixups' of https://github.com/eli-schwartz/util-linux:
  meson: fix error in processing version for pc files
  meson: get the project version from the version-gen script

3 years agoMerge branch 'master' of https://github.com/mariobl/util-linux
Karel Zak [Thu, 5 May 2022 09:10:46 +0000 (11:10 +0200)] 
Merge branch 'master' of https://github.com/mariobl/util-linux

* 'master' of https://github.com/mariobl/util-linux:
  Add blkpr.8.adoc to po4a configuration

3 years agoMerge branch 'master' of https://github.com/jlinton/util-linux
Karel Zak [Thu, 5 May 2022 09:09:05 +0000 (11:09 +0200)] 
Merge branch 'master' of https://github.com/jlinton/util-linux

* 'master' of https://github.com/jlinton/util-linux:
  lscpu: Add Snapdragon parts

3 years agomeson: fix error in processing version for pc files
Eli Schwartz [Thu, 5 May 2022 04:16:15 +0000 (00:16 -0400)] 
meson: fix error in processing version for pc files

This awk command was copied verbatim from configure.ac, which included
non-awk syntax because configure.ac cannot contain [ literals.

Rewrite these autoconf quadrigraphs as their actual values, for meson.

Fixes always setting the micro version to "0".

3 years agomeson: get the project version from the version-gen script
Eli Schwartz [Thu, 5 May 2022 03:52:31 +0000 (23:52 -0400)] 
meson: get the project version from the version-gen script

This matches autotools and ensures that the version number is actually
reliable.

3 years agoAdd blkpr.8.adoc to po4a configuration
Mario Blättermann [Wed, 4 May 2022 18:27:24 +0000 (20:27 +0200)] 
Add blkpr.8.adoc to po4a configuration

3 years agolscpu: Add Snapdragon parts
Jeremy Linton [Wed, 4 May 2022 17:30:34 +0000 (12:30 -0500)] 
lscpu: Add Snapdragon parts

QC updated the kernel cputype.h to include the Kyro 4xx and 3xx Silver
part numbers's. Lets sync that commit and naming.

Signed-off-by: Jeremy Linton <jeremy.linton@arm.com>
3 years agolibblkid: merge FS* flags into one FSINFO
Andrey Albershteyn [Mon, 2 May 2022 15:08:33 +0000 (17:08 +0200)] 
libblkid: merge FS* flags into one FSINFO

Put BLOCK_SIZE, FSSIZE and FSLASTBLOCK tags under one FSINFO flag.
These, and probably future ones, are read directly from the
superblock (with minor post-processing). These properties are
combined under one flag to escape adding a flag per superblock
member.

Signed-off-by: Andrey Albershteyn <aalbersh@redhat.com>
3 years agolibmount: fix and improve utab update on MS_MOVE
Karel Zak [Wed, 4 May 2022 10:13:08 +0000 (12:13 +0200)] 
libmount: fix and improve utab update on MS_MOVE

* avoid double '//'

* don't update /fooxxx when /foo update requested (make sure that
  startswith() returns path terminated by '/')

* canonicalize only once the new path -- all in utab/mtab is already
  canonicalized, so after MS_MOVE we need to care about the new path
  only

* use asprintf() rather than strcpy() and strcat(), don't compose a
  new path from prefix and subdir when replace entire path

Addresses: https://github.com/util-linux/util-linux/pull/1660
Signed-off-by: Karel Zak <kzak@redhat.com>
3 years agoMerge branch 'fix-move-with-sub-mounted-trees' of https://github.com/fbuihuu/util...
Karel Zak [Wed, 4 May 2022 09:22:58 +0000 (11:22 +0200)] 
Merge branch 'fix-move-with-sub-mounted-trees' of https://github.com/fbuihuu/util-linux

* 'fix-move-with-sub-mounted-trees' of https://github.com/fbuihuu/util-linux:
  libmount: when moving a mount point, all sub mount entries in utab should also be updated

3 years agomeson: make libcap-ng dependent on setpriv
Rosen Penev [Mon, 2 May 2022 23:18:33 +0000 (16:18 -0700)] 
meson: make libcap-ng dependent on setpriv

Signed-off-by: Rosen Penev <rosenp@gmail.com>
3 years agomeson: get rid of get_pkgconfig_variable
Rosen Penev [Mon, 2 May 2022 23:30:26 +0000 (16:30 -0700)] 
meson: get rid of get_pkgconfig_variable

deprecated in 0.56

Signed-off-by: Rosen Penev <rosenp@gmail.com>
3 years agoMerge branch 'add/fslastblock' of https://github.com/alberand/util-linux
Karel Zak [Mon, 2 May 2022 13:45:30 +0000 (15:45 +0200)] 
Merge branch 'add/fslastblock' of https://github.com/alberand/util-linux

* 'add/fslastblock' of https://github.com/alberand/util-linux:
  blkid: add tests for FSLASTBLOCK tag
  blkid: add image for btrfs testing
  libblkid: add FSLASTBLOCK implementation for xfs, ext and btrfs
  libblkid: add FSLASTBLOCK field interface showing area occupied by fs

3 years agoagetty: fix prompt
Karel Zak [Mon, 2 May 2022 13:40:23 +0000 (15:40 +0200)] 
agetty: fix prompt

Reported-by: Jeff Chua <jeff.chua.linux@gmail.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
3 years agologger: make sure structured data are escaped
Karel Zak [Mon, 2 May 2022 13:30:26 +0000 (15:30 +0200)] 
logger: make sure structured data are escaped

For the option --sd-param all formatting chars (" \ and ]) has to be
escaped by \. This patch also allow escape [ to make it more user
friendly.

For example

$ logger --rfc5424 --sd-id zoo@123 --sd-param 'foo="b\"A\"r"' --no-act --stderr "this is message"
<13>1 2022-05-02T15:35:00.342141+02:00 ws.net.home kzak - - [timeQuality tzKnown="1" isSynced="1" syncAccuracy="45291"][zoo@123 foo="b\"A\"r"] this is message

Reported-by: Ulrich Windl <Ulrich.Windl@rz.uni-regensburg.de>
Signed-off-by: Karel Zak <kzak@redhat.com>
3 years agolib/strutils: add ul_strchr_escaped()
Karel Zak [Mon, 2 May 2022 13:07:42 +0000 (15:07 +0200)] 
lib/strutils: add ul_strchr_escaped()

Like strchr(), but ignores escaped chars.

Signed-off-by: Karel Zak <kzak@redhat.com>
3 years agomore: avoid infinite loop on --squeeze
Karel Zak [Mon, 2 May 2022 10:57:13 +0000 (12:57 +0200)] 
more: avoid infinite loop on --squeeze

The command 'echo | more -s' ends in infinite loop if exit-on-EOF is
disabled (default now). We need to call more_key_command() to ask for
user's reaction.

Fixes: https://github.com/util-linux/util-linux/issues/1669
Signed-off-by: Karel Zak <kzak@redhat.com>
3 years agoMerge branch 'gpt-marvell' of https://github.com/pali/util-linux
Karel Zak [Mon, 2 May 2022 10:28:45 +0000 (12:28 +0200)] 
Merge branch 'gpt-marvell' of https://github.com/pali/util-linux

* 'gpt-marvell' of https://github.com/pali/util-linux:
  libfdisk: (gpt) Add UUID for Marvell Armada 3700 Boot partition

3 years agoMerge branch 'meson' of https://github.com/neheb/util-linux
Karel Zak [Mon, 2 May 2022 10:15:32 +0000 (12:15 +0200)] 
Merge branch 'meson' of https://github.com/neheb/util-linux

* 'meson' of https://github.com/neheb/util-linux:
  meson: make libpam optional
  meson: fix tzname check
  meson: fix isnan check
  meson: add _GNU_SOURCE for sighandler_t
  meson: fix environ search
  meson: fix cpu_set_t test
  meson: don't use run
  meson: fix compilation without systemd

3 years agoblkid: add tests for FSLASTBLOCK tag
Andrey Albershteyn [Wed, 27 Apr 2022 15:33:33 +0000 (17:33 +0200)] 
blkid: add tests for FSLASTBLOCK tag

Signed-off-by: Andrey Albershteyn <aalbersh@redhat.com>
3 years agoblkid: add image for btrfs testing
Andrey Albershteyn [Wed, 27 Apr 2022 15:29:27 +0000 (17:29 +0200)] 
blkid: add image for btrfs testing

The btrfs is one of the popular filesystem which is supported by
blkid. However, the image for 'low-probe' tests was missing. Add
115M BTRFS default image (mkfs.btrfs btrfs.img).

Signed-off-by: Andrey Albershteyn <aalbersh@redhat.com>
3 years agolibblkid: add FSLASTBLOCK implementation for xfs, ext and btrfs
Andrey Albershteyn [Wed, 27 Apr 2022 12:46:33 +0000 (14:46 +0200)] 
libblkid: add FSLASTBLOCK implementation for xfs, ext and btrfs

Implementation of FSLASTBLOCK for most common filesystems. Most of
the fs store total number of reserved blocks in superblock.

Signed-off-by: Andrey Albershteyn <aalbersh@redhat.com>
3 years agoMerge branch 'better-bsd-compat' of https://github.com/bsdimp/util-linux
Karel Zak [Mon, 2 May 2022 10:03:49 +0000 (12:03 +0200)] 
Merge branch 'better-bsd-compat' of https://github.com/bsdimp/util-linux

* 'better-bsd-compat' of https://github.com/bsdimp/util-linux:
  BSD: Use byteswap.h and endian.h defined macos when present

3 years agoMerge branch 'master' of https://github.com/caramelli/util-linux
Karel Zak [Mon, 2 May 2022 09:59:42 +0000 (11:59 +0200)] 
Merge branch 'master' of https://github.com/caramelli/util-linux

* 'master' of https://github.com/caramelli/util-linux:
  meson: fix when HAVE_CLOCK_GETTIME is set

3 years agoMerge branch 'safe-getenv' of https://github.com/floppym/util-linux
Karel Zak [Mon, 2 May 2022 09:43:08 +0000 (11:43 +0200)] 
Merge branch 'safe-getenv' of https://github.com/floppym/util-linux

* 'safe-getenv' of https://github.com/floppym/util-linux:
  lib: allow safe_getenv to work for non-root users

3 years agomeson: make libpam optional
Rosen Penev [Mon, 2 May 2022 03:28:39 +0000 (20:28 -0700)] 
meson: make libpam optional

libpam is only needed if 4 utilities are built

Signed-off-by: Rosen Penev <rosenp@gmail.com>
3 years agolibfdisk: (gpt) Add UUID for Marvell Armada 3700 Boot partition
Pali Rohár [Sat, 30 Apr 2022 10:50:46 +0000 (12:50 +0200)] 
libfdisk: (gpt) Add UUID for Marvell Armada 3700 Boot partition

This GPT UUID is used by BootROM on Marvell Armada 3700 SoC. BootROM
searches for GPT partition with this UUID on attached SATA disk and loads
bootloader from it.

Marvell Armada 3700 SoC is used e.g. on popular EspressoBIN SBC board which
has relatively solid Linux support.

Information about SATA booting and this GPT partition is currently
documented only in development version of ARM Trusted-Firmware-A
documentation:

https://trustedfirmware-a.readthedocs.io/en/latest/plat/marvell/armada/build.html

It is missing in official documentation for Armada 3720 BootROM and
therefore hard to find it.

Signed-off-by: Pali Rohár <pali.rohar@gmail.com>
3 years agomeson: fix tzname check
Rosen Penev [Sat, 30 Apr 2022 02:00:53 +0000 (19:00 -0700)] 
meson: fix tzname check

tzname is not a type but a variable. sizeof only works on types.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
3 years agomeson: fix isnan check
Rosen Penev [Sat, 30 Apr 2022 01:19:53 +0000 (18:19 -0700)] 
meson: fix isnan check

musl only has isnan as a macro, not as a function. Handle the former
case.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
3 years agomeson: add _GNU_SOURCE for sighandler_t
Rosen Penev [Sat, 30 Apr 2022 01:17:52 +0000 (18:17 -0700)] 
meson: add _GNU_SOURCE for sighandler_t

musl requires it.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
3 years agomeson: fix environ search
Rosen Penev [Sat, 30 Apr 2022 01:16:17 +0000 (18:16 -0700)] 
meson: fix environ search

musl has it defined in unistd.h and hidden behind _GNU_SOURCE.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
3 years agomeson: fix cpu_set_t test
Rosen Penev [Fri, 29 Apr 2022 23:55:15 +0000 (16:55 -0700)] 
meson: fix cpu_set_t test

_GNU_SOURCE is needed here.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
3 years agomeson: don't use run
Rosen Penev [Fri, 29 Apr 2022 23:56:54 +0000 (16:56 -0700)] 
meson: don't use run

Fixes cross compilation. run is not needed anyway.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
3 years agomeson: fix compilation without systemd
Rosen Penev [Fri, 29 Apr 2022 23:53:43 +0000 (16:53 -0700)] 
meson: fix compilation without systemd

systemdsystemunitdir is used elsewhere.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
3 years agoBSD: Use byteswap.h and endian.h defined macos when present
Warner Losh [Fri, 29 Apr 2022 21:29:44 +0000 (15:29 -0600)] 
BSD: Use byteswap.h and endian.h defined macos when present

Newer versions of FreeBSD will have a glibc compatible
byteswap.h. Currently, this file assumes that FreeBSD requires
bswap{16,32,64} to always be defined. This isn't the case when we're
using the byteswap.h file (which is enabled by HAVE_BYTESWAP_H
define). Assume that if byteswap.h and endian.h are present, then the
proper macros are defined.  Otherwise, assume that sys/endian.h is
present and paper over the small differences between the BSDs for this
file.

Signed-off-by: Warner Losh <imp@bsdimp.com>
3 years agomeson: fix when HAVE_CLOCK_GETTIME is set
Nicolas Caramelli [Fri, 29 Apr 2022 16:16:36 +0000 (18:16 +0200)] 
meson: fix when HAVE_CLOCK_GETTIME is set

Signed-off-by: Nicolas Caramelli <caramelli.devel@gmail.com>
3 years agolibuuid: improve cache handling
d032747 [Fri, 22 Apr 2022 08:07:46 +0000 (10:07 +0200)] 
libuuid: improve cache handling

Short running applications with a few UUID request don't need
a large cache. Therefore increment the cache size over runtime.

3 years agolsirq: improve --sort IRQ
Karel Zak [Fri, 29 Apr 2022 08:11:49 +0000 (10:11 +0200)] 
lsirq: improve --sort IRQ

IRQ column mixes numbers and text, it seems better to use strverscmp()
rather than classic strcmp().

Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=2078787
Signed-off-by: Karel Zak <kzak@redhat.com>
3 years agolibblkid: add FSLASTBLOCK field interface showing area occupied by fs
Andrey Albershteyn [Wed, 27 Apr 2022 11:24:56 +0000 (13:24 +0200)] 
libblkid: add FSLASTBLOCK field interface showing area occupied by fs

Add interface to let filesystem set FSLASTBLOCK which is basically
total number of fsblocks (area occupied by fs). Enable that field in
the 'superblocks' sample.

Signed-off-by: Andrey Albershteyn <aalbersh@redhat.com>
3 years agolib: allow safe_getenv to work for non-root users
Mike Gilbert [Tue, 26 Apr 2022 17:58:12 +0000 (13:58 -0400)] 
lib: allow safe_getenv to work for non-root users

This allows users to override settings like BLKID_FILE, as is done in
the e2fsprogs test suite.

Bug: https://bugs.gentoo.org/839825
Fixes: 035507c84b53bceb143d0923e65916cbf90979c7
Signed-off-by: Mike Gilbert <floppym@gentoo.org>
3 years agolibblkid: fix FSSIZE docs
Karel Zak [Tue, 26 Apr 2022 08:32:05 +0000 (10:32 +0200)] 
libblkid: fix FSSIZE docs

Signed-off-by: Karel Zak <kzak@redhat.com>
3 years agoblkid: add FSSIZE tag with tests for XFS
Andrey Albershteyn [Mon, 25 Apr 2022 15:08:39 +0000 (17:08 +0200)] 
blkid: add FSSIZE tag with tests for XFS

The FSSIZE tag was added to the libblkid. Enable this tag in blkid
and update tests golden output for XFS test cases.

Signed-off-by: Andrey Albershteyn <aalbersh@redhat.com>
3 years agolibblkid: implement FSSIZE calculation for XFS
Andrey Albershteyn [Mon, 25 Apr 2022 15:08:38 +0000 (17:08 +0200)] 
libblkid: implement FSSIZE calculation for XFS

The implementation is similar to one provided by statfs(2) + lsblk.

Signed-off-by: Andrey Albershteyn <aalbersh@redhat.com>
3 years agolibblkid: add interface for FSSIZE field
Andrey Albershteyn [Mon, 25 Apr 2022 15:08:37 +0000 (17:08 +0200)] 
libblkid: add interface for FSSIZE field

Add interface to let filesystem probe calculate and set FSSIZE.
Enable that field in the 'superblocks' sample.

Signed-off-by: Andrey Albershteyn <aalbersh@redhat.com>
3 years agoeject: update file provenance of DRIVER_SENSE in the comments
Enze Li [Wed, 20 Apr 2022 09:37:01 +0000 (17:37 +0800)] 
eject: update file provenance of DRIVER_SENSE in the comments

The location where the macro DRIVER_SENSE is defined has been placed in
include/scsi/sg.h in the kernel upstream, but the comment was not
updated in time.  This patch updates the contents of this comment.

Signed-off-by: Enze Li <lienze@kylinos.cn>
3 years agolsblk: add ID column
Karel Zak [Mon, 25 Apr 2022 13:27:07 +0000 (15:27 +0200)] 
lsblk: add ID column

Addresses: https://github.com/util-linux/util-linux/issues/1658
Signed-off-by: Karel Zak <kzak@redhat.com>
3 years agolsblk: make ID-LINK code more readable
Karel Zak [Mon, 25 Apr 2022 12:54:29 +0000 (14:54 +0200)] 
lsblk: make ID-LINK code more readable

Signed-off-by: Karel Zak <kzak@redhat.com>
3 years agolibmount: when moving a mount point, all sub mount entries in utab should also be...
Franck Bui [Fri, 22 Apr 2022 09:30:09 +0000 (11:30 +0200)] 
libmount: when moving a mount point, all sub mount entries in utab should also be updated

Given that /run/mount/utab stores paths, this file needs to be adjusted when a
mount tree is moved.

However the moved tree may contains sub mount points in which case their utab
entries (if any) need to also be translated.

This patch takes care of that.

As suggested in https://github.com/systemd/systemd/issues/15266, a better
approach might be to store mount IDs instead of paths since mount IDs remain
unchanged when mount trees are moved.

Fixes: #1659
3 years agolsblk: add ID-LINK column
Karel Zak [Fri, 22 Apr 2022 09:20:26 +0000 (11:20 +0200)] 
lsblk: add ID-LINK column

Addresses: https://github.com/util-linux/util-linux/issues/1658
Signed-off-by: Karel Zak <kzak@redhat.com>
3 years agolsblk: remove huge all-function if-condition
Karel Zak [Fri, 22 Apr 2022 09:16:20 +0000 (11:16 +0200)] 
lsblk: remove huge all-function if-condition

Let's make it more readable and easy to extend.

Signed-off-by: Karel Zak <kzak@redhat.com>
3 years agolibmount: cleanup UID and GIR parsing, add tests
Karel Zak [Thu, 21 Apr 2022 09:41:00 +0000 (11:41 +0200)] 
libmount: cleanup UID and GIR parsing, add tests

* parse_uid_numeric() and parse_gid_numeric() assumes zero terminated
  strings, so do not require size. The function ul_strtou64() already
  checks that the number is terminated by \0

* use rc from ul_strtou64()

* always set errno if necessary

* return -errno or -EINVAL rather than generic -1

* add --parse-{uid,gid,mode} to test_mount_utils

Signed-off-by: Karel Zak <kzak@redhat.com>
3 years agolib/strutils: make sure ul_strtoXX functions always set errno
Karel Zak [Thu, 21 Apr 2022 09:40:43 +0000 (11:40 +0200)] 
lib/strutils: make sure ul_strtoXX functions always set errno

Signed-off-by: Karel Zak <kzak@redhat.com>
3 years agolibmount: accept X-mount.{owner,group,mode}=
наб [Tue, 19 Apr 2022 14:56:07 +0000 (16:56 +0200)] 
libmount: accept X-mount.{owner,group,mode}=

Which take a user, group, and mode, respectively, and set them on the
target after mounting

This is vaguely similar to tmpfs(5)'s [ug]id= and mode= options,
but we POSIX-parse the user- and group names

Oft requested in systemd/zram-generator, since a common use-case
is to use it to create /tmp or an equivalent directory that needs
to be a=rwx,o+t (or a user's private temp that needs to be owned
by them) ‒ this is impossible without terrible hacks, cf.
https://github.com/systemd/zram-generator/issues/150,
https://github.com/systemd/zram-generator/issues/146, &c.

This started off as a Set{User,Group,Mode}= systemd mount unit,
but was poetterung into libmount options:
https://github.com/systemd/systemd/pull/22889

Signed-off-by: Ahelenia Ziemiańska <nabijaczleweli@nabijaczleweli.xyz>
Signed-off-by: Karel Zak <kzak@redhat.com>
3 years agotests: report failed tests
Karel Zak [Thu, 21 Apr 2022 08:59:28 +0000 (10:59 +0200)] 
tests: report failed tests

Signed-off-by: Karel Zak <kzak@redhat.com>
3 years agodmesg: fix --since and --until
Karel Zak [Wed, 20 Apr 2022 12:42:32 +0000 (14:42 +0200)] 
dmesg: fix --since and --until

Now --since and --until requires any time field in the output (e.g.
--ctime,-T), it means "dmesg --since '1 day ago'" doesn't work, but
"dmesg -T --since '1 day ago'" works as expected.

Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=2076829
Signed-off-by: Karel Zak <kzak@redhat.com>
3 years agolib/pty: minor cleanups
Karel Zak [Tue, 19 Apr 2022 10:28:09 +0000 (12:28 +0200)] 
lib/pty: minor cleanups

Signed-off-by: Karel Zak <kzak@redhat.com>
3 years agolib/pty: Put master PTY into non-blocking mode and buffer its output to avoid deadlock
наб [Tue, 12 Apr 2022 14:25:14 +0000 (16:25 +0200)] 
lib/pty: Put master PTY into non-blocking mode and buffer its output to avoid deadlock

If we filled the script->child buffer before the child had a chance to read any
input, we'd sleep forever in write_all(pty->master), and the child would sleep
forever in write(1<pty->slave>)

By putting the master PTY in non-blocking mode, we can poll(pty->master,
POLLOUT) and keep supplying more data as the child reads from the buffer

Fixes Debian bug #1003095

Signed-off-by: Karel Zak <kzak@redhat.com>
3 years agobuild-sys: add blkpr to gitignore
Enze Li [Fri, 15 Apr 2022 05:55:10 +0000 (13:55 +0800)] 
build-sys: add blkpr to gitignore

Since this commit 627428a95692 ("blkpr: add block persistent
reservations command"), we introduced blkpr, but the compiled generated
binary file is not added to the gitignore, so let's do it.

v2:
- Reorder blkxxx in alphabetical order.

Signed-off-by: Enze Li <lienze@kylinos.cn>
3 years agotests: test_buffer, return EXIT_SUCCESS at the end
Anatoly Pugachev [Thu, 14 Apr 2022 07:39:54 +0000 (10:39 +0300)] 
tests: test_buffer, return EXIT_SUCCESS at the end

Signed-off-by: Anatoly Pugachev <matorola@gmail.com>
3 years agolib/strutils: improve strtoul_or_err() for negative numbers
Karel Zak [Tue, 19 Apr 2022 09:38:57 +0000 (11:38 +0200)] 
lib/strutils: improve strtoul_or_err() for negative numbers

Let's use the same code for strtoul_or_err() and strtol_or_err() as we
already use for strtoxXX_or_err() functions. It resolves issue with
negative numbers.

This problem has been discovered by "./eject -x -1 -v" where -x is
based on strtoul_or_err(), but accepts negative number (-1).

Reported-by: Enze Li <lienze@kylinos.cn>
Signed-off-by: Karel Zak <kzak@redhat.com>
3 years agoMerge branch 'meson-static' of https://github.com/eli-schwartz/util-linux
Karel Zak [Tue, 19 Apr 2022 09:14:38 +0000 (11:14 +0200)] 
Merge branch 'meson-static' of https://github.com/eli-schwartz/util-linux

* 'meson-static' of https://github.com/eli-schwartz/util-linux:
  meson: fix typoed copy-paste error that override other dependencies to blkid
  meson: pass the correct absolute path to config.h
  meson: fix static builds creating conflicting targets

3 years agoMerge branch 'fdisktestsppc64le' of https://github.com/zeha/util-linux
Karel Zak [Tue, 19 Apr 2022 09:13:03 +0000 (11:13 +0200)] 
Merge branch 'fdisktestsppc64le' of https://github.com/zeha/util-linux

* 'fdisktestsppc64le' of https://github.com/zeha/util-linux:
  tests: fdisk/bsd: update expected output for ppc64le

3 years agoMerge branch 'lsfd-ipc-fifo' of https://github.com/masatake/util-linux
Karel Zak [Tue, 19 Apr 2022 09:10:30 +0000 (11:10 +0200)] 
Merge branch 'lsfd-ipc-fifo' of https://github.com/masatake/util-linux

* 'lsfd-ipc-fifo' of https://github.com/masatake/util-linux:
  test: (lsfd) add a case for testing ENDPOINTS column of FIFOs
  test: (lsfd) extend test_mkfds to manage optional file descriptors
  lsfd: fill ENDPOINTS column for FIFOs
  lsfd: add ENDPOINTS column
  lsfd: move xstrappend and xstrputc to lsfd.h
  lsfd: add basic code for tracking IPC endpoints
  lsfd: add static modifier to nodev_table
  lsfd: delete __unused__ attribute for an used parameter

3 years agolibblkid: check fsync() return code
Karel Zak [Tue, 19 Apr 2022 07:44:07 +0000 (09:44 +0200)] 
libblkid: check fsync() return code

Since 39f5af25982d8b0244000e92a9d0e0e6557d0e17 libblkid uses
O_NONBLOCK. Now it's more obvious that check fsync() (and close())
return value after write() is always a good idea ...

Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=2074486
Signed-off-by: Karel Zak <kzak@redhat.com>
3 years agomeson: fix typoed copy-paste error that override other dependencies to blkid
Eli Schwartz [Thu, 14 Apr 2022 19:24:27 +0000 (15:24 -0400)] 
meson: fix typoed copy-paste error that override other dependencies to blkid

3 years agomeson: pass the correct absolute path to config.h
Eli Schwartz [Thu, 14 Apr 2022 14:55:29 +0000 (10:55 -0400)] 
meson: pass the correct absolute path to config.h

When building util-linux as a subproject inside another project (using
dependency fallback to get e.g. libuuid), `-include config.h` will not
work because it is generated private to util-linux. Build the project
argument using the path to the current build dir instead.

3 years agomeson: fix static builds creating conflicting targets
Eli Schwartz [Thu, 14 Apr 2022 14:28:29 +0000 (10:28 -0400)] 
meson: fix static builds creating conflicting targets

Meson has a global option -Ddefault_library which determines whether to
build all generic libraries as static, shared, or both. When creating a
library of the same name twice, once with library() and once with either
shared_library() or static_library(), some values for -Ddefault_library
will result in a fatal configuration error because multiple rules try to
create libXXX.a or libXXX.so

The reason for creating these additional copies of the library is in
order to optionally build some programs as both "prog" and "prog.static"
(and the latter is, of course, static). So depending on the
default_library value may not be desirable.

3 years agotests: fdisk/bsd: update expected output for ppc64le
Chris Hofstaedtler [Wed, 13 Apr 2022 11:11:50 +0000 (11:11 +0000)] 
tests: fdisk/bsd: update expected output for ppc64le

Update expected test data after upstream MRs #1385 and #1386.

Signed-off-by: Chris Hofstaedtler <zeha@debian.org>
3 years agonamei: add -Z (selinux context report)
Karel Zak [Wed, 13 Apr 2022 10:35:40 +0000 (12:35 +0200)] 
namei: add -Z (selinux context report)

Co-Author: CJ Kucera <cj@apocalyptech.com>
Addresses:  https://github.com/util-linux/util-linux/pull/1630
Signed-off-by: Karel Zak <kzak@redhat.com>
3 years agobuild-sys: add gnu global outputs to gitignore
Enze Li [Wed, 13 Apr 2022 07:53:50 +0000 (15:53 +0800)] 
build-sys: add gnu global outputs to gitignore

Some people like to use gnu global to browse code, so we add the global
output files to gitignore, which is safe because no function-related
code is changed.

Signed-off-by: Enze Li <lienze@kylinos.cn>
3 years agomeson: validate the return code of subprocess commands
Eli Schwartz [Wed, 13 Apr 2022 01:50:57 +0000 (21:50 -0400)] 
meson: validate the return code of subprocess commands

run_command() has an unfortunate early design quirk in that it doesn't
error when the command itself errors. Recent versions of Meson warn if
you do not explicitly specify whether the return code matters by passing
`check:` to it; this prevents building util-linux (including as a
subproject) with --fatal-meson-warnings.

3 years agomeson: export dependencies as declared dependencies
Eli Schwartz [Wed, 13 Apr 2022 01:23:34 +0000 (21:23 -0400)] 
meson: export dependencies as declared dependencies

This allows util-linux to be built as a subproject in order to provide
an alternative to a system version of e.g. fdisk.pc, uuid.pc

3 years agomeson: declare the minimum required version of meson itself
Eli Schwartz [Wed, 13 Apr 2022 01:25:01 +0000 (21:25 -0400)] 
meson: declare the minimum required version of meson itself

Features from Meson 0.53.0 are used, so declare this as required to
prevent people from trying to use older versions and getting strange
errors. Instead, Meson will tell them they need that version.

3 years agoMerge branch 'no_systemd' of https://github.com/data-man/util-linux
Karel Zak [Tue, 12 Apr 2022 11:51:27 +0000 (13:51 +0200)] 
Merge branch 'no_systemd' of https://github.com/data-man/util-linux

* 'no_systemd' of https://github.com/data-man/util-linux:
  Don't install uuidd service if systemd isn't present

3 years agoDon't install uuidd service if systemd isn't present
data-man [Tue, 12 Apr 2022 10:29:06 +0000 (15:29 +0500)] 
Don't install uuidd service if systemd isn't present

3 years agolibfdisk: (gpt) add comment
Karel Zak [Tue, 12 Apr 2022 09:56:40 +0000 (11:56 +0200)] 
libfdisk: (gpt) add comment

Signed-off-by: Karel Zak <kzak@redhat.com>
3 years agolibfdisk: (gpt) write PMBR only when useful
Philippe Reynes [Mon, 11 Apr 2022 12:42:29 +0000 (14:42 +0200)] 
libfdisk: (gpt) write PMBR only when useful

The MBR is critical as it doesn't have a backup, so we only write it when it is
really useful (ie: the current MBR is different than the new one).

Signed-off-by: Philippe Reynes <philippe.reynes@softathome.com>
3 years agolscpu: fix incomplete column description
Karel Zak [Tue, 12 Apr 2022 08:57:33 +0000 (10:57 +0200)] 
lscpu: fix incomplete column description

Fixes: https://github.com/util-linux/util-linux/issues/1649
Signed-off-by: Karel Zak <kzak@redhat.com>
3 years agoblkpr: change description formatting
Karel Zak [Mon, 11 Apr 2022 10:50:47 +0000 (12:50 +0200)] 
blkpr: change description formatting

* make it more usable for translators
* keep output shorter

Signed-off-by: Karel Zak <kzak@redhat.com>
3 years agoblkpr: add descriptions for arguments
zhenwei pi [Thu, 7 Apr 2022 03:49:32 +0000 (11:49 +0800)] 
blkpr: add descriptions for arguments

Karel pointed out that the arguments of this command is not obvious
enough for end-users. So add the detailed descriptions.

The description comes from linux/Documentation/block/pr.rst, and
modify a bit.

Signed-off-by: zhenwei pi <pizhenwei@bytedance.com>
3 years agoblkpr: rename operation to command
zhenwei pi [Thu, 7 Apr 2022 03:49:31 +0000 (11:49 +0800)] 
blkpr: rename operation to command

Suggested by Karel, rename operation to command.
Thus make this more clear.

Signed-off-by: zhenwei pi <pizhenwei@bytedance.com>
3 years agoMerge branch 'macos-lsfd' of https://github.com/mator/util-linux
Karel Zak [Mon, 11 Apr 2022 09:31:03 +0000 (11:31 +0200)] 
Merge branch 'macos-lsfd' of https://github.com/mator/util-linux

* 'macos-lsfd' of https://github.com/mator/util-linux:
  tests: don't compile lsfd/mkfds helper on macos, since it's linux only

3 years agoMerge branch 'setarch-opts' of https://github.com/mator/util-linux
Karel Zak [Mon, 11 Apr 2022 09:29:46 +0000 (11:29 +0200)] 
Merge branch 'setarch-opts' of https://github.com/mator/util-linux

* 'setarch-opts' of https://github.com/mator/util-linux:
  tests: fix misc/setarch run in a docker environment

3 years agoMerge branch 'libfdisk' of https://github.com/mator/util-linux
Karel Zak [Mon, 11 Apr 2022 09:29:01 +0000 (11:29 +0200)] 
Merge branch 'libfdisk' of https://github.com/mator/util-linux

* 'libfdisk' of https://github.com/mator/util-linux:
  libfdisk: meson.build fix typo

3 years agoMerge branch 'lsfd-map_files' of https://github.com/masatake/util-linux
Karel Zak [Mon, 11 Apr 2022 09:28:31 +0000 (11:28 +0200)] 
Merge branch 'lsfd-map_files' of https://github.com/masatake/util-linux

* 'lsfd-map_files' of https://github.com/masatake/util-linux:
  lsfd: use /proc/$PID/map_files as the fallback information source

3 years agoMerge branch 'lsfd-filter-empty-string' of https://github.com/masatake/util-linux
Karel Zak [Mon, 11 Apr 2022 09:25:30 +0000 (11:25 +0200)] 
Merge branch 'lsfd-filter-empty-string' of https://github.com/masatake/util-linux

* 'lsfd-filter-empty-string' of https://github.com/masatake/util-linux:
  lsfd: (filter): parse "" in filter expression correctly
  lsfd: (filter): fix a codeing style of if/else

3 years agolsfd: use /proc/$PID/map_files as the fallback information source
Masatake YAMATO [Mon, 4 Apr 2022 12:05:31 +0000 (21:05 +0900)] 
lsfd: use /proc/$PID/map_files as the fallback information source

The original code scanning /proc/$PID/maps assumed two things; an entry
of the file contains a path started from '/' if a file is mapped, and
stat(2) works well with the path in the entry.

A mmap'ed socket breaks the former assumption.
tcpdump/lipcap does mmap an AF_PACKET socket to its address space!

A file is deleted after mapping breaks the latter assumption.

With this change, lsfd utilizes dentries under /proc/$PID/map_files
for gathering information of the mapped file in the case that the
assumptions are broken.

Private anonymous mappings are skipped to avoid wasting CPU time.

Example output:

  # ./lsfd -p 1541379 -Q '(ASSOC == "shm")'
  COMMAND     PID    USER ASSOC MODE TYPE SOURCE MNTID     INODE NAME
  tcpdump 1541379 tcpdump   shm  rw- SOCK sockfs     0 114535087 PACKET:[114535087]

  # ./lsfd -Q '(ASSOC == "shm") and DELETED' | head -2
  COMMAND             PID            USER ASSOC MODE TYPE SOURCE MNTID    INODE NAME
  systemd-resolve     870 systemd-resolve   shm  r--  REG   dm-0     0  1180413 /var/lib/sss/mc/passwd (deleted)

NOTE: CAP_SYS_ADMIN capability is required to access map_files.
See proc(5) for more details.

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
3 years agotests: don't compile lsfd/mkfds helper on macos, since it's linux only
Anatoly Pugachev [Sat, 9 Apr 2022 09:44:06 +0000 (12:44 +0300)] 
tests: don't compile lsfd/mkfds helper on macos, since it's linux only

macos is missing linux only header "sys/prctl.h", so exclude lsfd/mkfds
on macos from make 'check-programs' target

3 years agotests: fix misc/setarch run in a docker environment
Anatoly Pugachev [Fri, 8 Apr 2022 14:53:58 +0000 (17:53 +0300)] 
tests: fix misc/setarch run in a docker environment

Fixes: #601
3 years agolibfdisk: meson.build fix typo
Anatoly Pugachev [Fri, 8 Apr 2022 12:34:16 +0000 (15:34 +0300)] 
libfdisk: meson.build fix typo