]> git.ipfire.org Git - thirdparty/util-linux.git/log
thirdparty/util-linux.git
2 years agoblkid: check device type and name before probe
Karel Zak [Thu, 25 Nov 2021 10:54:26 +0000 (11:54 +0100)] 
blkid: check device type and name before probe

For calls "blkid /dev/*", it seems better to check the
device type and name before we open the device in libblkid.

Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=2026511
Signed-off-by: Karel Zak <kzak@redhat.com>
2 years agolibblkid: check UBI char device name
Karel Zak [Thu, 25 Nov 2021 10:54:11 +0000 (11:54 +0100)] 
libblkid: check UBI char device name

Signed-off-by: Karel Zak <kzak@redhat.com>
2 years agolib/sys: add sysfs_chrdev_devno_to_devname()
Karel Zak [Thu, 25 Nov 2021 10:52:46 +0000 (11:52 +0100)] 
lib/sys: add sysfs_chrdev_devno_to_devname()

Signed-off-by: Karel Zak <kzak@redhat.com>
2 years agofindmnt: add support to print deleted targets
Karel Zak [Wed, 24 Nov 2021 11:22:27 +0000 (12:22 +0100)] 
findmnt: add support to print deleted targets

Signed-off-by: Karel Zak <kzak@redhat.com>
2 years agolibmount: add mnt_fs_is_deleted()
Karel Zak [Wed, 24 Nov 2021 11:20:15 +0000 (12:20 +0100)] 
libmount: add mnt_fs_is_deleted()

Signed-off-by: Karel Zak <kzak@redhat.com>
2 years agonsenter: add --wdns to change working directory
Karel Zak [Mon, 22 Nov 2021 12:18:54 +0000 (13:18 +0100)] 
nsenter: add --wdns to change working directory

The current --wd=<dir> changes CWD to the path which is opened
*before* nsenter calls setns(). It may be useful if you want to use in
namespace something from your current namespace.  In this case, the
option --wd works like a "tunnel" between namespaces.

For some other use-cases, this is useless and you want to be sure that
CWD always points to the target namespace. For this purpose this patch
implements --wdns <dir>.

Example:

 Setup the namespaces:

  # unshare --mount
  # mount /dev/sdc /mnt/A
  # touch /mnt/A/fooooo
  # echo $$
  2425872

 Enter the namespace from another session:

  # nsenter --all --target 2425872 --wd=/mnt/A ls -a
  .  ..

  # nsenter --all --target 2425872 --wdns=/mnt/A ls -a
  .  ..  fooooo  lost+found

Fixes: https://github.com/util-linux/util-linux/issues/1500
Signed-off-by: Karel Zak <kzak@redhat.com>
2 years agologin: (adoc) add hint about PAM and env.variables
Karel Zak [Mon, 22 Nov 2021 09:34:14 +0000 (10:34 +0100)] 
login: (adoc) add hint about PAM and env.variables

Fixes: https://github.com/util-linux/util-linux/issues/1507
Signed-off-by: Karel Zak <kzak@redhat.com>
2 years agoflock: (adoc) fix example
Karel Zak [Mon, 22 Nov 2021 09:23:52 +0000 (10:23 +0100)] 
flock: (adoc) fix example

Fixes: https://github.com/util-linux/util-linux/issues/1506
Signed-off-by: Karel Zak <kzak@redhat.com>
2 years agoscript: (adoc) improve man page readability
Karel Zak [Mon, 22 Nov 2021 09:22:09 +0000 (10:22 +0100)] 
script: (adoc) improve man page readability

Signed-off-by: Karel Zak <kzak@redhat.com>
2 years agolibblkid: don't mark cache as "probed" if /sys not available
Karel Zak [Fri, 19 Nov 2021 13:19:03 +0000 (14:19 +0100)] 
libblkid: don't mark cache as "probed" if /sys not available

For "mount --all" we need to read the cache more than once in a short
time. The library checks the delay between probes, and if the delay is
too short, it does not read devices. This is a problem on boot when there
are no /sys, and the cache is empty. In this case, we need to check
for /sys until it's available constantly.

https://github.com/util-linux/util-linux/issues/1492
Signed-off-by: Karel Zak <kzak@redhat.com>
2 years agolslogins: remove unwanted debug message
Karel Zak [Fri, 19 Nov 2021 11:55:54 +0000 (12:55 +0100)] 
lslogins: remove unwanted debug message

Signed-off-by: Karel Zak <kzak@redhat.com>
2 years agofindmnt: filter entries before add to the tree
Karel Zak [Thu, 18 Nov 2021 14:20:02 +0000 (15:20 +0100)] 
findmnt: filter entries before add to the tree

References: 2a83759765aeedf41d6a053150bf6c3873491b8
Signed-off-by: Karel Zak <kzak@redhat.com>
2 years agoMerge branch 'fix_syscall_usage' of https://github.com/dengraf/util-linux
Karel Zak [Thu, 18 Nov 2021 13:42:20 +0000 (14:42 +0100)] 
Merge branch 'fix_syscall_usage' of https://github.com/dengraf/util-linux

