* Added member 'struct libmnt_table *tab' to libmnt_fs structure.
* Added 'mnt_fs_get_table()'.
* Removed overhead from 'mnt_table_{insert,move,remove}_fs().
* Added check to 'mnt_table_set_iter()' that entry is member of table.
[kzak@redhat.com: - add to libmount.sys
- add to docs
- cleanup commit message
- set fs->tab = NULL before mnt_unref_fs() in mnt_table_remove_fs()]
Signed-off-by: Tim Hildering <hilderingt@posteo.net>
Signed-off-by: Karel Zak <kzak@redhat.com>
* use proper winsize rather than uninitialized variable (Oops...)
* set the current terminal to the raw mode
* disable ECHO for non-terminal execution to be compatible with
non-pty output
Addresses: https://github.com/karelzak/util-linux/issues/767
Signed-off-by: Karel Zak <kzak@redhat.com>
The default is SKIP missing commands on --use-system-commands, but
with --noskip-commands the test will FAIL.
Signed-off-by: Karel Zak <kzak@redhat.com>
This change allows to use commands from $PATH rather than from
$top_builddir. There two basic use cases:
* check differences between installed and git version
run.sh --use-system-command --show-diff
* check system binaries by upstream tests (for example tests from
src.rpm package)
Signed-off-by: Karel Zak <kzak@redhat.com>
* let's assume that --pty is stable enough that we do not have to remove it ;-)
* add --pty to the runuser.1 man page
Addresses: https://github.com/karelzak/util-linux/issues/760
Signed-off-by: Karel Zak <kzak@redhat.com>
In commit b22332dd4 (last: fix wtmp user name buffer overflow
[asan], 2019-01-13), we started to make sure that the `ut_user`
field of the `utmpx` struct is always NUL-terminated. The
implementation makes use of the `__UT_NAMESIZE` define to
determine the position of the last character in that array. The
problem is that this is a non-standard define that is not
necessarily available on non-glibc platforms.
As there is no standardized define, we should just use `sizeof`.
This fixes compilation on musl libc based systems.
Signed-off-by: Patrick Steinhardt <ps@pks.im>
Add some fuse filesystems to the list of pseudofs and netfs.
There are still tens of filesystems that should be evaluated and added.
Signed-off-by: Stanislav Brabec <sbrabec@suse.cz>
If the terminal is in the UTF-8 mode, get_logname() should use 8-bit
processing.
Signed-off-by: Stanislav Brabec <sbrabec@suse.cz>
Cc: Lubomir Rintel <lkundrak@v3.sk>
Tested-by: Lubomir Rintel <lkundrak@v3.sk>
As login supports non-ASCII characters in the logname, agetty should be
consistent.
8b58ffdd re-activated old and ASCII-only get_logname(), which restricted
the input to ASCII only. As the code does not read whole characters,
isascii(ascval) and isprint(ascval) returns nonsenses after entering a
non-ASCII character.
As keyboard maps don't contain unprintable non-control characters, it
seems to be relatively safe to remove both checks.
Signed-off-by: Stanislav Brabec <sbrabec@suse.cz>
Cc: Lubomir Rintel <lkundrak@v3.sk>
Tested-by: Lubomir Rintel <lkundrak@v3.sk>
The test verifies that the "First sector" dialog offers relevant range
in the begin of the device if the end of the device is already used.
Signed-off-by: Karel Zak <kzak@redhat.com>
This cpu is massively numa and have interesting cache organization.
This will be useful to test & implement issue #663
Signed-off-by: Erwan Velu <e.velu@criteo.com>
Parsing of the label-id fails on 32-bit if the MSB is set. Fix that by
using strtoul instead of strtol.
Signed-off-by: Juerg Haefliger <juergh@canonical.com>
The current code uses first[] and last[] arrays to specify partition
ranges. This is unnecessary as we already have all in memory.
The current code offers in first and last sector dialogs ranges
without care about already used areas.
This commit makes things more readable, more user-friendly and
remove obscure first[] and last[].
Reported-by: 冰柯 <ziming_cool@126.com
Signed-off-by: Karel Zak <kzak@redhat.com>
Historical versions of column have described the default fill order as
rows-then-columns and the -x order as columns-then-rows. This was
misleading at best, and the util-linux implementation was updated to
clarify the actual behaviour in 3e094e5fe2 (March 2017).
However, the other implementations (used by *BSD, macOS, Debian, &al.)
continue to use the previous wording, and a user comparing them could
easily get the false impression that util-linux column has exactly the
opposite fill behaviour from BSD column.
To address this, a note is added to the man page explaining the change
and clarifying that, despite what the BSD documentation says, the two
implementations behave identically in this regard.
Signed-off-by: dana <dana@dana.is>
Add functions to insert FS into table to specified position and to
move FS between two tables.
Co-Author: Tim Hildering <hilderingt@posteo.net>
Signed-off-by: Karel Zak <kzak@redhat.com>
* document --tree (was missing in the man page)
* add optional argument to --tree to specify tree
For example:
$ lsblk -o KNAME,SIZE,MOUNTPOINT --tree=KNAME /dev/dm-0
KNAME SIZE MOUNTPOINT
dm-0 232.9G
└─dm-1 232.9G
└─dm-2 232.9G
Signed-off-by: Karel Zak <kzak@redhat.com>
This warning is repeated 112 times when compiling with all warnings.
xalloc.h:23:1: warning: function '__err_oom' could be declared with
attribute 'noreturn' [-Wmissing-noreturn]
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
misc-utils/hardlink.c:91:65: warning: declaration shadows a variable in the global scope [-Wshadow]
misc-utils/hardlink.c:73:5: note: previous declaration is here
int content_only = 0;
term-utils/wall.c:114:40: warning: declaration shadows a variable in the global scope [-Wshadow]
term-utils/wall.c:129:65: warning: declaration shadows a variable in the global scope [-Wshadow]
/usr/include/bits/getopt_core.h:36:14: note: previous declaration is here
extern char *optarg;
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
This change fixes "warning: variable 'var' may be uninitialized when used
here [-Wconditional-uninitialized]" warnings reported in various files.
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
It is not guaranteed that the returned string of readline() actually
contains as many bytes as buf can contain.
If bufsz is larger than the allocated memory by readline, an out of
boundary read occurs and leads to undefined behaviour. Most likely
that will be a crash.
This can be reproduced when readline-support is compiled in and when
you directly enter "quit" and "n" (to not write changes back to disk)
when sfdisk was called with any given device.
Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
Added validation to function 'mnt_table_add_fs()' to check that added @fs
is not already a member of another table.
Signed-off-by: Karel Zak <kzak@redhat.com>
wall(1) may be used in scripts or in pipe. In this case report failed
ttyname() does not make sense, especially if the code does not depend
on on this function.
Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=1608176
Signed-off-by: Karel Zak <kzak@redhat.com>
In the disk summary it seems nice, but I'm not sure about lists (SIZE
columns). It seems more readable to keep the lists with one decimal
place only. New output:
# sfdisk --list /dev/sda
Old output:
Disk /dev/sda: 223.6 GiB, 240057409536 bytes, 468862128 sectors
New output:
Disk /dev/sda: 223.58 GiB, 240057409536 bytes, 468862128 sectors
The rest is unchanged:
...
Device Start End Sectors Size Type
/dev/sda1 2048 411647 409600 200M EFI System
/dev/sda2 411648 821247 409600 200M Linux filesystem
/dev/sda3 821248 274087935 273266688 130.3G Linux filesystem
/dev/sda4 274087936 378945535 104857600 50G Linux filesystem
/dev/sda5 378945536 468862094 89916559 42.9G Linux filesystem
Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=1673452
Signed-off-by: Karel Zak <kzak@redhat.com>