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

3 years agoblkpr: fix extra ';' outside of a function [clang]
Karel Zak [Wed, 6 Apr 2022 10:43:05 +0000 (12:43 +0200)] 
blkpr: fix extra ';' outside of a function [clang]

Signed-off-by: Karel Zak <kzak@redhat.com>
3 years agoblkpr: cosmetic coding style changes
Karel Zak [Wed, 6 Apr 2022 10:18:33 +0000 (12:18 +0200)] 
blkpr: cosmetic coding style changes

Signed-off-by: Karel Zak <kzak@redhat.com>
3 years agoblkpr: cleanup --help output and man page
Karel Zak [Wed, 6 Apr 2022 10:14:12 +0000 (12:14 +0200)] 
blkpr: cleanup --help output and man page

Signed-off-by: Karel Zak <kzak@redhat.com>
3 years agoblkpr: add block persistent reservations command
zhenwei pi [Thu, 16 Sep 2021 03:29:01 +0000 (11:29 +0800)] 
blkpr: add block persistent reservations command

Linux kernel block layer supports PR (persistent reservations) ioctl
on a block device. Typically SCSI and NVMe disk support PR feature,
and blkpr could operation on them.

Signed-off-by: zhenwei pi <pizhenwei@bytedance.com>
3 years agolsns: improve dependence on NS_GET_ ioctls
Karel Zak [Wed, 6 Apr 2022 08:38:43 +0000 (10:38 +0200)] 
lsns: improve dependence on NS_GET_ ioctls

Fixes: http://autobuild.buildroot.org/results/572ecf8e37ac733a4e4265f4f78f35230337278e
Reported-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
3 years agoconfigure.ac: add lsns option
Fabrice Fontaine [Tue, 5 Apr 2022 18:04:59 +0000 (20:04 +0200)] 
configure.ac: add lsns option

lsns unconditionally uses NS_GET_NSTYPE since version 2.38 and
https://git.kernel.org/pub/scm/utils/util-linux/util-linux.git/commit/?id=de72df79d72fa906e71e2ac922d8745ff22deee5
which is only available since kernel 4.11 and
https://github.com/torvalds/linux/commit/e5ff5ce6e20ee22511398bb31fb912466cf82a36
resulting in the following build failure:

sys-utils/lsns.c: In function 'add_namespace_for_nsfd':
sys-utils/lsns.c:719:25: error: 'NS_GET_NSTYPE' undeclared (first use in this function)
  719 |  clone_type = ioctl(fd, NS_GET_NSTYPE);
      |                         ^~~~~~~~~~~~~

So add an option to allow the user to disable lsns

Fixes:
 - http://autobuild.buildroot.org/results/572ecf8e37ac733a4e4265f4f78f35230337278e

Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
3 years agolibmount: add --onlyonce
Karel Zak [Tue, 5 Apr 2022 09:43:24 +0000 (11:43 +0200)] 
libmount: add --onlyonce

Signed-off-by: Karel Zak <kzak@redhat.com>
3 years agolsfd: (filter): parse "" in filter expression correctly
Masatake YAMATO [Mon, 4 Apr 2022 18:58:59 +0000 (03:58 +0900)] 
lsfd: (filter): parse "" in filter expression correctly

The original code cannot convert "" in filter expression to
a token correctly. The following command line exposes the
bug this change fixes:

  # ./lsfd  -o+ENDPOINTS  -Q '(TYPE == "")'
  zsh: IOT instruction  sudo ./lsfd -Q '(TYPE == "")'

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
3 years agolsfd: (filter): fix a codeing style of if/else
Masatake YAMATO [Mon, 4 Apr 2022 18:54:11 +0000 (03:54 +0900)] 
lsfd: (filter): fix a codeing style of if/else

This is only cosmetic change.

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
3 years agotest: (lsfd) add a case for testing ENDPOINTS column of FIFOs
Masatake YAMATO [Mon, 4 Apr 2022 18:09:09 +0000 (03:09 +0900)] 
test: (lsfd) add a case for testing ENDPOINTS column of FIFOs

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
3 years agotest: (lsfd) extend test_mkfds to manage optional file descriptors
Masatake YAMATO [Mon, 4 Apr 2022 18:03:25 +0000 (03:03 +0900)] 
test: (lsfd) extend test_mkfds to manage optional file descriptors

