Commit Graph

13804 Commits

Author SHA1 Message Date
Karel Zak c2409b55a0 build-sys: introduce $sysconfstaticdir
The current situation is that distros differentiate between:

* host specific configuration -- usually /etc, maintained by admin

* distribution specific (static) configuration -- usually /usr/lib,
  maintained by ditro packages

Unfortunately autotools have clue about $sysconfdir (/etc) only. This
patch introduces $sysconfstaticdir (default $prefix/lib).

Signed-off-by: Karel Zak <kzak@redhat.com>
2019-11-12 10:09:34 +01:00
Karel Zak 390ba85c78 renice: fix arguments description in --help
The --{pid,pgrp,user} options does not have arguments.

Reported-by: Stephane Chazelas <stephane.chazelas@gmail.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
2019-11-08 11:32:18 +01:00
Karel Zak cb99f4ea79 renice: fix --help text
The option [-n] in the code has no any meaning and the value is used
as priority, not incrementally.

Reported-by: Stephane Chazelas <stephane.chazelas@gmail.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
2019-11-08 11:22:57 +01:00
Andrew Price 48bb8522fe fallocate.1: List gfs2 as supporting punch-hole
Signed-off-by: Andrew Price <anprice@redhat.com>
2019-11-08 11:18:17 +01:00
Karel Zak 68a2ade7ed hwclock: add SPDX-License-Identifier(s)
Signed-off-by: Karel Zak <kzak@redhat.com>
2019-11-08 11:12:13 +01:00
Karel Zak e98d95131f docs: add GPLv3 text
Signed-off-by: Karel Zak <kzak@redhat.com>
2019-11-08 11:10:54 +01:00
Karel Zak 7999563138 lib/timeutils: add %Y-%m-%dT%H:%M:%S to parse_timestamp()
Signed-off-by: Karel Zak <kzak@redhat.com>
2019-11-08 10:42:03 +01:00
Karel Zak 8fb945185f lib: add missing license headers
Signed-off-by: Karel Zak <kzak@redhat.com>
2019-11-08 10:40:42 +01:00
Karel Zak 4d1b9e02fc build-sys: .gitignore hwclock-parse-date.c
Signed-off-by: Karel Zak <kzak@redhat.com>
2019-11-07 10:43:46 +01:00
Karel Zak 4e36662e52 lib: add missing license headers
Signed-off-by: Karel Zak <kzak@redhat.com>
2019-11-07 09:38:06 +01:00
Karel Zak 8e1b131e0a build-sys: use parse-date() only for hwclock
The parse-date.y is used only for hwclock, let's keep it together.
Note that the file (originally from gnulib) has GPLv3 license, so it's
better to make it obvious that we use it really only for hwclock (also
GPL).

Signed-off-by: Karel Zak <kzak@redhat.com>
2019-11-07 09:02:23 +01:00
Michal Suchanek 39f5af2598 libblkid: open device in nonblock mode.
When autoclose is set (kernel default but many distributions reverse the
setting) opening a CD-rom device causes the tray to close.

The function of blkid is to report the current state of the device and
not to change it. Hence it should use O_NONBLOCK when opening the
device to avoid closing a CD-rom tray.

blkid is used liberally in scripts so it can potentially interfere with
the user operating the CD-rom hardware.

[kzak@redhat.com: add O_NONBLOCK also to:
                  - wipefs
                  - blkid_new_probe_from_filename()
                  - blkid_evaluate_tag()]

Signed-off-by: Michal Suchanek <msuchanek@suse.de>
Signed-off-by: Karel Zak <kzak@redhat.com>
2019-11-06 09:55:49 +01:00
Karel Zak b4402de7a0 tests: commit add missing file
Signed-off-by: Karel Zak <kzak@redhat.com>
2019-11-05 15:42:19 +01:00
Karel Zak be906b20f2 tests: add mount --all tests
Signed-off-by: Karel Zak <kzak@redhat.com>
2019-11-05 15:14:17 +01:00
Karel Zak 6a735c2c5b libmount: make sure optsmode is initialized
Since 34333e5244 we apply fstab options
manually by mnt_context_apply_fs() on --all. The function does not
work correctly when optsmode is zero.

Signed-off-by: Karel Zak <kzak@redhat.com>
2019-10-31 13:51:29 +01:00
Karel Zak f2cb9359c1 mount: (man) document --target-prefix
Signed-off-by: Karel Zak <kzak@redhat.com>
2019-10-31 12:25:08 +01:00
Karel Zak 34333e5244 libmount: allow use -o together with --all
For example:
	# mount --verbose --all -t xfs -o ro

will mount all all XFS filesystems from fstab, but read-only.

Signed-off-by: Karel Zak <kzak@redhat.com>
2019-10-31 12:25:08 +01:00
Karel Zak 7a56878d4b libmount: move context fs merge to separate function
Signed-off-by: Karel Zak <kzak@redhat.com>
2019-10-31 12:25:08 +01:00
Karel Zak e5d2044407 libmount: fix mnt_context_next_remount()
The current implementation works, but the remount operation is done in
the cloned context and the original context (and calling application)
has no information about the final status/errors. This is mistake.

This new implementation works like mnt_context_next_mount(), it means
the same context (as used by application) is reused for all remounts.
The original setting is restored by mnt_context_apply_template().

Signed-off-by: Karel Zak <kzak@redhat.com>
2019-10-31 12:25:08 +01:00
Karel Zak e83c09d49e libmount: save current FS setting as template
This commit adds new functions to save and reuse the current FS
setting (mount options from command line, etc) after context reset.
It's usable for example in "mount --all" when we use the same context
for more times for more mount operations.