* 'fix_syscall_usage' of https://github.com/dengraf/util-linux:
  Do not include sys/syscall.h if not available

2 years agofindmnt: make sure all entries are in tree output
Karel Zak [Thu, 18 Nov 2021 13:31:38 +0000 (14:31 +0100)] 
findmnt: make sure all entries are in tree output

For example /proc/self/mountinfo when mounted in chroot environment
does not contain all nodes and parent-child relation is not always
possible to create.

Signed-off-by: Karel Zak <kzak@redhat.com>
2 years agoDo not include sys/syscall.h if not available
David Engraf [Thu, 18 Nov 2021 13:08:35 +0000 (14:08 +0100)] 
Do not include sys/syscall.h if not available

Some platforms do not provide sys/syscall.h. The configure script already
checks for the existance of the file. Include sys/syscall.h only in case
HAVE_SYS_SYSCALL_H has been set.

2 years agolibmount: (--all) continue although /proc is not mounted
Karel Zak [Thu, 18 Nov 2021 10:47:08 +0000 (11:47 +0100)] 
libmount: (--all) continue although /proc is not mounted

Now 'mount --all' ends with error if /proc is not mounted and there is
some other entry before /proc in fstab. This commit improves this
situation and ignores all mount table related errors if the table is
empty.

This is important for situation when there is for example "/" as the
first line in fstab.

Addresses: https://github.com/util-linux/util-linux/issues/1492
Signed-off-by: Karel Zak <kzak@redhat.com>
2 years agolsblk: (adoc) improve --all description
Karel Zak [Tue, 16 Nov 2021 11:58:58 +0000 (12:58 +0100)] 
lsblk: (adoc) improve --all description

Signed-off-by: Karel Zak <kzak@redhat.com>
2 years agomount: (adoc) add hint about /proc and /sys to --all description
Karel Zak [Tue, 16 Nov 2021 09:48:32 +0000 (10:48 +0100)] 
mount: (adoc) add hint about /proc and /sys to --all description

Addresses: https://github.com/util-linux/util-linux/issues/1492
Signed-off-by: Karel Zak <kzak@redhat.com>
2 years agofsck: clear SIGCHLD inherited setting
Karel Zak [Mon, 15 Nov 2021 13:44:02 +0000 (14:44 +0100)] 
fsck: clear SIGCHLD inherited setting

Signed-off-by: Karel Zak <kzak@redhat.com>
2 years agomore: clear SIGCHLD inherited setting
Karel Zak [Mon, 15 Nov 2021 13:44:02 +0000 (14:44 +0100)] 
more: clear SIGCHLD inherited setting

Signed-off-by: Karel Zak <kzak@redhat.com>
2 years agounshare: clear SIGCHLD inherited setting
Karel Zak [Mon, 15 Nov 2021 13:44:02 +0000 (14:44 +0100)] 
unshare: clear SIGCHLD inherited setting

Signed-off-by: Karel Zak <kzak@redhat.com>
2 years agonsenter: clear SIGCHLD inherited setting
Karel Zak [Mon, 15 Nov 2021 13:44:02 +0000 (14:44 +0100)] 
nsenter: clear SIGCHLD inherited setting

Signed-off-by: Karel Zak <kzak@redhat.com>
2 years agovipw: improve child error handling
Tobias Stoeckmann [Sun, 14 Nov 2021 10:54:28 +0000 (11:54 +0100)] 
vipw: improve child error handling

Always set SIGCHLD handler to default, even if the caller of vipw has
set SIGCHLD to ignore. If SIGCHLD is ignored no zombie processes would
be created, which in turn could mean that kill is called with an already
recycled pid.

Also improved error message if child process fails.

Proof of Concept:

1. Compile nochld:
--
 #include <signal.h>
 #include <unistd.h>
 int main(void) {
char *argv[] = { "vipw", NULL };
signal(SIGCHLD, SIG_IGN);
execvp("vipw", argv);
return 1;
 }
--
2. Run nochld
3. Suspend child vi, which suspends vipw too:
`kill -STOP childpid`
4. Kill vi:
`kill -9 childpid`
5. You can see with ps that childpid is no zombie but disappeared
6. Bring vipw back into foreground
`fg`
7. See misleading warning message

You will get an improperly formatted warning message. Also the wake up
kill call sent SIGCONT to "childpid" which could have been assigned
to another process already.

This is definitely not a vulnerability. It would take super user
operations, at which point an attacker would have already elevated
permissions.

Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
2 years agoMerge branch 'nsenter-all-avoid-entering-nonexisting-ns' of https://github.com/Jongy...
Karel Zak [Fri, 12 Nov 2021 14:18:22 +0000 (15:18 +0100)] 
Merge branch 'nsenter-all-avoid-entering-nonexisting-ns' of https://github.com/Jongy/util-linux

* 'nsenter-all-avoid-entering-nonexisting-ns' of https://github.com/Jongy/util-linux:
  nsenter: Do not try to enter nonexisting namespaces when --all is used

