thirdparty/util-linux.git
44 hours agolib/path: fix missing header for `struct stat` master
Patrick Steinhardt [Thu, 17 Oct 2019 06:00:31 +0000 (08:00 +0200)] 
lib/path: fix missing header for `struct stat`

In commit b1418ed14 (lib/path: add ul_path_stat(), fix absolute paths,
2019-10-15), a new function `ul_path_stat()` was added to "path.h". This
new function prototype causes a compiler warning on musl libc based
systems due to one of the parameters having the unknown type `struct
stat` due to the <sys/stat.h> header not being included.

Fix the warning by including the header.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
45 hours agoMerge branch 'master' of https://github.com/smvoss/util-linux
Karel Zak [Thu, 17 Oct 2019 09:03:16 +0000 (11:03 +0200)] 
Merge branch 'master' of https://github.com/smvoss/util-linux

* 'master' of https://github.com/smvoss/util-linux:
  wipefs: Allow explicitly enable/disablement

46 hours agomount: (man) small typo fixes
Merlin Büge [Thu, 17 Oct 2019 04:45:22 +0000 (06:45 +0200)] 
mount: (man) small typo fixes

46 hours agodocs: remove implemented TODO items
Karel Zak [Thu, 17 Oct 2019 08:54:15 +0000 (10:54 +0200)] 
docs: remove implemented TODO items

Signed-off-by: Karel Zak <kzak@redhat.com>
46 hours agologin: reduce file-descriptors cleanup overhead
Karel Zak [Thu, 17 Oct 2019 08:41:39 +0000 (10:41 +0200)] 
login: reduce file-descriptors cleanup overhead

Addresses: https://github.com/karelzak/util-linux/issues/883
Signed-off-by: Karel Zak <kzak@redhat.com>
46 hours agolib/fileutils: add close_all_fds()
Karel Zak [Thu, 17 Oct 2019 08:36:27 +0000 (10:36 +0200)] 
lib/fileutils: add close_all_fds()

The classic way which is based on file-descriptors table size is
pretty expensive (due to table size) and forces code to do many
unnecessary close() calls. It seems better to use /proc/self/fds and
close used descriptors only.

Addresses: https://github.com/karelzak/util-linux/issues/883
Signed-off-by: Karel Zak <kzak@redhat.com>
3 days agotests: (lsblk) gather also udev attributes for new dumps
Karel Zak [Tue, 15 Oct 2019 11:29:13 +0000 (13:29 +0200)] 
tests: (lsblk) gather also udev attributes for new dumps

References: 7408a5d9c2e0bb20ac0660ead16b787825ef240e
Signed-off-by: Karel Zak <kzak@redhat.com>
3 days agolsblk: read also GROUP,OWNER and MODE from dumps
Karel Zak [Tue, 15 Oct 2019 11:08:09 +0000 (13:08 +0200)] 
lsblk: read also GROUP,OWNER and MODE from dumps

Signed-off-by: Karel Zak <kzak@redhat.com>
3 days agolsblk: on --sysroot read attributes from /dev/<devname> text file
Karel Zak [Tue, 15 Oct 2019 10:36:16 +0000 (12:36 +0200)] 
lsblk: on --sysroot read attributes from /dev/<devname> text file

The option --sysroot is used to read information from dumps rather
than from the current system. This patch allows to read also udev
attributes from text file in location /sysroot/dev/<devname>. The file
is text file in format NAME=value\n.

Suggested-by: Alasdair G Kergon <agk@redhat.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
3 days agolib/path: add ul_path_stat(), fix absolute paths
Karel Zak [Tue, 15 Oct 2019 09:59:16 +0000 (11:59 +0200)] 
lib/path: add ul_path_stat(), fix absolute paths

* add ul_path_stat()

* make sure all paths for ul_path_..() functions are always
interpreted relatively to the context directory and prefix. This is
difference between ul_path_ API and standard libc "at" functions. We
do not use any exception for absolute paths. The reason is that we
need to read from prefixed paths although application assume absolute
path (/dev/sda1 means /prefix/dev/sda1 if a /prefix is defined).

Signed-off-by: Karel Zak <kzak@redhat.com>
4 days agowipefs: Allow explicitly enable/disablement
Sam Voss [Tue, 15 Oct 2019 02:19:16 +0000 (21:19 -0500)] 
wipefs: Allow explicitly enable/disablement

Currently if `--disable-all-packages` is set, there is no configure
option for re-enabling `wipefs`.