Signed-off-by: Karel Zak <kzak@redhat.com>
2019-10-31 12:25:08 +01:00
Karel Zak 7cbde88185 libfdisk: consolidate strdup() use
Signed-off-by: Karel Zak <kzak@redhat.com>
2019-10-31 12:25:08 +01:00
Karel Zak eee7ea558c libmount: use strdup_between_structs()
Signed-off-by: Karel Zak <kzak@redhat.com>
2019-10-31 12:25:08 +01:00
Karel Zak 787226dc28 include/strutils: add strdup_between_structs()
* improve strdup_to_offset() readability

* add strdup_between_offsets() and strdup_between_structs() to have
  better support for use-cases when we copy structs

Signed-off-by: Karel Zak <kzak@redhat.com>
2019-10-31 12:25:08 +01:00
Karel Zak 779e3c97aa libmount: cleanup strdup() use in context, add reg.test
* don't ignore strdup() result
* cleanup mnt_context_prepare_helper() to have only one return point
  (due to mnt_context_switch_ns())
* add mnt_context_prepare_helper() test program

Signed-off-by: Karel Zak <kzak@redhat.com>
2019-10-31 12:25:08 +01:00
Karel Zak b231e0f71c mount: add --target-prefix
Signed-off-by: Karel Zak <kzak@redhat.com>
2019-10-31 12:25:08 +01:00
Karel Zak 71ed3b8337 libmount: add target prefix support
* add set/get functions to context
* use prefix to detect already mounted filesystems
* use prefix when prepare target path

Signed-off-by: Karel Zak <kzak@redhat.com>
2019-10-31 12:25:08 +01:00
Karel Zak eea06b92dc lsblk: never fallback to udev/blkid on --sysroot
Signed-off-by: Karel Zak <kzak@redhat.com>
2019-10-29 13:12:18 +01:00
Karel Zak 05842a92d8 libmount: don't use /proc/mounts fallback if filename specified
The current solution is to use /proc/mounts if previous attempt to
open /proc/self/mountinfo failed. The fallback should not be used when
mount table path is explicitly specified by application. The default
is NULL, only in this case libmount should be try to be smart.

Reported-by: Alasdair G Kergon <agk@redhat.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
2019-10-29 12:59:08 +01:00
Karel Zak bdc3cc65ab su: fix error message
Reported-by: Pedro Albuquerque <palbuquerque73@gmail.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
2019-10-29 10:04:29 +01:00
Karel Zak c07c41cd5f Merge branch 'blkid-sparc' of https://github.com/mator/util-linux
* 'blkid-sparc' of https://github.com/mator/util-linux:
  tests: fixes blkid/md-raidX-whole on Sparc
2019-10-23 13:14:45 +02:00
Anatoly Pugachev a43665128c tests: fixes blkid/md-raidX-whole on Sparc
Since SPARC is using 'sun' partition table by default, make test not to
assume that disk has 'dos' partition table, so write 'dos' partition
table on disk, before proceeding any further.

Signed-off-by: Anatoly Pugachev <matorola@gmail.com>
2019-10-23 11:26:19 +03:00
Vladimir Slavik 2bbc962288 lsblk: update man description of -f / --fs for current columns
see lsblk.c line 1930
2019-10-17 13:51:02 +02:00
Patrick Steinhardt b2a1a69155 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>
2019-10-17 12:46:33 +02:00
Karel Zak c8a5422a7a Merge branch 'master' of https://github.com/smvoss/util-linux
* 'master' of https://github.com/smvoss/util-linux:
  wipefs: Allow explicitly enable/disablement
2019-10-17 11:03:16 +02:00
Merlin Büge b2de475c67 mount: (man) small typo fixes 2019-10-17 11:01:13 +02:00
Karel Zak 43db339b9a docs: remove implemented TODO items
Signed-off-by: Karel Zak <kzak@redhat.com>
2019-10-17 10:54:15 +02:00
Karel Zak 70ff760d41 login: reduce file-descriptors cleanup overhead
Addresses: https://github.com/karelzak/util-linux/issues/883
Signed-off-by: Karel Zak <kzak@redhat.com>
2019-10-17 10:45:16 +02:00
Karel Zak 488f65fcb8 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>
2019-10-17 10:44:57 +02:00
Karel Zak 93c2723772 tests: (lsblk) gather also udev attributes for new dumps
References: 7408a5d9c2
Signed-off-by: Karel Zak <kzak@redhat.com>
2019-10-15 13:29:13 +02:00
Karel Zak 6f74ede50a lsblk: read also GROUP,OWNER and MODE from dumps
Signed-off-by: Karel Zak <kzak@redhat.com>
2019-10-15 13:08:09 +02:00
Karel Zak 7408a5d9c2 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>
2019-10-15 12:36:16 +02:00
Karel Zak b1418ed146 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>
2019-10-15 11:59:16 +02:00
Sam Voss a76cd5f6ab 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>
2019-10-14 21:19:16 -05:00
Masami Hiramatsu 9ae113ca73 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>
2019-10-11 10:28:57 +02:00
John Garry 6f00af5b3c 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>
2019-10-11 10:11:27 +02:00
Stanislav Brabec a174eefb41 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>
2019-10-11 10:08:03 +02:00
Karel Zak a72a19865d tests: add missing 'ts_check_prog xz'
Signed-off-by: Karel Zak <kzak@redhat.com>
2019-10-10 09:07:10 +02:00
Karel Zak 52e9e94ea3 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>
2019-10-10 08:57:30 +02:00
Karel Zak 4abb659c18 tests: remove device name from blkdiscard output
Signed-off-by: Karel Zak <kzak@redhat.com>
2019-10-09 16:57:24 +02:00
Karel Zak b1154c4ece 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>
2019-10-09 16:51:34 +02:00