Karel Zak [Wed, 12 Sep 2018 11:18:08 +0000 (13:18 +0200)]
libfdisk: accept grain script header
The "grain" variable is used to calculate partitions alignment. The
default is 1MiB (or minimal I/O size). The libfdisk provides API to overwrite
this default, but this feature has been nowhere accessible for
end-user.
This patch support for "grain: <size>" in libfdisk scripts.
Addresses: https://github.com/karelzak/util-linux/issues/688 Signed-off-by: Karel Zak <kzak@redhat.com>
Karel Zak [Tue, 11 Sep 2018 11:42:52 +0000 (13:42 +0200)]
Merge branch 'more' of https://github.com/kerolasa/util-linux
* 'more' of https://github.com/kerolasa/util-linux:
more: rename functions
more: rename variable names
more: remove unnecessary ifdef preprosessor directives
more: do not call fileno() for std{in,out,err} streams
more: remove 'register' keywords
more: remove pointless functions
more: return is statement not a function
more: remove dead code and useless comments
Karel Zak [Tue, 11 Sep 2018 07:53:18 +0000 (09:53 +0200)]
lsblk: don't ask udev when --sysroot specified
We use --sysroot to get information about block devices from /proc and
/sys dumps. In this case does not make sense to read anything from
udev as udevd is about the current system devices.
Matti Niemenmaa [Mon, 10 Sep 2018 12:21:31 +0000 (15:21 +0300)]
fallocate: add missing semicolon
This broke compilation when HAVE_POSIX_FALLOCATE was undefined. The typo
dates to the original posix_fallocate support added in commit 833f9a7aae713278eec5f85266597482f18c7370.
Signed-off-by: Matti Niemenmaa <matti.niemenmaa+git@iki.fi>
Ludwig Nussel [Fri, 7 Sep 2018 07:47:25 +0000 (09:47 +0200)]
Add built in fallbacks for motd file
Use several locations for built in default for motd to allow for
e.g. run time generated motd without having to modify config files.
login.c already splits by colon.
/usr/share/misc/motd
- chould be shipped by distributions
/run/motd
- potentially run time created file with dynamic information
/etc/motd
- for the admin fill with local information
Signed-off-by: Ludwig Nussel <ludwig.nussel@suse.de>
Karel Zak [Tue, 4 Sep 2018 09:42:19 +0000 (11:42 +0200)]
build-sys: default to /lib64 for ${exec_prefix}/lib64
We already default to /lib for the default $exec_prefix, but the current
configure does not care about /lib64 although the use-case is exactly
same as for /lib.
Sami Kerola [Sun, 27 May 2018 16:29:09 +0000 (17:29 +0100)]
more: rename variable names
Try to make variable names to tell what they do. Earlier names have been in
more(1) since the command was first wrote, and it looks like coding
practices has changed since late 70's.
Sami Kerola [Sat, 26 May 2018 20:24:31 +0000 (21:24 +0100)]
more: remove 'register' keywords
One can only assume someone tried to make more(1) to run quicker. More up
to date assumption is that compilers are fully capable optimizing binaries
without these sort of hints.
Sami Kerola [Sat, 26 May 2018 19:08:34 +0000 (20:08 +0100)]
more: remove dead code and useless comments
Removal of STOP requires explanation. Looking unix-history-repo getline()
function in first BSD-3 version could return STOP. By next tag BSD-4 the
return STOP had disappeared. If I read this correctly that was a partial
removal, and second part has waited to be completed since 1980-11-16 when
BSD-4 was released.
Reference: https://github.com/dspinellis/unix-history-repo/blob/BSD-3-Snapshot-Development/usr/src/cmd/more.c#L501 Signed-off-by: Sami Kerola <kerolasa@iki.fi>
The patch uses uuid_unpack and uuid_pack. It makes code more readable
and allow to access proper octens. The same way we already use for
time and random based UUIDs.
Addresses: https://github.com/karelzak/util-linux/issues/683 Signed-off-by: Karel Zak <kzak@redhat.com>
Karel Zak [Thu, 23 Aug 2018 08:13:17 +0000 (10:13 +0200)]
libsmartcols: don't mark as extreme where average is zero
The columns with NOEXTREME flag are internally marked as extreme
(=contains extreme width) if maximal with is greater than 2 *
average_width. This detection has to sure that the average is non-zero
otherwise the column is always "extreme".
Karel Zak [Thu, 23 Aug 2018 08:02:49 +0000 (10:02 +0200)]
libsmartcols: allow to add line to table without columns
The table allows to add columns on the fly when lines already exist.
So, it does not make sense to reject request to add line to table
without columns.
Karel Zak [Wed, 22 Aug 2018 09:43:32 +0000 (11:43 +0200)]
setpriv: add --reset-env
Clear environment in way like su(1), but PATH is set to hard-coded
defaults and /etc/login.defs is not used at all (I guess we want to
keep setpriv(1) simple).
If you need anything more advanced than use env(1).
Addresses: https://github.com/karelzak/util-linux/issues/325 Signed-off-by: Karel Zak <kzak@redhat.com>
Karel Zak [Thu, 16 Aug 2018 14:16:40 +0000 (16:16 +0200)]
sulogin: restore signals after failed exec() only
* removes unnecessary variable
* the current code restores signals always when shell has not been
executed -- this is correct as function sushell() modify signal
mask, but in all another cases we do not need touch the mask.
Especially when we ask for the password in endless while() loop...
Karel Zak [Thu, 16 Aug 2018 13:43:53 +0000 (15:43 +0200)]
libmount: cleanup licenses sections in the files
* add SPDX-License-Identifier (see https://spdx.org/licenses/)
* add "This file part of libmount from util-linux project."
* use proper text for LGPL-2.1-or-later
* use the same texts everywhere
Karel Zak [Thu, 16 Aug 2018 12:47:21 +0000 (14:47 +0200)]
docs: use SPDX license names
Let's use standardized names for licenses. The names used by SPDX
makes things more obvious at first glance. For complete list see:
https://spdx.org/licenses/
Note, this commit does not change any license or so...
Karel Zak [Fri, 10 Aug 2018 08:49:15 +0000 (10:49 +0200)]
su: add --whitelist-environment
* usable with --login to whitelist specified environment variables
* the list is ignored for the core variables like HOME, SHELL, USER,
LOGNAME and PATH (su --login always resets these variables)
Note that su(1) requires password and after successful authentication
user has full control over the session, so he can set arbitrary
environment variables. The whitelist makes things more user friendly
only.
The patch removes unnecessary optimization when allocate environ[]. It
seems better to keep all in glibc hands and just reset the environment
array only.
Addresses: https://github.com/karelzak/util-linux/issues/221 Signed-off-by: Karel Zak <kzak@redhat.com>
Karel Zak [Mon, 13 Aug 2018 12:16:28 +0000 (14:16 +0200)]
lslogins: return 1 on "lslogins nonexisting"
The default behavior for -l and -g is to silently ignore unknown login
names, but this is very confusing when you explicitly specify just one
login name.
Note that the current implementation also prints empty "Last log" for
nonexisting user. It seems ugly.
Karel Zak [Wed, 8 Aug 2018 09:35:58 +0000 (11:35 +0200)]
fstrim: update .service to follow /etc/fstab
Replace -a with -A to discard mounted filesystems from /etc/fstab. The
original -a forces fstrim to try to discard all filesystems, including
for example manually mounted removable media.
It seems better for widely used .service unit to follow /etc/fstab.
Addresses: https://github.com/karelzak/util-linux/issues/673 Signed-off-by: Karel Zak <kzak@redhat.com>
Sami Kerola [Thu, 2 Aug 2018 18:35:51 +0000 (19:35 +0100)]
mesg: do not print 'ttyname failed' message unless --verbose requested
Lots of people are confused why mesg(1) is priting this message. Usual
cause seems to be an uninteractive shell trying to turn running 'mesg n'
from a /root/.profile where command invocation is by default on debian based
systems. This might be rare case when failing silently is better.
[kzak@redhat.com: - add note to the man page
- fix if(isatty()) logic]
Reference: https://www.google.com/search?q=mesg+ttyname+failed
Review: https://marc.info/?l=util-linux-ng&m=153319988631233&w=2 Signed-off-by: Sami Kerola <kerolasa@iki.fi> Signed-off-by: Karel Zak <kzak@redhat.com>
Karel Zak [Wed, 1 Aug 2018 07:10:07 +0000 (09:10 +0200)]
umount: add --quiet option
The command umount supports things like --all-targets and --recursive
to umount all nodes in specified tree. Sometimes it makes sense to
aggressively use wildcards like /dev/sdb* and in this case --quiet
seems like a good choice
umount --quiet --all-targets /dev/sdb*
to suppress 'not mounted' error messages. The new option suppress only
these error messages and nothing else.
Addresses: https://github.com/karelzak/util-linux/issues/672 Signed-off-by: Karel Zak <kzak@redhat.com>
Karel Zak [Tue, 31 Jul 2018 09:07:47 +0000 (11:07 +0200)]
hwclock: remove ntpd from man page
It seems better to use generic "NTP daemon" in the man page than
points to specific ntpd(1) implementation as some distros use for
example chronyd(1) rather than old ntpd(1).
Karel Zak [Mon, 23 Jul 2018 10:21:33 +0000 (12:21 +0200)]
login: use const qualifier for username from PAM or struct passwd [-Wcast-qual]
It seems more robust to use 'const' qualifier for username if this
variable points to external resources like PAM or struct passwd. The
patch introduces new variable cmd_username for username specified on
login(1) command line.