]> git.ipfire.org Git - thirdparty/util-linux.git/log
thirdparty/util-linux.git
4 years agoscriptreplay: add --stream to the man page
Karel Zak [Thu, 20 Jun 2019 11:19:56 +0000 (13:19 +0200)] 
scriptreplay: add --stream to the man page

Signed-off-by: Karel Zak <kzak@redhat.com>
4 years agoscriptreplay: add --cr-mode
Karel Zak [Thu, 20 Jun 2019 11:08:00 +0000 (13:08 +0200)] 
scriptreplay: add --cr-mode

The stdin log does not contain line breaks as command line uses CR
between commands. This makes scriptreplay for stdin very
user-unfriendly, because it overwrites still the same line.

The new option --cr-mode provides opportunity to control this
behavior. The default for stdin logs is replace CR with line-break.

Signed-off-by: Karel Zak <kzak@redhat.com>
4 years agoscriptreplay: (man) add missing --log-* oprions
Karel Zak [Thu, 20 Jun 2019 10:48:21 +0000 (12:48 +0200)] 
scriptreplay: (man) add missing --log-* oprions

Signed-off-by: Karel Zak <kzak@redhat.com>
4 years agoscriptreplay: fix error path
Karel Zak [Thu, 20 Jun 2019 10:00:07 +0000 (12:00 +0200)] 
scriptreplay: fix error path

Signed-off-by: Karel Zak <kzak@redhat.com>
4 years agoscriptreplay: add --stream
Karel Zak [Thu, 20 Jun 2019 09:52:13 +0000 (11:52 +0200)] 
scriptreplay: add --stream

Let's allow to specify stream, default to entry type according to the
command line options.

Signed-off-by: Karel Zak <kzak@redhat.com>
4 years agoscript: default to new format when new features expected
Karel Zak [Thu, 20 Jun 2019 09:50:15 +0000 (11:50 +0200)] 
script: default to new format when new features expected

The old format should be the default for stdout only.

Signed-off-by: Karel Zak <kzak@redhat.com>
4 years agoscriptreplay: add --log-{in,out,io} options
Karel Zak [Thu, 20 Jun 2019 08:45:14 +0000 (10:45 +0200)] 
scriptreplay: add --log-{in,out,io} options

Signed-off-by: Karel Zak <kzak@redhat.com>
4 years agoscriptreplay: cleanup usage()
Karel Zak [Wed, 19 Jun 2019 13:56:58 +0000 (15:56 +0200)] 
scriptreplay: cleanup usage()

Signed-off-by: Karel Zak <kzak@redhat.com>
4 years agoscript: add --logging-format
Karel Zak [Wed, 19 Jun 2019 13:47:44 +0000 (15:47 +0200)] 
script: add --logging-format

Signed-off-by: Karel Zak <kzak@redhat.com>
4 years agoscript: add note about --log-in and passwords
Karel Zak [Wed, 19 Jun 2019 11:05:46 +0000 (13:05 +0200)] 
script: add note about --log-in and passwords

Signed-off-by: Karel Zak <kzak@redhat.com>
4 years agoscript: make --help more readable
Karel Zak [Wed, 19 Jun 2019 10:55:02 +0000 (12:55 +0200)] 
script: make --help more readable

Signed-off-by: Karel Zak <kzak@redhat.com>
4 years agoscriptreplay: skip unwanted steps
Karel Zak [Tue, 23 Apr 2019 15:07:50 +0000 (17:07 +0200)] 
scriptreplay: skip unwanted steps

Signed-off-by: Karel Zak <kzak@redhat.com>
4 years agoscript: add multistream timing file initialization
Karel Zak [Tue, 23 Apr 2019 15:06:29 +0000 (17:06 +0200)] 
script: add multistream timing file initialization

Signed-off-by: Karel Zak <kzak@redhat.com>
4 years agoscriptreplay: rewrite to support new timing file format
Karel Zak [Tue, 23 Apr 2019 12:41:20 +0000 (14:41 +0200)] 
scriptreplay: rewrite to support new timing file format

* add internal support for multiple log files
* add support for new timing file format (default is old format)

Signed-off-by: Karel Zak <kzak@redhat.com>
4 years agoscript: remove unused variable
Karel Zak [Thu, 18 Apr 2019 11:21:05 +0000 (13:21 +0200)] 
script: remove unused variable

Signed-off-by: Karel Zak <kzak@redhat.com>
4 years agoscript: support multi-stream logging
Karel Zak [Fri, 12 Apr 2019 14:27:54 +0000 (16:27 +0200)] 
script: support multi-stream logging

* allow to use --log-in <infile> and --log-out <outfile> in the same time
* add --log-io <file> to log stdout and stdin to the one log file
* introduce a new timing file format with entry type identifirs

   I <delay> <size>   : info about input stream
   O <delay> <size>   : info about output stream

in the next commits it's possible to add 'S' for signals and 'H' for
extra (header) information.

* the new file format is optional and enabled only if multiple streams
  logging is requested.