As the current default for `wipefs` is "enabled", add `--disable-` flag
to maintain backward compatibility.

Signed-off-by: Sam Voss <sam.voss@gmail.com>
7 days agolibmount: Add libselinux dependency to pkgconfig file
Masami Hiramatsu [Fri, 11 Oct 2019 07:15:35 +0000 (16:15 +0900)] 
libmount: Add libselinux dependency to pkgconfig file

Add libselinux dependency to libmount if it is compiled
with selinux support.

Without this fix, 'pkg-config --libs --static mount' doesn't
show libselinux related options.

Signed-off-by: Masami Hiramatsu <mhiramat@kernel.org>
7 days agolscpu: Add HiSilicon aarch64 tsv110 cpupart
John Garry [Tue, 8 Oct 2019 13:12:21 +0000 (21:12 +0800)] 
lscpu: Add HiSilicon aarch64 tsv110 cpupart

Add an entry for the HiSilicon aarch64 part tsv110.

Another known alias for this part is TaishanV110, and it can be
found in the Kunpeng920/Hi1620 SoC.

Signed-off-by: John Garry <john.garry@huawei.com>
7 days agonologin: Prevent error from su -c
Stanislav Brabec [Wed, 9 Oct 2019 23:08:25 +0000 (01:08 +0200)] 
nologin: Prevent error from su -c

"su -c" can pass "-c" to nologin. It causes ugly error:

su -c "echo OK" - man
-nologin: invalid option -- 'c'
Try '-nologin --help' for more information.

Accept -c to prevent this error.

Signed-off-by: Josef Cejka <jcejka@suse.com>
Signed-off-by: Stanislav Brabec <sbrabec@suse.cz>
8 days agotests: add missing 'ts_check_prog xz'
Karel Zak [Thu, 10 Oct 2019 07:07:10 +0000 (09:07 +0200)] 
tests: add missing 'ts_check_prog xz'

Signed-off-by: Karel Zak <kzak@redhat.com>
9 days agolib/pty-session: fix compilation
Karel Zak [Thu, 10 Oct 2019 06:57:30 +0000 (08:57 +0200)] 
lib/pty-session: fix compilation

lib/test_pty-monotonic.o: In function `get_boot_time':
/home/travis/build/karelzak/util-linux/lib/monotonic.c:29: undefined reference to `clock_gettime'
lib/test_pty-monotonic.o: In function `gettime_monotonic':
/home/travis/build/karelzak/util-linux/lib/monotonic.c:56: undefined reference to `clock_gettime'

Signed-off-by: Karel Zak <kzak@redhat.com>
9 days agotests: remove device name from blkdiscard output
Karel Zak [Wed, 9 Oct 2019 14:57:24 +0000 (16:57 +0200)] 
tests: remove device name from blkdiscard output

Signed-off-by: Karel Zak <kzak@redhat.com>
9 days agoscript: fix signalfd use
Karel Zak [Wed, 9 Oct 2019 14:43:50 +0000 (16:43 +0200)] 
script: fix signalfd use

It's necessary to create signal-fd before fork() to get SIGCHLD,
because child could be faster than our code.

Signed-off-by: Karel Zak <kzak@redhat.com>
9 days agoscript: add debug messages around waitpid()
Karel Zak [Wed, 9 Oct 2019 13:07:49 +0000 (15:07 +0200)] 
script: add debug messages around waitpid()

Signed-off-by: Karel Zak <kzak@redhat.com>
9 days agotests: add --parsable, remove TS_OPT_parsable
Karel Zak [Wed, 9 Oct 2019 10:57:10 +0000 (12:57 +0200)] 
tests: add --parsable, remove TS_OPT_parsable

* don't enable parsable for non-parallel executions in travis
* add --parsable to run.sh
* use --parsable rather than TS_OPT_ in travis

Signed-off-by: Karel Zak <kzak@redhat.com>
9 days agobuild-sys: cleanup prefixed used for tests
Karel Zak [Wed, 9 Oct 2019 10:31:28 +0000 (12:31 +0200)] 
build-sys: cleanup prefixed used for tests

It's ugly to use the same TS_ prefix in tests as well as in
build-system (e.g. make check), because then some env. variable can be
interpreted by our regression tests. For example TS_PARALLEL=.

It's seems better to use TS_ exclusively for tests and TESTS_ for
build-system.

Signed-off-by: Karel Zak <kzak@redhat.com>
9 days agobuild-sys: support 'none' for parallel tests
Karel Zak [Wed, 9 Oct 2019 10:01:57 +0000 (12:01 +0200)] 
build-sys: support 'none' for parallel tests

