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>
* '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
The code and man page do not assume -s to be short alias to
--setgroups.
This commit also a little bit change --help output formatting to make
it more readable and structured.
Addresses: https://github.com/karelzak/util-linux/pull/692
Signed-off-by: Karel Zak <kzak@redhat.com>
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.
Signed-off-by: Karel Zak <kzak@redhat.com>
This broke compilation when HAVE_POSIX_FALLOCATE was undefined. The typo
dates to the original posix_fallocate support added in commit
833f9a7aae.
Signed-off-by: Matti Niemenmaa <matti.niemenmaa+git@iki.fi>
sysfs device model is truncated to 16 characters:
> cat /sys/block/sda/device/model
Crucial_CT128MX1
> udevadm info --query=property /dev/sda | grep MODEL=
ID_MODEL=Crucial_CT128MX100SSD1
sysfs uses INQUARY response which has the 16 characters limitation and
udev uses something else.
Addresses: https://github.com/karelzak/util-linux/issues/690
Signed-off-by: Karel Zak <kzak@redhat.com>
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>
The current signalfd handler cares on CLD_EXITED only. It's pretty
insufficient as there is more situations (and codes) when child no
more running.
Addresses: https://github.com/karelzak/util-linux/issues/686
Signed-off-by: Karel Zak <kzak@redhat.com>
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.
Signed-off-by: Karel Zak <kzak@redhat.com>
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.
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
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.
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
The curs_terminfo(3X) defines putp() as tputs(str, 1, putchar), so all of
these five functions can be replaced with putp().
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
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 current version is not fully compatible with RFC4122. It
incorrectly encodes UUID variant
xxxxxxxx-xxxx-Mxxx-Nxxx-xxxxxxxxxxxx
where M is UUID version and N is UUID variant.
$ python -c "import uuid ; print(uuid.uuid5(uuid.UUID(int=0), 'foo'))"
aa752cea-8222-5bc8-acd9-555b090c0ccb
^^
Old version:
$ uuidgen --namespace 00000000-0000-0000-0000-000000000000 --name 'foo' --sha1
aa752cea-8222-5bc8-8cd9-555b090c0ccb
^^
Fixed version:
./uuidgen --namespace 00000000-0000-0000-0000-000000000000 --name 'foo' --sha1;
aa752cea-8222-5bc8-acd9-555b090c0ccb
^^
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>
The option allows to add empty line to the table. The default behavior
is to ignore empty lines at all.
echo -e "A\nAA\nAAA\n\nAAAA" | ./column --table
A
AA
AAA
AAAA
$ echo -e "A\nAA\nAAA\n\nAAAA" | ./column --table --table-empty-lines
A
AA
AAA
AAAA
Addresses: https://github.com/karelzak/util-linux/issues/593
Signed-off-by: Karel Zak <kzak@redhat.com>
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".
Signed-off-by: Karel Zak <kzak@redhat.com>
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.
Signed-off-by: Karel Zak <kzak@redhat.com>
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>
* 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...
Signed-off-by: Karel Zak <kzak@redhat.com>
* 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
Signed-off-by: Karel Zak <kzak@redhat.com>
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...
Signed-off-by: Karel Zak <kzak@redhat.com>
It seems 'n' is more common than 'd'. The patch also cleanup
getopt_long() options string.
Addresses: fda0e2cf04 (commitcomment-30097920)
Signed-off-by: Karel Zak <kzak@redhat.com>
* 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>