Signed-off-by: Karel Zak <kzak@redhat.com>
4 years agoscript: add --log-in
Karel Zak [Fri, 12 Apr 2019 12:14:55 +0000 (14:14 +0200)] 
script: add --log-in

Let's allow to log input independently on output. So it's possible to

 script --log-in infile           : logs only input
 script --log-out outfile           : logs only output
 script --log-out outfile --log-in infile : logs both to separated files

Signed-off-by: Karel Zak <kzak@redhat.com>
4 years agoscript: add option --log-timing
Karel Zak [Fri, 12 Apr 2019 10:47:03 +0000 (12:47 +0200)] 
script: add option --log-timing

The current -t[=<file>] is pretty messy due to optional <file>
argument; and default is to output to stderr. The default output to
stderr is very unusual semantic. This path makes the old -t
deprecated.

The new option -T, --log-timing requires the file name.

Signed-off-by: Karel Zak <kzak@redhat.com>
4 years agoscript: add option --log-out
Karel Zak [Fri, 12 Apr 2019 10:13:08 +0000 (12:13 +0200)] 
script: add option --log-out

Let's make script(1) command line more explicit about typescript file.

Signed-off-by: Karel Zak <kzak@redhat.com>
4 years agoscript: cleanup usage
Karel Zak [Fri, 12 Apr 2019 09:53:29 +0000 (11:53 +0200)] 
script: cleanup usage

Signed-off-by: Karel Zak <kzak@redhat.com>
4 years agoscript: allow to use the same log for more streams
Karel Zak [Fri, 12 Apr 2019 09:40:52 +0000 (11:40 +0200)] 
script: allow to use the same log for more streams

The plan (for the next commits) is to use for example timing file for
stdin as well as for stdout.

Signed-off-by: Karel Zak <kzak@redhat.com>
4 years agoscript: report also timing file, do it only once
Karel Zak [Wed, 3 Apr 2019 14:51:18 +0000 (16:51 +0200)] 
script: report also timing file, do it only once

Signed-off-by: Karel Zak <kzak@redhat.com>
4 years agoscript: make optional argument more robust
Karel Zak [Wed, 3 Apr 2019 14:36:43 +0000 (16:36 +0200)] 
script: make optional argument more robust

Signed-off-by: Karel Zak <kzak@redhat.com>
4 years agoscript: log file usage refactoring
Karel Zak [Wed, 3 Apr 2019 14:32:41 +0000 (16:32 +0200)] 
script: log file usage refactoring

This commit does not add any new feature. It just prepare code for
future extensions only.

* introduce two new structs: script_stream and script_log
* define two streams: 'stdout' and 'stdin'
* allow associate log files (type script or timing file) with the stream
* support more log file formats

Signed-off-by: Karel Zak <kzak@redhat.com>
4 years agohwclock: report rtc open() errors on --verbose
Karel Zak [Mon, 7 Oct 2019 10:57:43 +0000 (12:57 +0200)] 
hwclock: report rtc open() errors on --verbose

Let's be more verbose and provide real open() error to make
debugging easier on --verbose.

For example:

$ hwclock --verbose
hwclock from util-linux 2.34.193-6bebea-dirty
System Time: 1570445823.701266
Trying to open: /dev/rtc0
hwclock: cannot open /dev/rtc0: Permission denied          <---
No usable clock interface found.
hwclock: Cannot access the Hardware Clock via any known method.

Addresses: https://github.com/karelzak/util-linux/issues/879
Signed-off-by: Karel Zak <kzak@redhat.com>
4 years agoMerge branch 'for-upstream/more-pseudofs' of https://github.com/dlitz/util-linux
Karel Zak [Mon, 7 Oct 2019 10:41:32 +0000 (12:41 +0200)] 
Merge branch 'for-upstream/more-pseudofs' of https://github.com/dlitz/util-linux

* 'for-upstream/more-pseudofs' of https://github.com/dlitz/util-linux:
  libmount: Recognize more FUSE pseudofs (avfsd, lxcfs, vmware-vmblock)

4 years agopo/update-potfiles: fallback to `find` when git doesn't work
Jan Chren (rindeal) [Fri, 4 Oct 2019 14:40:49 +0000 (16:40 +0200)] 
po/update-potfiles: fallback to `find` when git doesn't work

It allows to run po/update-potfiles not only in tarballs
and git repositories, but in git snapshots as well.

4 years agolibmount: Recognize more FUSE pseudofs (avfsd, lxcfs, vmware-vmblock)
Darsey Litzenberger [Thu, 3 Oct 2019 00:29:05 +0000 (17:29 -0700)] 
libmount: Recognize more FUSE pseudofs (avfsd, lxcfs, vmware-vmblock)

General info about these filesystems:

* fuse.avfsd: https://sourceforge.net/projects/avf/
* fuse.lxcfs: https://linuxcontainers.org/lxcfs/
* fuse.vmware-vmblock: https://github.com/vmware/open-vm-tools