2 years agonsenter: Do not try to enter nonexisting namespaces when --all is used
Yonatan Goldschmidt [Fri, 12 Nov 2021 13:27:51 +0000 (15:27 +0200)] 
nsenter: Do not try to enter nonexisting namespaces when --all is used

This PR changes is_same_namespace() to is_usable_namespace(). If a namespace file
is missing for the running PID, then it is considered not usable and we do not try
to enter it.

Signed-off-by: Yonatan Goldschmidt <yon.goldschmidt@gmail.com>
2 years agotests: (hardlink) add info about number of files to test
Karel Zak [Fri, 12 Nov 2021 11:14:39 +0000 (12:14 +0100)] 
tests: (hardlink) add info about number of files to test

Signed-off-by: Karel Zak <kzak@redhat.com>
2 years agohardlink: add verbose messages when skip file
Karel Zak [Fri, 12 Nov 2021 10:50:41 +0000 (11:50 +0100)] 
hardlink: add verbose messages when skip file

Signed-off-by: Karel Zak <kzak@redhat.com>
2 years agoirqtop: fix options parsing
Karel Zak [Thu, 11 Nov 2021 10:35:08 +0000 (11:35 +0100)] 
irqtop: fix options parsing

Reported-by: Peter Seiderer <ps.report@gmx.net>
Signed-off-by: Karel Zak <kzak@redhat.com>
2 years agobash-completion: fix irqtop
Karel Zak [Wed, 10 Nov 2021 09:56:02 +0000 (10:56 +0100)] 
bash-completion: fix irqtop

Forgot update the option as introduced by commit
17f7caa45105f0cbf8bf9b562468fba2c5d4a549.

Signed-off-by: Karel Zak <kzak@redhat.com>
2 years agoirqtop: small coding style change
Karel Zak [Wed, 10 Nov 2021 09:50:08 +0000 (10:50 +0100)] 
irqtop: small coding style change

Signed-off-by: Karel Zak <kzak@redhat.com>
2 years agoirqtop: add -c/--cpu-stat option
zhenwei pi [Wed, 10 Nov 2021 03:16:42 +0000 (11:16 +0800)] 
irqtop: add -c/--cpu-stat option

Since a23aecc1bf("irqtop: add per-cpu stats"), irqtop always shows
per-cpu stats. Test on a modern AMD server with 2 socket(256 CPU),
irqtop shows messy output with too many columns.

In this patch, add -c/--cpu-stat option to enable/disable per-cpu stats.
And 'auto' option auto-detect window size, only show per-cpu stats
if the length of per-cpu stats is shorter than the width of window.

[kzak@redhat.com: - shorten the commit message
                  - rename --cpu to --cpu-stat
                  - use scols_table_enable_nowrap() rather than trim in irqtop.c
                  - reduce --help for the new option]

Signed-off-by: zhenwei pi <pizhenwei@bytedance.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
2 years agobash-completion: add --json to dmesg
Karel Zak [Wed, 10 Nov 2021 08:31:53 +0000 (09:31 +0100)] 
bash-completion: add --json to dmesg

Signed-off-by: Karel Zak <kzak@redhat.com>
2 years agomkswap: add --quiet
Karel Zak [Tue, 9 Nov 2021 10:08:24 +0000 (11:08 +0100)] 
mkswap: add --quiet

* add --quiet to suppress output and warning messages
* check for mutually exclusive arguments --check vs. --quiet

Fixes: https://github.com/util-linux/util-linux/issues/1499
Signed-off-by: Karel Zak <kzak@redhat.com>
2 years agoMerge branch 'sysfs_partitions' of https://github.com/Portisch/util-linux
Karel Zak [Tue, 9 Nov 2021 09:14:52 +0000 (10:14 +0100)] 
Merge branch 'sysfs_partitions' of https://github.com/Portisch/util-linux

* 'sysfs_partitions' of https://github.com/Portisch/util-linux:
  sysfs: fallback for partitions not including parent name

2 years agosysfs: fallback for partitions not including parent name
Portisch [Mon, 8 Nov 2021 11:31:39 +0000 (12:31 +0100)] 
sysfs: fallback for partitions not including parent name

2 years agoMerge branch 'travis' of https://github.com/evverx/util-linux
Karel Zak [Mon, 8 Nov 2021 15:14:12 +0000 (16:14 +0100)] 
Merge branch 'travis' of https://github.com/evverx/util-linux

* 'travis' of https://github.com/evverx/util-linux:
  ci: no longer refer to Travis CI

2 years agodmesg: add --json output format
Karel Zak [Mon, 8 Nov 2021 15:03:03 +0000 (16:03 +0100)] 
dmesg: add --json output format

Fixes: https://github.com/util-linux/util-linux/issues/1495
Signed-off-by: Karel Zak <kzak@redhat.com>
2 years agolib/jsonwrt: check if JSON handler is initialized
Karel Zak [Mon, 8 Nov 2021 14:43:30 +0000 (15:43 +0100)] 
lib/jsonwrt: check if JSON handler is initialized