Signed-off-by: Karel Zak <kzak@redhat.com>
9 days agotravis: force non-parallel for root
Karel Zak [Wed, 9 Oct 2019 09:36:52 +0000 (11:36 +0200)] 
travis: force non-parallel for root

Signed-off-by: Karel Zak <kzak@redhat.com>
9 days agobuild-sys: fix typo
Karel Zak [Wed, 9 Oct 2019 08:02:10 +0000 (10:02 +0200)] 
build-sys: fix typo

Signed-off-by: Karel Zak <kzak@redhat.com>
9 days agotravis: don't call tests in parallel for root
Karel Zak [Wed, 9 Oct 2019 07:55:27 +0000 (09:55 +0200)] 
travis: don't call tests in parallel for root

Let's make it more readable in logs for root user.

Signed-off-by: Karel Zak <kzak@redhat.com>
10 days agoscript: cleanup logs freeing
Karel Zak [Tue, 8 Oct 2019 12:20:39 +0000 (14:20 +0200)] 
script: cleanup logs freeing

Signed-off-by: Karel Zak <kzak@redhat.com>
10 days agoscriptlive: remove unnecessary variables
Karel Zak [Mon, 7 Oct 2019 10:35:00 +0000 (12:35 +0200)] 
scriptlive: remove unnecessary variables

ul_pty code is able to do all necessary things for us, so don't waste
effort and keep the child variable in main() only.

Signed-off-by: Karel Zak <kzak@redhat.com>
10 days agolib/pty-session: simplify example/test code
Karel Zak [Mon, 7 Oct 2019 10:30:16 +0000 (12:30 +0200)] 
lib/pty-session: simplify example/test code

Signed-off-by: Karel Zak <kzak@redhat.com>
10 days agolib/pty-session: make wait_child callback optional
Karel Zak [Mon, 7 Oct 2019 10:24:43 +0000 (12:24 +0200)] 
lib/pty-session: make wait_child callback optional

Now the code is duplicate on many places, but all we usually need is to
remember child status. It seems good enough to have very simple
callback child_die() to inform application about a change.

The patch also add PID to all signal related callbacks.

Signed-off-by: Karel Zak <kzak@redhat.com>
10 days agoscript: use lib/pty-session
Karel Zak [Thu, 3 Oct 2019 12:33:25 +0000 (14:33 +0200)] 
script: use lib/pty-session

This patch consolidate pseudo-terminal stuff in util-linux. From now
there is only one implementation used in su(1) --pty, scriptlive(1)
and script(1).

The new stuff is based on the original script(1) -- it means poll()
and signalfd() based.

Note that script(1) code does not provide fallback for systems/libc
where is no openpty().

Signed-off-by: Karel Zak <kzak@redhat.com>
10 days agoscriptlive: translate error messages too
Karel Zak [Thu, 3 Oct 2019 11:28:37 +0000 (13:28 +0200)] 
scriptlive: translate error messages too

Signed-off-by: Karel Zak <kzak@redhat.com>
10 days agolib/pty-session: add loggin callback to code, follow return codes
Karel Zak [Thu, 3 Oct 2019 11:23:41 +0000 (13:23 +0200)] 
lib/pty-session: add loggin callback to code, follow return codes

Signed-off-by: Karel Zak <kzak@redhat.com>
10 days agolib/pty-session: add log callbacks
Karel Zak [Wed, 2 Oct 2019 15:34:51 +0000 (17:34 +0200)] 
lib/pty-session: add log callbacks

Signed-off-by: Karel Zak <kzak@redhat.com>
10 days agoscriptlive: add man page
Karel Zak [Wed, 2 Oct 2019 14:55:15 +0000 (16:55 +0200)] 
scriptlive: add man page

Signed-off-by: Karel Zak <kzak@redhat.com>
10 days agoscriptreplay: fix io data log use
Karel Zak [Wed, 2 Oct 2019 14:13:25 +0000 (16:13 +0200)] 
scriptreplay: fix io data log use

Signed-off-by: Karel Zak <kzak@redhat.com>
10 days agoscriptreplay: make data log file optional for --summary
Karel Zak [Wed, 2 Oct 2019 12:22:12 +0000 (14:22 +0200)] 
scriptreplay: make data log file optional for --summary