Signed-off-by: Darsey Litzenberger <dlitz@dlitz.net>
4 years agodocs: add sfdisk --dump and --backup improvements to TODO
Karel Zak [Tue, 1 Oct 2019 11:17:03 +0000 (13:17 +0200)] 
docs: add sfdisk --dump and --backup improvements to TODO

Addresses: https://github.com/karelzak/util-linux/issues/850
Addresses: https://github.com/karelzak/util-linux/issues/852
Signed-off-by: Karel Zak <kzak@redhat.com>
4 years agocleanup: Remove some spurious spaces
Elliott Mitchell [Wed, 28 Aug 2019 23:25:57 +0000 (16:25 -0700)] 
cleanup: Remove some spurious spaces

Sorry detail-oriented people tend to wipe these out if they notice them.
Add in automated tools and lots of excess end-of-line spaces get wiped
out.

Addresses: https://github.com/karelzak/util-linux/pull/849
Signed-off-by: Karel Zak <kzak@redhat.com>
4 years agolibfdisk: (gpt) fix hybrid MBR detection, fix 'w'
Karel Zak [Tue, 1 Oct 2019 10:51:04 +0000 (12:51 +0200)] 
libfdisk: (gpt) fix hybrid MBR detection, fix 'w'

* current code overwrites hybrid MBR because EE partition
  is expected from fist sector, this is not true for hybrid MBR

* print "The partition table has been altered." message also for
  nested contexts

* remove "You have to sync the MBR manually" message

Addresses: https://github.com/karelzak/util-linux/issues/851
Signed-off-by: Karel Zak <kzak@redhat.com>
4 years agofdisk: Correct handling of hybrid MBR
Elliott Mitchell [Thu, 29 Aug 2019 03:12:50 +0000 (20:12 -0700)] 
fdisk: Correct handling of hybrid MBR

The traditional MBR has pretty well NO limitations on slices.  They can
be a single misaligned sector if desired.  While this is undesireable
for most real world uses, for the few places they're still used extra
limitations cause breakage not safety.

Signed-off-by: Karel Zak <kzak@redhat.com>
4 years agofdisk: use 'r' to return from MBR to GPT
Karel Zak [Mon, 30 Sep 2019 11:11:17 +0000 (13:11 +0200)] 
fdisk: use 'r' to return from MBR to GPT

The current code uses 'M' to switch between MBR and GPT, but it's not
intuitive to "go back" by 'M'. It seems more user-friendly to use 'r'
as in another places (for example when go from expert menu or from BRD
menu).

The 'M' to return to GPT is still supported for backward compatibility.

Addresses: https://github.com/karelzak/util-linux/pull/849
Signed-off-by: Karel Zak <kzak@redhat.com>
4 years agosfdisk: (move-data) improve MiB/s progress bar
Karel Zak [Mon, 30 Sep 2019 10:25:17 +0000 (12:25 +0200)] 
sfdisk: (move-data) improve MiB/s progress bar

Signed-off-by: Karel Zak <kzak@redhat.com>
4 years agoMerge branch 'master' of https://github.com/dsd/util-linux
Karel Zak [Mon, 30 Sep 2019 09:15:57 +0000 (11:15 +0200)] 
Merge branch 'master' of https://github.com/dsd/util-linux

* 'master' of https://github.com/dsd/util-linux:
  libblkid: improve handling of ISO files with partition tables

4 years agoMerge branch 'nproc' of https://github.com/mator/util-linux
Karel Zak [Mon, 30 Sep 2019 09:12:35 +0000 (11:12 +0200)] 
Merge branch 'nproc' of https://github.com/mator/util-linux

* 'nproc' of https://github.com/mator/util-linux:
  Don't use `nproc --all` for getting cpu number. For example below, sparc64 is reporting 128 as a total, but only 32 is online. So use only online cpus for tests parallel runs.

4 years agoMerge branch 'non-canonical-completion' of https://github.com/kevinoid/util-linux
Karel Zak [Mon, 30 Sep 2019 09:06:09 +0000 (11:06 +0200)] 
Merge branch 'non-canonical-completion' of https://github.com/kevinoid/util-linux

* 'non-canonical-completion' of https://github.com/kevinoid/util-linux:
  bash-completion: Add non-canonical device fallback
  bash-completion: Add fallback for symlinks/images
  bash-completion: Standardize fsck/mkfs file/device

4 years agodocs: fix mixtyped constant.
Andrius Štikonas [Mon, 23 Sep 2019 21:22:48 +0000 (22:22 +0100)] 
docs: fix mixtyped constant.

Signed-off-by: Andrius Štikonas <andrius@stikonas.eu>
4 years agochsh: replace getpw unsafe functions with xgetpw
Quentin Rameau [Sat, 21 Sep 2019 18:50:21 +0000 (20:50 +0200)] 
chsh: replace getpw unsafe functions with xgetpw

4 years agolib/pwdutils: add xgetpwuid
Quentin Rameau [Sat, 21 Sep 2019 18:50:20 +0000 (20:50 +0200)] 
lib/pwdutils: add xgetpwuid