Signed-off-by: Karel Zak <kzak@redhat.com>
2 years agoMerge branch 'ci-coverity' of https://github.com/evverx/util-linux
Karel Zak [Mon, 8 Nov 2021 13:25:12 +0000 (14:25 +0100)] 
Merge branch 'ci-coverity' of https://github.com/evverx/util-linux

* 'ci-coverity' of https://github.com/evverx/util-linux:
  ci: add a GHAction sending data to Coverity

2 years agosfdisk: fix typo in --move-data when check partition size
Karel Zak [Mon, 8 Nov 2021 13:01:55 +0000 (14:01 +0100)] 
sfdisk: fix typo in --move-data when check partition size

Signed-off-by: Karel Zak <kzak@redhat.com>
2 years agosfdisk: update docs, add examples to the man page
Karel Zak [Mon, 8 Nov 2021 12:53:02 +0000 (13:53 +0100)] 
sfdisk: update docs, add examples to the man page

Signed-off-by: Karel Zak <kzak@redhat.com>
2 years agolibfdisk: (script) rewrite start= and size= parsing
Karel Zak [Mon, 8 Nov 2021 12:43:44 +0000 (13:43 +0100)] 
libfdisk: (script) rewrite start= and size= parsing

* let's use the same code for both supported formats
* add support for '+,' to enlarge by start move  (see previous commit)

Signed-off-by: Karel Zak <kzak@redhat.com>
2 years agolibfdisk: enlarge partition by move start down
Karel Zak [Mon, 8 Nov 2021 12:38:45 +0000 (13:38 +0100)] 
libfdisk: enlarge partition by move start down

Now it's possible move start of the partition only when offset or
absolute value is specified. This commit implements resize to "use all
available free space before the current start".

We already support the same for end of the partition (resize to use all
free space after the partition).

Signed-off-by: Karel Zak <kzak@redhat.com>
2 years agodocs: update IRC address
Karel Zak [Mon, 8 Nov 2021 12:09:06 +0000 (13:09 +0100)] 
docs: update IRC address

Signed-off-by: Karel Zak <kzak@redhat.com>
2 years agoci: no longer refer to Travis CI
Evgeny Vereshchagin [Mon, 8 Nov 2021 04:16:56 +0000 (04:16 +0000)] 
ci: no longer refer to Travis CI

and also add a link to Coveralls coverage reports
to Documentation/howto-test to make it a little easier
to find them.

Signed-off-by: Evgeny Vereshchagin <evvers@ya.ru>
2 years agobuild-sys: disable IPC tools on Darwin
Karel Zak [Wed, 3 Nov 2021 14:09:13 +0000 (15:09 +0100)] 
build-sys: disable IPC tools on Darwin

Fixes: https://github.com/util-linux/util-linux/issues/1432
Signed-off-by: Karel Zak <kzak@redhat.com>
2 years agoci: add a GHAction sending data to Coverity
Evgeny Vereshchagin [Wed, 3 Nov 2021 06:22:17 +0000 (06:22 +0000)] 
ci: add a GHAction sending data to Coverity

To get it to work a secret named COVERITY_SCAN_TOKEN should
be added to the util-linux repository:
https://docs.github.com/en/actions/security-guides/encrypted-secrets#creating-encrypted-secrets-for-a-repository

It has to match the util-linux project token, which
can be found at
https://scan.coverity.com/projects/karelzak-util-linux?tab=project_settings

Signed-off-by: Evgeny Vereshchagin <evvers@ya.ru>
2 years agoci: build coverage reports on Coveralls
Evgeny Vereshchagin [Tue, 2 Nov 2021 15:18:19 +0000 (15:18 +0000)] 
ci: build coverage reports on Coveralls

Signed-off-by: Evgeny Vereshchagin <evvers@ya.ru>
2 years agodocs: update github URL
Karel Zak [Wed, 3 Nov 2021 12:58:21 +0000 (13:58 +0100)] 
docs: update github URL

Signed-off-by: Karel Zak <kzak@redhat.com>
2 years agocifuzz: switch to the util-linux organization
Evgeny Vereshchagin [Tue, 2 Nov 2021 16:02:16 +0000 (16:02 +0000)] 
cifuzz: switch to the util-linux organization

Signed-off-by: Evgeny Vereshchagin <evvers@ya.ru>
2 years agobuild-sys: fir distcheck for fileeq.h
Karel Zak [Tue, 2 Nov 2021 14:52:37 +0000 (15:52 +0100)] 
build-sys: fir distcheck for fileeq.h

Signed-off-by: Karel Zak <kzak@redhat.com>
2 years agobuild-sys: (meson) fix hardlink
Karel Zak [Tue, 2 Nov 2021 14:48:38 +0000 (15:48 +0100)] 
build-sys: (meson) fix hardlink