This change may need to test ENDPOINTS column of lsfd.

The core part of test_mkfds command could close pre-specified file
descriptors opened by a factory. However, it could not handle file
descriptors optionally opened.

With this change, the core part can close such optionally opened file
descriptors.

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
3 years agolsfd: fill ENDPOINTS column for FIFOs
Masatake YAMATO [Mon, 7 Mar 2022 13:19:28 +0000 (22:19 +0900)] 
lsfd: fill ENDPOINTS column for FIFOs

For FIFO type files, lsof can fill ENDPOINTS as following:

  _PID_,_COMMAND_,_ASSOC_[-r][-w]

Example output:

  $ dd if=/dev/zero | nc -l 127.0.0.1 9091 > /dev/null &
  [1] 1707808 1707809

  $ ./lsfd -p "1707808 1707809" -o+ENDPOINTS -Q '(type == "FIFO")'
  COMMAND     PID   USER ASSOC MODE TYPE SOURCE MNTID    INODE NAME            ENDPOINTS
  dd      1707808 yamato     1  -w- FIFO pipefs    14 73477636 pipe:[734776361707809,nc,0r-
  nc      1707809 yamato     0  r-- FIFO pipefs    14 73477636 pipe:[734776361707808,dd,1-w

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
3 years agotests: make libmount tests more portable
Karel Zak [Mon, 4 Apr 2022 13:59:36 +0000 (15:59 +0200)] 
tests: make libmount tests more portable

git tree on macbook:
...
warning: the following paths have collided (e.g. case-sensitive paths
on a case-insensitive filesystem) and only one from the same
colliding group is in the working tree:

  'tests/expected/libmount/optstr-apply-user-X'
  'tests/expected/libmount/optstr-apply-user-x'

Let's rename the files.

Addresses: https://github.com/util-linux/util-linux/issues/1583
Signed-off-by: Karel Zak <kzak@redhat.com>
3 years agolsfd: add ENDPOINTS column
Masatake YAMATO [Mon, 7 Mar 2022 13:18:15 +0000 (22:18 +0900)] 
lsfd: add ENDPOINTS column

The field is for printing the information about the IPC
endpoints.

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
3 years agolsfd: move xstrappend and xstrputc to lsfd.h
Masatake YAMATO [Mon, 7 Mar 2022 13:07:21 +0000 (22:07 +0900)] 
lsfd: move xstrappend and xstrputc to lsfd.h

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
3 years agolsfd: add basic code for tracking IPC endpoints
Masatake YAMATO [Mon, 7 Mar 2022 09:20:10 +0000 (18:20 +0900)] 
lsfd: add basic code for tracking IPC endpoints

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
3 years agolsfd: add static modifier to nodev_table
Masatake YAMATO [Mon, 7 Mar 2022 09:17:25 +0000 (18:17 +0900)] 
lsfd: add static modifier to nodev_table

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
3 years agolsfd: delete __unused__ attribute for an used parameter
Masatake YAMATO [Mon, 7 Mar 2022 08:10:17 +0000 (17:10 +0900)] 
lsfd: delete __unused__ attribute for an used parameter

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
3 years agoMerge branch 'lsfd-test-add-missing-dup2' of https://github.com/masatake/util-linux
Karel Zak [Mon, 4 Apr 2022 11:24:31 +0000 (13:24 +0200)] 
Merge branch 'lsfd-test-add-missing-dup2' of https://github.com/masatake/util-linux

3 years agobuild-sys: improve dependences for lib/procfs.c
Karel Zak [Mon, 4 Apr 2022 11:17:44 +0000 (13:17 +0200)] 
build-sys: improve dependences for lib/procfs.c

* add #ifdefs when use statfs() and include statfs.h or vfs.h

Addresses: https://github.com/util-linux/util-linux/issues/1634
Signed-off-by: Karel Zak <kzak@redhat.com>
3 years agoRevert "build-sys: compile procfs and sysfs code in Linux only"
Karel Zak [Mon, 4 Apr 2022 09:26:59 +0000 (11:26 +0200)] 
Revert "build-sys: compile procfs and sysfs code in Linux only"

This reverts commit f30b16edb467484d8d9e5a5b5fd665b83a90ddc9.

It seems better to use original solution and depend on HAVE_DIRFD
and HAVE_OPENAT, because libblkid and another tools are compiled
on non-Linux targets too.

3 years agotests: (lsfd) add missing dup2 calls to assign proper file descriptors
Masatake YAMATO [Sun, 3 Apr 2022 02:19:43 +0000 (11:19 +0900)] 
tests: (lsfd) add missing dup2 calls to assign proper file descriptors

Close #1637.

The test cases assumed the file descriptor #3 was not occupied. As
reported in #1637, the assumption was wrong. This new code assigns
the file descriptor #3 explicitly with dup2 as the other test cases
did.

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
3 years agolibmount: fix typos
наб [Thu, 31 Mar 2022 16:55:35 +0000 (18:55 +0200)] 
libmount: fix typos

3 years agoirqtop: support -C/--cpu-list
zhenwei pi [Tue, 29 Mar 2022 08:59:51 +0000 (16:59 +0800)] 
irqtop: support -C/--cpu-list

Specify cpus list format to show by -C/--cpu-list parameters, for
example, on an AMD server with 192 CPUs, to show statistics on NUMA
node 1:
  ~# ./irqtop -d 1 -C 48-95,144-191

Signed-off-by: zhenwei pi <pizhenwei@bytedance.com>
3 years agolsblk: fix JSON output when without --bytes
Karel Zak [Fri, 1 Apr 2022 08:03:14 +0000 (10:03 +0200)] 
lsblk: fix JSON output when without --bytes

Fixes: https://github.com/util-linux/util-linux/issues/1636
Signed-off-by: Karel Zak <kzak@redhat.com>
3 years agobuild-sys: compile procfs and sysfs code in Linux only
Karel Zak [Fri, 1 Apr 2022 07:44:18 +0000 (09:44 +0200)] 
build-sys: compile procfs and sysfs code in Linux only

Addresses: https://github.com/util-linux/util-linux/issues/1634
Signed-off-by: Karel Zak <kzak@redhat.com>
3 years agounshare: make pidfd_open() use more portable and robust
Karel Zak [Thu, 31 Mar 2022 08:55:30 +0000 (10:55 +0200)] 
unshare: make pidfd_open() use more portable and robust

* use #ifdef UL_HAVE_PIDFD for better portability

* open and close fd_parent_pid only when --kill-child specified

Signed-off-by: Karel Zak <kzak@redhat.com>
3 years agounshare: Fix PDEATHSIG race for --kill-child with --pid
Earl Chew [Tue, 8 Mar 2022 04:41:24 +0000 (20:41 -0800)] 
unshare: Fix PDEATHSIG race for --kill-child with --pid

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

Note that if the child is created as pid 1 in a
new pid namespace, getppid(2) will return 0 because
the parent resides in a different namespace, and
SIGKILL will only be delivered if sent from the
ancestor namespace.

Instead of checking the pid of the parent, use a pidfd
instance to detect the termination of the parent.

The issue can be reproduced using the following script
which must be run as root to permite the --pid option.
The script will sometimes print 0..9 despite the parent
being killed:

while : ; do
cat /proc/uptime
sh -c '
  unshare --kill-child --pid --fork bash -c "
    for X in {0..9} ; do echo \$X || break ; sleep 1 ; done" &
  sleep 0 # sleep 0.00$RANDOM
  kill -9 $! 2>/dev/null' |
cat
done

Signed-off-by: Earl Chew <earl_chew@yahoo.com>
3 years agocolumn: fix memory use [coverity scan]
Karel Zak [Thu, 31 Mar 2022 07:55:23 +0000 (09:55 +0200)] 
column: fix memory use [coverity scan]

Signed-off-by: Karel Zak <kzak@redhat.com>
3 years agocolumn: add missing help entry
Karel Zak [Wed, 23 Mar 2022 12:06:09 +0000 (13:06 +0100)] 
column: add missing help entry

Signed-off-by: Karel Zak <kzak@redhat.com>
3 years agocolumn: don't require column name for JSON
Karel Zak [Wed, 23 Mar 2022 11:50:07 +0000 (12:50 +0100)] 
column: don't require column name for JSON

The "--table-hide -" hides all unnamed columns, but this does not work
for JSON output. This patch fixes this issue.

Signed-off-by: Karel Zak <kzak@redhat.com>
3 years agocolumn: add --table-column
Karel Zak [Wed, 23 Mar 2022 11:34:58 +0000 (12:34 +0100)] 
column: add --table-column

Signed-off-by: Karel Zak <kzak@redhat.com>
3 years agolibsmartcols: add scols_column_set_properties()
Karel Zak [Wed, 23 Mar 2022 10:59:27 +0000 (11:59 +0100)] 
libsmartcols: add scols_column_set_properties()

This function can set all column properties from comma separated
string.

Signed-off-by: Karel Zak <kzak@redhat.com>
3 years agolibmount: move optstr parsing to lib/
Karel Zak [Tue, 22 Mar 2022 10:09:07 +0000 (11:09 +0100)] 
libmount: move optstr parsing to lib/

Signed-off-by: Karel Zak <kzak@redhat.com>
3 years agomeson: update for logindefs move
Karel Zak [Mon, 21 Mar 2022 12:40:40 +0000 (13:40 +0100)] 
meson: update for logindefs move

Signed-off-by: Karel Zak <kzak@redhat.com>
3 years agoagetty: add support for LOGIN_PLAIN_PROMPT
Karel Zak [Mon, 21 Mar 2022 12:19:38 +0000 (13:19 +0100)] 
agetty: add support for LOGIN_PLAIN_PROMPT

login(1) and agetty(8) are usually used together to log-in user. The
initial login prompt is printed by agetty. login(1) can suppress
hostname in the prompt by LOGIN_PLAIN_PROMPT=no (/etc/login.defs), but
for agetty it's necessary to use --nohostname. It's pretty unfriendly
for system admins. Let's share the same setting between all tools.

Signed-off-by: Karel Zak <kzak@redhat.com>
3 years agobuild-sys: move login-utils/logindefs.c to lib
Karel Zak [Mon, 21 Mar 2022 12:07:46 +0000 (13:07 +0100)] 
build-sys: move login-utils/logindefs.c to lib

Signed-off-by: Karel Zak <kzak@redhat.com>
3 years agoagetty: cleanup login prompt macro use
Karel Zak [Mon, 21 Mar 2022 11:02:55 +0000 (12:02 +0100)] 
agetty: cleanup login prompt macro use

Signed-off-by: Karel Zak <kzak@redhat.com>
3 years agocolumn: implement "--output-width unlimited"
Karel Zak [Wed, 9 Mar 2022 10:49:13 +0000 (11:49 +0100)] 
column: implement "--output-width unlimited"

Addresses: https://github.com/util-linux/util-linux/issues/1618
Signed-off-by: Karel Zak <kzak@redhat.com>
3 years agolib/loopdev: consolidate ioctls calls on EAGAIN
Karel Zak [Wed, 9 Mar 2022 10:28:07 +0000 (11:28 +0100)] 
lib/loopdev: consolidate ioctls calls on EAGAIN

Keep all logic to repeat ioctl calls in one macro rather than
duplicate code.

Signed-off-by: Karel Zak <kzak@redhat.com>
3 years agolib/loopdev: remove duplicate code
Karel Zak [Tue, 8 Mar 2022 12:02:38 +0000 (13:02 +0100)] 
lib/loopdev: remove duplicate code

Use loopcxt_ioctl_status() rather than duplicate code.

Signed-off-by: Karel Zak <kzak@redhat.com>
3 years agohardlink: require statfs_magic.h only when reflink support enabled
Karel Zak [Wed, 30 Mar 2022 08:50:38 +0000 (10:50 +0200)] 
hardlink: require statfs_magic.h only when reflink support enabled

Addresses: https://github.com/util-linux/util-linux/issues/1634
Signed-off-by: Karel Zak <kzak@redhat.com>
3 years agobuild-sys: release++ (v2.38) v2.38
Karel Zak [Mon, 28 Mar 2022 11:33:44 +0000 (13:33 +0200)] 
build-sys: release++ (v2.38)

Signed-off-by: Karel Zak <kzak@redhat.com>
3 years agodocs: update v2.38-ReleaseNotes
Karel Zak [Mon, 28 Mar 2022 11:32:47 +0000 (13:32 +0200)] 
docs: update v2.38-ReleaseNotes

Signed-off-by: Karel Zak <kzak@redhat.com>
3 years agodocs: update AUTHORS file
Karel Zak [Mon, 28 Mar 2022 11:31:22 +0000 (13:31 +0200)] 
docs: update AUTHORS file

Signed-off-by: Karel Zak <kzak@redhat.com>
3 years agopo-man: merge changes
Karel Zak [Mon, 28 Mar 2022 11:26:39 +0000 (13:26 +0200)] 
po-man: merge changes

Signed-off-by: Karel Zak <kzak@redhat.com>
3 years agopo: merge changes
Karel Zak [Mon, 28 Mar 2022 11:25:09 +0000 (13:25 +0200)] 
po: merge changes

Signed-off-by: Karel Zak <kzak@redhat.com>
3 years agopo-man: add cs.po (from translationproject.org)
Petr Písař [Mon, 28 Mar 2022 11:23:14 +0000 (13:23 +0200)] 
po-man: add cs.po (from translationproject.org)

3 years agopo-man: update uk.po (from translationproject.org)
Yuri Chornoivan [Mon, 28 Mar 2022 11:23:14 +0000 (13:23 +0200)] 
po-man: update uk.po (from translationproject.org)

3 years agopo-man: update fr.po (from translationproject.org)
Frédéric Marchal [Mon, 28 Mar 2022 11:23:14 +0000 (13:23 +0200)] 
po-man: update fr.po (from translationproject.org)

3 years agopo-man: update de.po (from translationproject.org)
Mario Blättermann [Mon, 28 Mar 2022 11:23:13 +0000 (13:23 +0200)] 
po-man: update de.po (from translationproject.org)

3 years agopo: update zh_CN.po (from translationproject.org)
Boyuan Yang [Mon, 28 Mar 2022 11:22:26 +0000 (13:22 +0200)] 
po: update zh_CN.po (from translationproject.org)

3 years agopo: update uk.po (from translationproject.org)
Yuri Chornoivan [Mon, 28 Mar 2022 11:22:26 +0000 (13:22 +0200)] 
po: update uk.po (from translationproject.org)

3 years agopo: update tr.po (from translationproject.org)
Mesutcan Kurt [Mon, 28 Mar 2022 11:22:26 +0000 (13:22 +0200)] 
po: update tr.po (from translationproject.org)

3 years agopo: update pl.po (from translationproject.org)
Jakub Bogusz [Mon, 28 Mar 2022 11:22:26 +0000 (13:22 +0200)] 
po: update pl.po (from translationproject.org)

3 years agopo: update ko.po (from translationproject.org)
Seong-ho Cho [Mon, 28 Mar 2022 11:22:26 +0000 (13:22 +0200)] 
po: update ko.po (from translationproject.org)

3 years agopo: update hr.po (from translationproject.org)
Božidar Putanec [Mon, 28 Mar 2022 11:22:26 +0000 (13:22 +0200)] 
po: update hr.po (from translationproject.org)

3 years agopo: update fr.po (from translationproject.org)
Frédéric Marchal [Mon, 28 Mar 2022 11:22:26 +0000 (13:22 +0200)] 
po: update fr.po (from translationproject.org)

3 years agopo: update de.po (from translationproject.org)
Mario Blättermann [Mon, 28 Mar 2022 11:22:26 +0000 (13:22 +0200)] 
po: update de.po (from translationproject.org)