4 years agosfdisk: (man) add note about interactive mode)
Karel Zak [Tue, 17 Sep 2019 09:06:08 +0000 (11:06 +0200)] 
sfdisk: (man) add note about interactive mode)

Signed-off-by: Karel Zak <kzak@redhat.com>
4 years agolibblkid: improve handling of ISO files with partition tables
Daniel Drake [Tue, 24 Sep 2019 09:46:16 +0000 (17:46 +0800)] 
libblkid: improve handling of ISO files with partition tables

The ISO format specifically leaves the first 32kb blank so that it
can be used for other purposes, such as adding a partition table.
This is commonly used (e.g. by Endless and Fedora installation media) to
have partition 0 starting at sector 0 as a mountable iso9660 filesystem,
followed by more partitions (e.g. an EFI system partition).
Such layouts can be easily created by tools such as xorriso.

When plugging in a USB disk flashed with this type of ISO, blkid presents
a somewhat confusing view of the block devices. Taking the example of
a 'sda' disk with two partitions:
 1. The "iso partition"
 2. An unformatted partition

In such a setup, before the changes here, blkid will currently report the
ISO metadata attributes ID_FS_PUBLISHER_ID, ID_FS_UUID, ID_FS_LABEL, and
ID_FS_TYPE=iso9660 on both sda *and* sda1.

Since sda2 is unformatted, it won't have any ID_FS_ attributes of it's
own. And due to the following standard udev rule:

  # for partitions import parent information
  ENV{DEVTYPE}=="partition", IMPORT{parent}="ID_*"

sda2 will actually import all of the ID_FS_ stuff from the parent device
sda.

The result at this point is that three udev devices all have the same
ID_FS_ attribute values, leading to strange results such as three
devices all racing to own the link in /dev/disk/by-uuid, so you can't
reliably do a mount-by-UUID.

Clean up this situation by detecting such partitioned ISO disks
in the superblock probing setup. If files of this kind are detected,
we now only expose the ISO metadata attributes on the specific partition
that points to the ISO data (and not the parent disk).

Signed-off-by: Daniel Drake <drake@endlessm.com>
4 years agoDon't use `nproc --all` for getting cpu number. For example below,
Anatoly Pugachev [Tue, 24 Sep 2019 15:15:33 +0000 (18:15 +0300)] 
Don't use `nproc --all` for getting cpu number. For example below,
sparc64 is reporting 128 as a total, but only 32 is online. So use only
online cpus for tests parallel runs.

$ nproc
32

$ nproc --all
128

$ lscpu
Architecture:        sparc64
CPU op-mode(s):      32-bit, 64-bit
Byte Order:          Big Endian
CPU(s):              32
On-line CPU(s) list: 0-31
Thread(s) per core:  8
Core(s) per socket:  4
Socket(s):           1
Model name:          UltraSparc T5 (Niagara5)
Flags:               sun4v

Signed-off-by: Anatoly Pugachev <matorola@gmail.com>
4 years agoMerge branch 'next' of https://github.com/rskvaril/util-linux
Karel Zak [Sun, 22 Sep 2019 12:05:18 +0000 (14:05 +0200)] 
Merge branch 'next' of https://github.com/rskvaril/util-linux

* 'next' of https://github.com/rskvaril/util-linux:
  tests: lscpu s390 nested virtualization

4 years agotests: lscpu s390 nested virtualization
Radka Skvarilova [Sun, 22 Sep 2019 11:49:45 +0000 (13:49 +0200)] 
tests: lscpu s390 nested virtualization

Signed-off-by: Radka Skvarilova <rskvaril@redhat.com>
Addresses:https://bugzilla.redhat.com/show_bug.cgi?id=1739443

4 years agodocs: update howto-tests.txt
Karel Zak [Sun, 22 Sep 2019 11:39:40 +0000 (13:39 +0200)] 
docs: update howto-tests.txt

Signed-off-by: Karel Zak <kzak@redhat.com>
4 years agolibmount: fix free() call on error
Karel Zak [Sat, 21 Sep 2019 09:16:34 +0000 (11:16 +0200)] 
libmount: fix free() call on error

Signed-off-by: Karel Zak <kzak@redhat.com>
4 years agohexdump: add header file guards [lgtm scan]
Karel Zak [Fri, 20 Sep 2019 14:13:52 +0000 (16:13 +0200)] 
hexdump: add header file guards [lgtm scan]

Signed-off-by: Karel Zak <kzak@redhat.com>
4 years agoterm-utils: add header file guards [lgtm scan]
Karel Zak [Fri, 20 Sep 2019 14:12:34 +0000 (16:12 +0200)] 
term-utils: add header file guards [lgtm scan]

Signed-off-by: Karel Zak <kzak@redhat.com>
4 years agologin-utils: add header file guards [lgtm scan]
Karel Zak [Fri, 20 Sep 2019 14:10:43 +0000 (16:10 +0200)] 
login-utils: add header file guards [lgtm scan]

Signed-off-by: Karel Zak <kzak@redhat.com>
4 years agolibuuid: add header file guard [lgtm scan]
Karel Zak [Fri, 20 Sep 2019 14:06:00 +0000 (16:06 +0200)] 
libuuid: add header file guard [lgtm scan]