Signed-off-by: Karel Zak <kzak@redhat.com>
2 years agologin: improve coding style
Karel Zak [Tue, 2 Nov 2021 11:19:28 +0000 (12:19 +0100)] 
login: improve coding style

Signed-off-by: Karel Zak <kzak@redhat.com>
2 years agologin: Restore tty size after calling vhangup()
Daan De Meyer [Sat, 30 Oct 2021 14:56:14 +0000 (15:56 +0100)] 
login: Restore tty size after calling vhangup()

If login receives the tty to work on via stdin, stdout and stderr,
login might end up closing the remaining open file descriptors to
the tty just before it calls vhangup(). When the last open file
descriptors to a tty are closed, it's configured size is reset to
0x0. To avoid this from happening, save the size before closing
the stdin, stdout and stderr file descriptors and reapply the size
after the tty is re-opened.

Fixes #1484

2 years agoMerge branch 'mount_fuzz' of https://github.com/evverx/util-linux
Karel Zak [Mon, 1 Nov 2021 13:18:21 +0000 (14:18 +0100)] 
Merge branch 'mount_fuzz' of https://github.com/evverx/util-linux

* 'mount_fuzz' of https://github.com/evverx/util-linux:
  mount_fuzz: reject giant files early

2 years agoMerge branch 'topic/hardlink'
Karel Zak [Mon, 1 Nov 2021 11:50:33 +0000 (12:50 +0100)] 
Merge branch 'topic/hardlink'

2 years agotests: update hardlink --maximum-size
Karel Zak [Mon, 1 Nov 2021 11:49:16 +0000 (12:49 +0100)] 
tests: update hardlink --maximum-size

Signed-off-by: Karel Zak <kzak@redhat.com>
2 years agohardlink: add new option: -S/--maximum-size
Daniele Pizzolli [Mon, 11 Oct 2021 07:30:45 +0000 (09:30 +0200)] 
hardlink: add new option: -S/--maximum-size

Support limiting comparison by maximum file size.

[kzak@redhat.com: - resolve conflicts]

Signed-off-by: Daniele Pizzolli <dan+dev@toel.it>
Signed-off-by: Karel Zak <kzak@redhat.com>
2 years agohardlink: add --cache-size
Karel Zak [Mon, 1 Nov 2021 11:00:21 +0000 (12:00 +0100)] 
hardlink: add --cache-size

Signed-off-by: Karel Zak <kzak@redhat.com>
2 years agolib/fileeq: fix for small memsiz
Karel Zak [Mon, 1 Nov 2021 10:14:24 +0000 (11:14 +0100)] 
lib/fileeq: fix for small memsiz

2 years agohardlink: rename --buffer-size to --io-size
Karel Zak [Mon, 1 Nov 2021 09:46:32 +0000 (10:46 +0100)] 
hardlink: rename --buffer-size to --io-size

Addresses: https://github.com/karelzak/util-linux/pull/1467
Signed-off-by: Karel Zak <kzak@redhat.com>
2 years agomount_fuzz: reject giant files early
Evgeny Vereshchagin [Sat, 30 Oct 2021 18:09:30 +0000 (18:09 +0000)] 
mount_fuzz: reject giant files early

It should help to address https://github.com/google/oss-fuzz/issues/6703

Signed-off-by: Evgeny Vereshchagin <evvers@ya.ru>
2 years agohardlink: rewrite files content comparison
Karel Zak [Fri, 29 Oct 2021 11:42:58 +0000 (13:42 +0200)] 
hardlink: rewrite files content comparison

Example:

 # hardlink --ignore-time --dry-run /var/lib

Old version, based on memcmp(), nothing cached:

 Mode:           dry-run
 Files:          93453
 Linked:         36172 files
 Compared:       0 xattrs
 Compared:       25755615 files
 Saved:          80.11 MiB
 Duration:       204.557185 seconds

New version, --method=memcmp, 32 bytes cached:

 Mode:           dry-run
 Method:         memcmp
 Files:          93453
 Linked:         36172 files
 Compared:       0 xattrs
 Compared:       25755615 files
 Saved:          80.11 MiB
 Duration:       5.248426 seconds

New version, zero-copy (Linux crypto API), sha1, crc32 and sha256:

 Mode:           dry-run
 Method:         sha1
 Files:          93453
 Linked:         36172 files
 Compared:       0 xattrs
 Compared:       25755615 files
 Saved:          80.11 MiB
 Duration:       2.870973 seconds

 Mode:           dry-run
 Method:         crc32
 Files:          93453
 Linked:         36172 files
 Compared:       0 xattrs
 Compared:       25755615 files
 Saved:          80.11 MiB
 Duration:       2.582651 seconds

 Mode:           dry-run
 Method:         sha256
 Files:          93453
 Linked:         36172 files
 Compared:       0 xattrs
 Compared:       25755615 files
 Saved:          80.11 MiB
 Duration:       3.152825 seconds

The default is sha256 to be robust..

Signed-off-by: Karel Zak <kzak@redhat.com>
2 years agoinclude/fileeq: add functions to compare files content
Karel Zak [Fri, 29 Oct 2021 11:37:36 +0000 (13:37 +0200)] 
include/fileeq: add functions to compare files content