Signed-off-by: Karel Zak <kzak@redhat.com>
10 days agoscript: fix man page on --logging-format
Karel Zak [Wed, 2 Oct 2019 12:05:01 +0000 (14:05 +0200)] 
script: fix man page on --logging-format

Signed-off-by: Karel Zak <kzak@redhat.com>
10 days agolib/pty-session: improve debug messages
Karel Zak [Fri, 9 Aug 2019 08:22:27 +0000 (10:22 +0200)] 
lib/pty-session: improve debug messages

Signed-off-by: Karel Zak <kzak@redhat.com>
10 days agoscriptlive: free resource at the and
Karel Zak [Thu, 8 Aug 2019 13:36:04 +0000 (15:36 +0200)] 
scriptlive: free resource at the and

Signed-off-by: Karel Zak <kzak@redhat.com>
10 days agolib/pty: save sigmask, add API to free all resources
Karel Zak [Thu, 8 Aug 2019 13:34:00 +0000 (15:34 +0200)] 
lib/pty: save sigmask, add API to free all resources

Signed-off-by: Karel Zak <kzak@redhat.com>
10 days agosu: (pty) remove unnecessary call
Karel Zak [Thu, 8 Aug 2019 13:32:13 +0000 (15:32 +0200)] 
su: (pty) remove unnecessary call

The pty code has to save the original signal mask without application
assistance.

Signed-off-by: Karel Zak <kzak@redhat.com>
10 days agobuild-sys: fix build with pty
Karel Zak [Thu, 8 Aug 2019 13:08:14 +0000 (15:08 +0200)] 
build-sys: fix build  with pty

Signed-off-by: Karel Zak <kzak@redhat.com>
10 days agolib/pty: reset mainloop timeout on signal
Karel Zak [Wed, 31 Jul 2019 09:57:26 +0000 (11:57 +0200)] 
lib/pty: reset mainloop timeout on signal

Signed-off-by: Karel Zak <kzak@redhat.com>
10 days agoscriptreplay: add -T, --log-timing
Karel Zak [Tue, 30 Jul 2019 12:59:34 +0000 (14:59 +0200)] 
scriptreplay: add -T, --log-timing

Add alias to -t,--timing to make it easy to copy and past script(1)
comnand line to scriptlive(1) and scriptreplay(1) command lines.
For example:

record:
  $ script --log-timing tm --log-in in

print:
  $ scriptreplay --log-timing tm --log-in in

re-run:
  $ scriptlive --log-timing tm --log-in in

And command line is still the same.

Signed-off-by: Karel Zak <kzak@redhat.com>
10 days agoscriptlive: run shell in PTY
Karel Zak [Tue, 30 Jul 2019 12:32:13 +0000 (14:32 +0200)] 
scriptlive: run shell in PTY

After this change shell executed by scriptlive(1) is going to behave
like shell in script(1). It means that the shell stdin is a
pseudo-terminal rather than pipe. This allows live replay of
interactive applications, ssh sessions, etc.

Signed-off-by: Karel Zak <kzak@redhat.com>
10 days agolib/pty: allow use callback from mainloop
Karel Zak [Tue, 30 Jul 2019 12:29:20 +0000 (14:29 +0200)] 
lib/pty: allow use callback from mainloop

This allows to control mainloop behavior from PTY applications. For
example you can write to child (shell) process independently on the
current stdin.

Signed-off-by: Karel Zak <kzak@redhat.com>
10 days agoscriptreplay: (utils) detect empty steps
Karel Zak [Tue, 30 Jul 2019 12:27:51 +0000 (14:27 +0200)] 
scriptreplay: (utils) detect empty steps

Signed-off-by: Karel Zak <kzak@redhat.com>
10 days agoscriptreplay: use struct timeval for delay
Karel Zak [Mon, 29 Jul 2019 10:50:17 +0000 (12:50 +0200)] 
scriptreplay: use struct timeval for delay

* use timeval rather than double for delay
* use sys/time.h macros for wirk with timeval
* add delay normalization to script-playutils.c API

Signed-off-by: Karel Zak <kzak@redhat.com>
10 days agocript: always use decimal point numbers in logs
Karel Zak [Mon, 29 Jul 2019 10:43:06 +0000 (12:43 +0200)] 
cript: always use decimal point numbers in logs

The new header/info lines in log uses 0, but it's unexpected by
scriptreplay as there was always number formatted by %f.

Signed-off-by: Karel Zak <kzak@redhat.com>
10 days agoscript: add missing exit()
Karel Zak [Mon, 29 Jul 2019 10:10:22 +0000 (12:10 +0200)] 
script: add missing exit()