Signed-off-by: Karel Zak <kzak@redhat.com>
4 years agoinclude/all-io: remove unnecessary condition [lgtm scan]
Karel Zak [Fri, 20 Sep 2019 14:00:13 +0000 (16:00 +0200)] 
include/all-io: remove unnecessary condition [lgtm scan]

Signed-off-by: Karel Zak <kzak@redhat.com>
4 years agofsfreeze: remove unnecessary condition [lgtm scan]
Karel Zak [Fri, 20 Sep 2019 13:57:31 +0000 (15:57 +0200)] 
fsfreeze: remove unnecessary condition [lgtm scan]

Signed-off-by: Karel Zak <kzak@redhat.com>
4 years agolibblkid: remove unnecessary condition [lgtm scan]
Karel Zak [Fri, 20 Sep 2019 13:52:34 +0000 (15:52 +0200)] 
libblkid: remove unnecessary condition [lgtm scan]

Signed-off-by: Karel Zak <kzak@redhat.com>
4 years agomkswap: cast before lseek [lgtm scan]
Karel Zak [Fri, 20 Sep 2019 13:47:55 +0000 (15:47 +0200)] 
mkswap: cast before lseek [lgtm scan]

Signed-off-by: Karel Zak <kzak@redhat.com>
4 years agofdformat: cast before lseek [lgtm scan]
Karel Zak [Fri, 20 Sep 2019 13:45:15 +0000 (15:45 +0200)] 
fdformat: cast before lseek [lgtm scan]

Signed-off-by: Karel Zak <kzak@redhat.com>
4 years agolibfdisk: (bsd) cast before ask [lgtm scan]
Karel Zak [Fri, 20 Sep 2019 13:43:12 +0000 (15:43 +0200)] 
libfdisk: (bsd) cast before ask [lgtm scan]

Signed-off-by: Karel Zak <kzak@redhat.com>
4 years agolibfdisk: (gpt) cast number of entries [lgtm scan]
Karel Zak [Fri, 20 Sep 2019 13:40:14 +0000 (15:40 +0200)] 
libfdisk: (gpt) cast number of entries [lgtm scan]

Signed-off-by: Karel Zak <kzak@redhat.com>
4 years agobuild-sys: fix UTIL_LINUX_PT_SGI_H macro [lgtm scan]
Karel Zak [Fri, 20 Sep 2019 13:31:31 +0000 (15:31 +0200)] 
build-sys: fix UTIL_LINUX_PT_SGI_H macro [lgtm scan]

Signed-off-by: Karel Zak <kzak@redhat.com>
4 years agolibmount: use fmemopen() in more robust way [coverity scan]
Karel Zak [Fri, 20 Sep 2019 11:00:19 +0000 (13:00 +0200)] 
libmount: use fmemopen() in more robust way [coverity scan]

Signed-off-by: Karel Zak <kzak@redhat.com>
4 years agobash-completion: Add non-canonical device fallback
Kevin Locke [Thu, 19 Sep 2019 13:45:54 +0000 (07:45 -0600)] 
bash-completion: Add non-canonical device fallback

It is desirable for bash-completion to complete block devices via
symlinks (e.g. under /dev/disk) and with non-canonical locations (e.g.
./sda if $PWD is /dev, and /chroot/dev/sda).

Unfortunately, this is a non-trivial task due to how bash-completion
works.  It is necessary to un-escape the last partial argument, search,
then escape the results, ideally handling tilde and variable
expansion/completion.  See [_get_comp_words_by_ref] and [_filedir] in
the bash-completion project for details.

Given the development costs of a complete and correct implementation,
the annoyance/frustration which would result from an incomplete/buggy
implementation, and the trade-offs between under- and over-completion,
this commit adds fallback to bash default completion if the argument
does not match any canonical device names.  This correctly completes in
the cases mentioned above, although it incorrectly completes on
non-block-device files as well.

[_filedir]: https://github.com/scop/bash-completion/blob/2.9/bash_completion#L552
[_get_comp_words_by_ref]: https://github.com/scop/bash-completion/blob/2.9/bash_completion#L365

Signed-off-by: Kevin Locke <kevin@kevinlocke.name>
4 years agobash-completion: Add fallback for symlinks/images
Kevin Locke [Thu, 19 Sep 2019 13:40:13 +0000 (07:40 -0600)] 
bash-completion: Add fallback for symlinks/images

For commands which support operating on files (i.e. disk images), it is
desirable for bash-completion to complete matching file names.  It is
also desirable to complete on block device symlinks (e.g. under
/dev/disk).  To complete common use cases, often on canonical device
names, continue to try completion using canonical device names, then
fall back to matching any file incrementally as Bash does by default.[1]

[1]: https://github.com/karelzak/util-linux/issues/842#issuecomment-523450243