Signed-off-by: Karel Zak <kzak@redhat.com>
2 years agochsh: fflush stdout before reading from stdin
Lorenzo Beretta [Mon, 25 Oct 2021 13:28:02 +0000 (15:28 +0200)] 
chsh: fflush stdout before reading from stdin

Same problem as described in https://github.com/karelzak/util-linux/pull/1481

Signed-off-by: Lorenzo Beretta <vc.net.loreb@gmail.com>
2 years agochfn: flush stdout before reading stdin and fix uninitialized variable
Lorenzo Beretta [Mon, 25 Oct 2021 12:06:00 +0000 (14:06 +0200)] 
chfn: flush stdout before reading stdin and fix uninitialized variable

Same problem as described in https://github.com/karelzak/util-linux/pull/1481

Signed-off-by: Lorenzo Beretta <vc.net.loreb@gmail.com>
2 years agoMerge branch 'refactor-tests' of https://github.com/Ajchler/util-linux
Karel Zak [Mon, 25 Oct 2021 10:21:15 +0000 (12:21 +0200)] 
Merge branch 'refactor-tests' of https://github.com/Ajchler/util-linux

* 'refactor-tests' of https://github.com/Ajchler/util-linux:
  tests: split additional tests into subtests
  tests: split several tests into subtests
  tests: split test into subtest
  tests: split cal/colorw test into subtests
  tests: split cal/color test into subtests

2 years agobuild-sys: disable libmount when missing mntent.h
Karel Zak [Mon, 25 Oct 2021 09:53:55 +0000 (11:53 +0200)] 
build-sys: disable libmount when missing mntent.h

Addresses: https://github.com/karelzak/util-linux/issues/1432
Signed-off-by: Karel Zak <kzak@redhat.com>
2 years agobuild-sys: include xlocale.h for locale_t on MacOS
Karel Zak [Mon, 25 Oct 2021 09:45:46 +0000 (11:45 +0200)] 
build-sys: include xlocale.h for locale_t on MacOS

Addresses: https://github.com/karelzak/util-linux/issues/1432
Signed-off-by: Karel Zak <kzak@redhat.com>
2 years agobuild-sys: (hardlink) check for llistxattr and lgetxattr
Karel Zak [Mon, 25 Oct 2021 09:39:09 +0000 (11:39 +0200)] 
build-sys: (hardlink) check for llistxattr and lgetxattr

It seems check for sys/xattr.h is not enough. The header file exists
on MacOS, but without these functions.

Addresses: https://github.com/karelzak/util-linux/issues/1432
Signed-off-by: Karel Zak <kzak@redhat.com>
2 years agolibbuid: use _UL_LIBUUID_UUID_H to cover uuid.h
Karel Zak [Mon, 25 Oct 2021 09:26:15 +0000 (11:26 +0200)] 
libbuid: use _UL_LIBUUID_UUID_H to cover uuid.h

It seems _UUID_UUID_H is too generic.

Addresses: https://github.com/karelzak/util-linux/issues/1432
Signed-off-by: Karel Zak <kzak@redhat.com>
2 years agodocs: add hint for non-public reports
Karel Zak [Mon, 25 Oct 2021 09:15:01 +0000 (11:15 +0200)] 
docs: add hint for non-public reports

Fixes: https://github.com/karelzak/util-linux/issues/1482
Signed-off-by: Karel Zak <kzak@redhat.com>
2 years agoMerge branch 'flush' of https://github.com/ericonr/util-linux
Karel Zak [Mon, 25 Oct 2021 08:42:22 +0000 (10:42 +0200)] 
Merge branch 'flush' of https://github.com/ericonr/util-linux

* 'flush' of https://github.com/ericonr/util-linux:
  vipw: flush stdout before getting answer.

2 years agoagetty: use getttynam() if available
Ludwig Nussel [Thu, 21 Oct 2021 13:00:59 +0000 (15:00 +0200)] 
agetty: use getttynam() if available

/etc/ttys seems to be a rather archaic concept that is not meant to
exist on Linux. Nevertheless it does. glibc has getttynam() which
correctly parses /etc/ttys. So let's give it a try before falling back
to the built in defaults. One can set the terminal type for a
specific tty using e.g.:

echo 'ttyS0 "" xterm' > /etc/ttys

[kzak@redhat.com: - improve configure.ac part
                  - log error on failed strdup()]

Signed-off-by: Karel Zak <kzak@redhat.com>
2 years agoMerge branch 'uniformize-title-markups' of https://github.com/rffontenelle/util-linux
Karel Zak [Mon, 25 Oct 2021 08:23:16 +0000 (10:23 +0200)] 
Merge branch 'uniformize-title-markups' of https://github.com/rffontenelle/util-linux

* 'uniformize-title-markups' of https://github.com/rffontenelle/util-linux:
  docs: Uniformize references to section titles