Signed-off-by: Karel Zak <kzak@redhat.com>
10 days agosu: use lib/pty-session.c code for --pty
Karel Zak [Thu, 4 Jul 2019 09:59:23 +0000 (11:59 +0200)] 
su: use lib/pty-session.c code for --pty

Signed-off-by: Karel Zak <kzak@redhat.com>
10 days agolib/pty-session: add generic PTY container code
Karel Zak [Thu, 4 Jul 2019 09:57:11 +0000 (11:57 +0200)] 
lib/pty-session: add generic PTY container code

The idea is to consolidate script(1), scriptlive(1) and su(1) --pty
and use the same code everywhere.

TODO: add callbacks for stdin/out logging (necessary for script(1)).

Signed-off-by: Karel Zak <kzak@redhat.com>
10 days agoscriptlive: add new command to re-execute script(1) typescript
Karel Zak [Tue, 2 Jul 2019 15:03:53 +0000 (17:03 +0200)] 
scriptlive: add new command to re-execute script(1) typescript

The old good scriptreplay(1) just display your recorded session, the
scriptlive(1) uses stdin typescript (from new script(1)) to execute
your commands again.

Signed-off-by: Karel Zak <kzak@redhat.com>
10 days agoscriptreplay: move all utils to script-playutils.{c,h}
Karel Zak [Mon, 1 Jul 2019 13:00:52 +0000 (15:00 +0200)] 
scriptreplay: move all utils to script-playutils.{c,h}

Signed-off-by: Karel Zak <kzak@redhat.com>
10 days agoscriptreplay: add --summary
Karel Zak [Fri, 28 Jun 2019 08:19:40 +0000 (10:19 +0200)] 
scriptreplay: add --summary

Signed-off-by: Karel Zak <kzak@redhat.com>
10 days agoscript: add more information to timing log
Karel Zak [Fri, 28 Jun 2019 08:01:29 +0000 (10:01 +0200)] 
script: add more information to timing log

Let's record also exit code, duration and start time.

Signed-off-by: Karel Zak <kzak@redhat.com>
10 days agoscriptreplay: check for EOF
Karel Zak [Fri, 28 Jun 2019 08:00:53 +0000 (10:00 +0200)] 
scriptreplay: check for EOF

Signed-off-by: Karel Zak <kzak@redhat.com>
10 days agoscript: cleanup info logging
Karel Zak [Thu, 27 Jun 2019 12:02:47 +0000 (14:02 +0200)] 
script: cleanup info logging

Signed-off-by: Karel Zak <kzak@redhat.com>
10 days agoscriptreplay: print info and signals
Karel Zak [Wed, 26 Jun 2019 15:32:49 +0000 (17:32 +0200)] 
scriptreplay: print info and signals

Signed-off-by: Karel Zak <kzak@redhat.com>
10 days agoscript: log additional information
Karel Zak [Wed, 26 Jun 2019 15:32:18 +0000 (17:32 +0200)] 
script: log additional information

Signed-off-by: Karel Zak <kzak@redhat.com>
10 days agoinclude/strutils: add strrealloc()
Karel Zak [Wed, 26 Jun 2019 14:47:24 +0000 (16:47 +0200)] 
include/strutils: add strrealloc()

10 days agoscriptreplay: make sure timing file specified
Karel Zak [Wed, 26 Jun 2019 10:27:34 +0000 (12:27 +0200)] 
scriptreplay: make sure timing file specified

Signed-off-by: Karel Zak <kzak@redhat.com>
10 days agoscript: write signals to timing file
Karel Zak [Mon, 24 Jun 2019 10:45:44 +0000 (12:45 +0200)] 
script: write signals to timing file

Signed-off-by: Karel Zak <kzak@redhat.com>
10 days 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>
10 days 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>
10 days 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>
10 days 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>
10 days 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>
10 days 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>
10 days 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>
10 days 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>
10 days 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>
10 days 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>
10 days 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>
10 days 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>
10 days 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>
10 days 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>
10 days 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>
10 days 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>
10 days 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>
10 days 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>
10 days 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>
10 days 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>
10 days 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>
10 days 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>
10 days 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>
10 days 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>
11 days 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>
11 days 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)

2 weeks 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.

2 weeks 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>
2 weeks 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>
2 weeks 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>
2 weeks 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>
2 weeks 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>
2 weeks 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>
2 weeks 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>
2 weeks 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

2 weeks 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.

2 weeks 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