Signed-off-by: Kevin Locke <kevin@kevinlocke.name>
4 years agobash-completion: Standardize fsck/mkfs file/device
Kevin Locke [Thu, 19 Sep 2019 13:27:31 +0000 (07:27 -0600)] 
bash-completion: Standardize fsck/mkfs file/device

Some of the fsck and mkfs commands complete differently than the others,
and differently than the desired behavior.[1]  Standardize on completing
with $(lsblk -pnro name):

* fsck: Don't complete completes on all block devices and device links
  under /dev immediately (which is excessive and prone to search
  problems).
* mkfs, mkfs.bfs: Don't complete "/path/to/file" literally.  I assume
  this was copy/pasted from example code, since it does not appear to be
  a valid argument unless it is a valid path, which is rare.
* fsck.cramfs, mkfs, mkfs.bfs, mkfs.cramfs, mkswap: Don't complete on
  all filenames initially.  The desired behavior is to complete
  filenames only if there are no canonical matches.[1]

Note: A subsequent commit will add the desired fallback behavior.

[1]: https://github.com/karelzak/util-linux/issues/842#issuecomment-523450243

Signed-off-by: Kevin Locke <kevin@kevinlocke.name>
4 years agoMerge branch 'typos' of https://github.com/kerolasa/util-linux
Karel Zak [Mon, 16 Sep 2019 10:38:43 +0000 (12:38 +0200)] 
Merge branch 'typos' of https://github.com/kerolasa/util-linux

* 'typos' of https://github.com/kerolasa/util-linux:
  bash-completion: update options
  misc: fix typos [codespell]

4 years agotests: update sfdisk dumps
Karel Zak [Mon, 16 Sep 2019 10:01:54 +0000 (12:01 +0200)] 
tests: update sfdisk dumps

Signed-off-by: Karel Zak <kzak@redhat.com>
4 years agolibfdisk: add sector-size to dump
Karel Zak [Mon, 16 Sep 2019 08:29:41 +0000 (10:29 +0200)] 
libfdisk: add sector-size to dump

We do not use sector-size from dumps to create partition tables,
because it's always necessary to use real device specific settings.

The new sector-size value is usable when you use the dump as
a description of the device or disk image.

Addresses: https://github.com/karelzak/util-linux/issues/869
Signed-off-by: Karel Zak <kzak@redhat.com>
4 years agobash-completion: update options
Sami Kerola [Thu, 12 Sep 2019 18:43:17 +0000 (19:43 +0100)] 
bash-completion: update options

unshare: cef4decf0436953031b4a8ea91a8aec89459a8fd --keep-caps
dmesg:   646bba41fd162fe1b8e303ff90914253e5fc669e --noescape

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
4 years agomisc: fix typos [codespell]
Sami Kerola [Thu, 5 Sep 2019 19:38:41 +0000 (20:38 +0100)] 
misc: fix typos [codespell]

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
4 years agoMerge branch 'sfdisk-man-page-typo' of https://github.com/mkrupcale/util-linux
Karel Zak [Thu, 12 Sep 2019 11:28:55 +0000 (13:28 +0200)] 
Merge branch 'sfdisk-man-page-typo' of https://github.com/mkrupcale/util-linux

* 'sfdisk-man-page-typo' of https://github.com/mkrupcale/util-linux:
  disk-utils: docs: fix sfdisk(8) man page typo

4 years agoblkid: (man) add note about udev to --list-one
Karel Zak [Thu, 12 Sep 2019 11:24:42 +0000 (13:24 +0200)] 
blkid: (man) add note about udev to --list-one

Addresses: https://github.com/karelzak/util-linux/issues/866
Signed-off-by: Karel Zak <kzak@redhat.com>
4 years agobuild-sys: check for linux/capability.h
Karel Zak [Thu, 12 Sep 2019 10:45:30 +0000 (12:45 +0200)] 
build-sys: check for linux/capability.h

Addresses: https://github.com/karelzak/util-linux/pull/864
Signed-off-by: Karel Zak <kzak@redhat.com>
4 years agoMerge branch 'unshare/keep-caps' of https://github.com/jpeach/util-linux
Karel Zak [Thu, 12 Sep 2019 10:29:28 +0000 (12:29 +0200)] 
Merge branch 'unshare/keep-caps' of https://github.com/jpeach/util-linux

* 'unshare/keep-caps' of https://github.com/jpeach/util-linux:
  unshare: add --keep-caps option

4 years agodisk-utils: docs: fix sfdisk(8) man page typo
Matthew Krupcale [Tue, 10 Sep 2019 21:05:22 +0000 (17:05 -0400)] 
disk-utils: docs: fix sfdisk(8) man page typo

 * disk-utils/sfdisk.8: fix typo: "ir" -> "it"

4 years agolibfdisk: (gpt) add GUID for APFS containers
Ernesto A. Fernández [Mon, 9 Sep 2019 20:59:07 +0000 (17:59 -0300)] 
libfdisk: (gpt) add GUID for APFS containers

Add the partition type GUID for the Apple File System to gpt_parttypes.