2 years agovipw: flush stdout before getting answer.
Érico Nogueira [Fri, 22 Oct 2021 17:28:50 +0000 (14:28 -0300)] 
vipw: flush stdout before getting answer.

Otherwise the question is displayed only after the user presses Return,
and the program looks like it's hanging.

This happens at least on musl libc.

Reported by @loreb.

Signed-off-by: Érico Nogueira <erico.erc@gmail.com>
2 years agologger: fix --size use for stdin
Karel Zak [Thu, 21 Oct 2021 16:47:40 +0000 (18:47 +0200)] 
logger: fix --size use for stdin

The stdin version counts log header into the message size, but
for example when it reads message from argv[] it counts only message
itself.

 $ logger --stderr  --size 3 "abcd"
 <13>Oct 21 18:48:29 kzak: abc

 $ echo "abcd" | logger --stderr  --size 3
 logger: cannot allocate 18446744073709551597 bytes: Cannot allocate memory

Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=2011602
Signed-off-by: Karel Zak <kzak@redhat.com>
2 years agoRevert "logger: verify --size of large enough for message header"
Karel Zak [Thu, 21 Oct 2021 16:44:32 +0000 (18:44 +0200)] 
Revert "logger: verify --size of large enough for message header"

This reverts commit 2fdea5a26480d46ec9445b0ea17fc984f84eecc9.

2 years agobuild-sys: use set +e before patch --try in ./autogen.sh
Karel Zak [Thu, 21 Oct 2021 16:27:46 +0000 (18:27 +0200)] 
build-sys: use set +e before patch --try in ./autogen.sh

Addresses: https://github.com/karelzak/util-linux/issues/1476
Signed-off-by: Karel Zak <kzak@redhat.com>
2 years agologger: realloc buffer when header size changed
Karel Zak [Thu, 21 Oct 2021 14:00:01 +0000 (16:00 +0200)] 
logger: realloc buffer when header size changed

This is probably paranoid optimization, but when we generate a new
header we need to be sure that buffer is not smaller than calculated
maximal size of user's data.

Signed-off-by: Karel Zak <kzak@redhat.com>
2 years agologger: verify --size of large enough for message header
Karel Zak [Thu, 21 Oct 2021 13:40:41 +0000 (15:40 +0200)] 
logger: verify --size of large enough for message header

Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=2011602
Signed-off-by: Karel Zak <kzak@redhat.com>
2 years agowdctl: update man page
Karel Zak [Thu, 21 Oct 2021 13:04:33 +0000 (15:04 +0200)] 
wdctl: update man page

Addresses: https://github.com/karelzak/util-linux/issues/1475
Signed-off-by: Karel Zak <kzak@redhat.com>
2 years agowdctl: add --setpregovernor
Karel Zak [Thu, 21 Oct 2021 11:09:58 +0000 (13:09 +0200)] 
wdctl: add --setpregovernor

Addresses: https://github.com/karelzak/util-linux/issues/1475
Signed-off-by: Karel Zak <kzak@redhat.com>
2 years agowdctl: set_watchdog() refactoring
Karel Zak [Thu, 21 Oct 2021 10:38:16 +0000 (12:38 +0200)] 
wdctl: set_watchdog() refactoring

* keep wanted values in struct wd_control
* make set_watchdog() more readable

Signed-off-by: Karel Zak <kzak@redhat.com>
2 years agowdctl: print the current and available governors
Karel Zak [Thu, 21 Oct 2021 10:16:35 +0000 (12:16 +0200)] 
wdctl: print the current and available governors

 # wdctl
 ...
 Pre-timeout:    0 seconds
 Pre-timeout governor: noop
 Available pre-timeout governors: userspace noop panic
 ...

Addresses: https://github.com/karelzak/util-linux/issues/1475
Signed-off-by: Karel Zak <kzak@redhat.com>
2 years agodocs: add links to adjtime_config manpage
Karel Zak [Thu, 21 Oct 2021 09:36:44 +0000 (11:36 +0200)] 
docs: add links to adjtime_config manpage

Fixes: https://github.com/karelzak/util-linux/issues/1478
Signed-off-by: Karel Zak <kzak@redhat.com>
2 years agotests: split additional tests into subtests
Vojtěch Eichler [Tue, 19 Oct 2021 18:45:28 +0000 (20:45 +0200)] 
tests: split additional tests into subtests

2 years agobuild-sys: remove bashism
Karel Zak [Tue, 19 Oct 2021 16:54:31 +0000 (18:54 +0200)] 
build-sys: remove bashism

Addresses: https://github.com/karelzak/util-linux/issues/1476
Signed-off-by: Karel Zak <kzak@redhat.com>
2 years agotests: Fix test/misc/swaplabel failure due to change in mkswap behaviour.
Mark Hindley [Mon, 18 Oct 2021 17:53:01 +0000 (17:53 +0000)] 
tests: Fix test/misc/swaplabel failure due to change in mkswap behaviour.

mkswap now warns if the image file has holes. If fallocate is used to create the
file, use POSIX semantics to ensure the file has no holes.

This fixes the test failure

misc: swaplabel                      ... FAILED (misc/swaplabel)
========= script: /build/util-linux-2.37.2/tests/ts/misc/swaplabel =================
================= OUTPUT =====================
     1  Setting up swapspace version 1, size = 9 pages (9xPGSZ bytes)
     2  LABEL=1234567890abcde, UUID=12345678-abcd-abcd-abcd-1234567890ab
     3  LABEL: 1234567890abcde
     4  UUID:  12345678-abcd-abcd-abcd-1234567890ab
================= EXPECTED ===================
     1  Setting up swapspace version 1, size = 9 pages (9xPGSZ bytes)
     2  LABEL=1234567890abcde, UUID=12345678-abcd-abcd-abcd-1234567890ab
     3  LABEL: 1234567890abcde
     4  UUID:  12345678-abcd-abcd-abcd-1234567890ab
================= O/E diff ===================
==============================================

The additional error appears in swaplabel.err:

 mkswap: <swapfile> contains holes or other unsupported extents.
         This swap file can be rejected by kernel on swap activation!
         Use --verbose for more details.

[zeha@debian.org: this appears to be important/required when building
inside cowbuilder, on an ext3 filesystem.]

Signed-off-by: Mark Hindley <mark@hindley.org.uk>
2 years agobuild-sys: make libtool patching more robust
Karel Zak [Tue, 19 Oct 2021 08:52:10 +0000 (10:52 +0200)] 
build-sys: make libtool patching more robust

Fixes: https://github.com/karelzak/util-linux/issues/1476
Signed-off-by: Karel Zak <kzak@redhat.com>
2 years agowdctl: sysfs open refactoring
Karel Zak [Tue, 19 Oct 2021 08:11:37 +0000 (10:11 +0200)] 
wdctl: sysfs open refactoring

Let's make the sysfs handler usable in more functions.

Signed-off-by: Karel Zak <kzak@redhat.com>
2 years agowdctl: add --setpretimeout
Karel Zak [Tue, 19 Oct 2021 07:47:44 +0000 (09:47 +0200)] 
wdctl: add --setpretimeout

Addresses: https://github.com/karelzak/util-linux/issues/1475
Signed-off-by: Karel Zak <kzak@redhat.com>
2 years agoblockdev: remove accidental non-breaking spaces
Chris Hofstaedtler [Mon, 18 Oct 2021 07:40:01 +0000 (07:40 +0000)] 
blockdev: remove accidental non-breaking spaces

commit 9147d2ad8abb73cea5799323fc73ccdaf675826f introduced these
C2A0 spaces, but without saying anything. Likely this was an
accident.

Bug-Debian: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=996751
Signed-off-by: Chris Hofstaedtler <zeha@debian.org>
2 years agomcookie: fix infinite-loop when use -f
Hiroaki Sengoku [Fri, 15 Oct 2021 05:02:46 +0000 (14:02 +0900)] 
mcookie: fix infinite-loop when use -f

Signed-off-by: Karel Zak <kzak@redhat.com>
2 years agotests: split several tests into subtests
Vojtěch Eichler [Thu, 14 Oct 2021 10:33:45 +0000 (12:33 +0200)] 
tests: split several tests into subtests

2 years agobuild-sys: patch libtool.m4 for darwin
Karel Zak [Thu, 14 Oct 2021 10:17:31 +0000 (12:17 +0200)] 
build-sys: patch libtool.m4 for darwin

Fixes: https://github.com/karelzak/util-linux/issues/1468
Signed-off-by: Karel Zak <kzak@redhat.com>
2 years agotests: (logger) check for socat
Karel Zak [Thu, 14 Oct 2021 08:46:45 +0000 (10:46 +0200)] 
tests: (logger) check for socat

Addresses: https://github.com/karelzak/util-linux/issues/1466
Signed-off-by: Karel Zak <kzak@redhat.com>
2 years agosu: reset RLIMIT_AS too
Karel Zak [Thu, 14 Oct 2021 08:28:59 +0000 (10:28 +0200)] 
su: reset RLIMIT_AS too

Fixes: https://github.com/karelzak/util-linux/issues/1465
Signed-off-by: Karel Zak <kzak@redhat.com>
2 years agodocs: add note about GitHub PR
Karel Zak [Thu, 14 Oct 2021 08:22:14 +0000 (10:22 +0200)] 
docs: add note about GitHub PR

Signed-off-by: Karel Zak <kzak@redhat.com>
2 years agofindmnt: (adoc) Added section stating exit code semantics
Mister Me [Thu, 7 Oct 2021 14:34:00 +0000 (08:34 -0600)] 
findmnt: (adoc) Added section stating exit code semantics

per issue #1464:

    https://github.com/karelzak/util-linux/issues/1464

[kzak@redhat.com: - move the text from DESCRIPTION to EXIT STATUS section]

Signed-off-by: Glenn Golden <gdg@zplane.com>
Signed-off-by: Karel Zak <kzak@redhat.com>