Signed-off-by: Ernesto A. Fernández <ernesto.mnd.fernandez@gmail.com>
4 years agosetterm: cleanup usage() and man page
Karel Zak [Tue, 10 Sep 2019 10:14:25 +0000 (12:14 +0200)] 
setterm: cleanup usage() and man page

usage:
 * use --option[=<argument>] to make it obvious that '=' is required
 * don't use [ ] for required arguments
 * add separators to make it more readable

man page
 * use --option=[<argument>] for optional arguments in man page
 * don't use \fI or \fB for keywords based arguments (on|off|default ...)
 * use the same style in all man page

Signed-off-by: Karel Zak <kzak@redhat.com>
4 years agosetterm: fix --clear
Karel Zak [Tue, 10 Sep 2019 09:12:38 +0000 (11:12 +0200)] 
setterm: fix --clear

* make argument optional as in the original version
* fix typo (reset -> rest)

Addresses: https://github.com/karelzak/util-linux/issues/861
Signed-off-by: Karel Zak <kzak@redhat.com>
4 years agodmesg: do not stop on \0
Karel Zak [Tue, 10 Sep 2019 08:34:01 +0000 (10:34 +0200)] 
dmesg: do not stop on \0

... but I have doubts this change fixes the issue. It seems (on my
system) that \0 is already filtered out by kernel/syslog.

Addresses: https://github.com/karelzak/util-linux/issues/862
Signed-off-by: Karel Zak <kzak@redhat.com>
4 years agounshare: add --keep-caps option
James Peach [Thu, 17 Jan 2019 22:16:54 +0000 (14:16 -0800)] 
unshare: add --keep-caps option

Add the --keep-caps option to unshare to preserve capabilities that
are granted when creating a new user namespace. This allows the child
process to retain privilege within the new user namespace without also
being UID 0.

4 years agobash-completion: (unshare) add --map-current-user
Karel Zak [Mon, 9 Sep 2019 10:58:03 +0000 (12:58 +0200)] 
bash-completion: (unshare) add --map-current-user

Signed-off-by: Karel Zak <kzak@redhat.com>
4 years agodmesg: add --noescape
Karel Zak [Mon, 9 Sep 2019 10:53:08 +0000 (12:53 +0200)] 
dmesg: add --noescape

We have no way how to print the kernel message buffer in really raw
way. The new option --noescape disables all \x<hex> translations.

Addresses: https://github.com/karelzak/util-linux/issues/858
Signed-off-by: Karel Zak <kzak@redhat.com>
4 years agoMerge branch 'unshare/map-current' of https://github.com/jpeach/util-linux
Karel Zak [Mon, 9 Sep 2019 09:31:04 +0000 (11:31 +0200)] 
Merge branch 'unshare/map-current' of https://github.com/jpeach/util-linux

* 'unshare/map-current' of https://github.com/jpeach/util-linux:
  unshare: add --map-current-user option

4 years agotests: (sfdisk) update move output
Karel Zak [Mon, 9 Sep 2019 09:27:03 +0000 (11:27 +0200)] 
tests: (sfdisk) update move output

Signed-off-by: Karel Zak <kzak@redhat.com>
4 years agounshare: add --map-current-user option
James Peach [Thu, 17 Jan 2019 22:17:54 +0000 (14:17 -0800)] 
unshare: add --map-current-user option

Add the --map-current-user option to unshare. This option maps the
current effective UID and GID in the new user namespace so that the
inner and outer credentials match.

Signed-off-by: James Peach <jpeach@apache.org>
4 years agosfdisk: (--move-data) add speed to progress bar, don't use POSIX_FADV_DONTNEED
Karel Zak [Fri, 6 Sep 2019 14:57:40 +0000 (16:57 +0200)] 
sfdisk: (--move-data) add speed to progress bar, don't use POSIX_FADV_DONTNEED

posix_fadvise() in the loop is pretty expensive.

Signed-off-by: Karel Zak <kzak@redhat.com>
4 years agosfdisk: (--move-data) add simple progress bar
Karel Zak [Fri, 6 Sep 2019 13:05:21 +0000 (15:05 +0200)] 
sfdisk: (--move-data) add simple progress bar

Addresses: https://github.com/karelzak/util-linux/issues/848
Signed-off-by: Karel Zak <kzak@redhat.com>
4 years agolibfdisk: cleanup fdisk_deassign_device() docs
Karel Zak [Fri, 6 Sep 2019 12:32:12 +0000 (14:32 +0200)] 
libfdisk: cleanup fdisk_deassign_device() docs

Signed-off-by: Karel Zak <kzak@redhat.com>
4 years agosfdisk: add --move-use-fsync, disable fsync() by default
Karel Zak [Fri, 6 Sep 2019 12:27:42 +0000 (14:27 +0200)] 
sfdisk: add --move-use-fsync, disable fsync() by default

It's slow, so slooow...

Addresses: https://github.com/karelzak/util-linux/issues/848
Signed-off-by: Karel Zak <kzak@redhat.com>
4 years agosfdisk: (--move-data) make log optional
Karel Zak [Fri, 6 Sep 2019 12:17:28 +0000 (14:17 +0200)] 
sfdisk: (--move-data) make log optional

The log may be pretty huge and very probably not used by many users.
Let's make it optional.

The patch also clean up move-data output messages.

Addresses: https://github.com/karelzak/util-linux/issues/848
Signed-off-by: Karel Zak <kzak@redhat.com>
4 years agosfdisk: (--move-data) keep step size based on optimal I/O
Karel Zak [Fri, 6 Sep 2019 11:53:50 +0000 (13:53 +0200)] 
sfdisk: (--move-data) keep step size based on optimal I/O

The current implementation is too paranoid and tries to keep in
memory only data which are on disk too. It means very small step size
when move partition only a few sectors left/right.

This patch enlarge the buffer to at least 1MiB and aligned to optimal
I/O.

Addresses: https://github.com/karelzak/util-linux/issues/848
Signed-off-by: Karel Zak <kzak@redhat.com>
4 years agolibfdisk: use grain as small as possible
Karel Zak [Fri, 6 Sep 2019 11:09:30 +0000 (13:09 +0200)] 
libfdisk: use grain as small as possible

The current implementation does not allow to move partition for
example in +/-1 sector range, because free space analyze is by default
based on regular grain used for partitioning (=1MiB).

Signed-off-by: Karel Zak <kzak@redhat.com>
4 years agosfdisk: make --no-act usable for --move-data too
Karel Zak [Fri, 6 Sep 2019 10:37:26 +0000 (12:37 +0200)] 
sfdisk: make --no-act usable for --move-data too

Signed-off-by: Karel Zak <kzak@redhat.com>
4 years agoMerge branch 'xfs-v5' of https://github.com/mator/util-linux
Karel Zak [Fri, 6 Sep 2019 08:33:45 +0000 (10:33 +0200)] 
Merge branch 'xfs-v5' of https://github.com/mator/util-linux

* 'xfs-v5' of https://github.com/mator/util-linux:
  tests: Add test for current version (v5) of XFS filesystem

4 years agotests: update sfdisk wipe output
Karel Zak [Thu, 5 Sep 2019 14:46:14 +0000 (16:46 +0200)] 
tests: update sfdisk wipe output

- stderr is used for the warning (like in fdisk)

Signed-off-by: Karel Zak <kzak@redhat.com>
4 years agofstrim: ignore non-directory mountpoints
Karel Zak [Thu, 5 Sep 2019 14:28:49 +0000 (16:28 +0200)] 
fstrim: ignore non-directory mountpoints

It seems better to silently ignore mount binds on file (= mountpoint
is not a directory).

This patch also fixes use-after-free bug from commit 402006fa6e.

Addresses: https://github.com/karelzak/util-linux/issues/857
Signed-off-by: Karel Zak <kzak@redhat.com>
4 years agofdisk: fix quit dialog for non-libreadline version
Karel Zak [Thu, 5 Sep 2019 10:34:01 +0000 (12:34 +0200)] 
fdisk: fix quit dialog for non-libreadline version

We need to clear stdin errors otherwise it returns EOF forever after
CTRL+D.

Reported-by: Lukas Czerner <lczerner@redhat.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
4 years agofdisk: make quit question more usable
Karel Zak [Thu, 5 Sep 2019 10:06:27 +0000 (12:06 +0200)] 
fdisk: make quit question more usable

Reported-by: Lukas Czerner <lczerner@redhat.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
4 years agofdisk: cleanup wipe warning
Karel Zak [Wed, 4 Sep 2019 12:51:02 +0000 (14:51 +0200)] 
fdisk: cleanup wipe warning

Let's remove 'old' from the sentence, add man page reference to
sfdisk.

Signed-off-by: Karel Zak <kzak@redhat.com>
4 years agotests: Add test for current version (v5) of XFS filesystem
Anatoly Pugachev [Tue, 3 Sep 2019 16:08:22 +0000 (19:08 +0300)] 
tests: Add test for current version (v5) of XFS filesystem

Old xfs.img cannot be used with current version (5.0) of xfsprogs, so create
a new version of xfs-v5.img.

Since I wasn't able to find logs on how was created old xfs.img, saving
create log with this commit message:

$ fallocate -l 16M xfs-v5.img
$ mkfs.xfs -L test-xfs-v5 xfs-v5.img
$ ./blkid -p -o udev xfs-v5.img | sort -V > tests/expected/blkid/low-probe-xfs-v5
$ xz -c xfs-v5.img > tests/ts/blkid/images-fs/xfs-v5.img.xz

Signed-off-by: Anatoly Pugachev <matorola@gmail.com>
4 years agosfdisk: add -J between mutually exclusive options
Karel Zak [Tue, 3 Sep 2019 14:22:21 +0000 (16:22 +0200)] 
sfdisk: add -J between mutually exclusive options

Signed-off-by: Karel Zak <kzak@redhat.com>
4 years agolibmount: fix typo
Karel Zak [Tue, 3 Sep 2019 14:18:48 +0000 (16:18 +0200)] 
libmount: fix typo

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