Karel Zak [Wed, 24 Apr 2019 10:24:15 +0000 (12:24 +0200)]
tests: auto-enable ASAN option if necessary
Let's detect ASAN LDFLAGS in top level Makefile to make sure we call
tests with --memcheck-asan if build-system has been configured with
--enable-asan.
Stanislav Brabec [Wed, 24 Apr 2019 09:16:53 +0000 (11:16 +0200)]
lslogins: Fix discrepancies of SYS_UID_MIN
util-linux does not contain useradd. Its most popular implementation
comes from shadow. SYS_UID_MIN is one of common parameters. Its
hardcoded fallback value is equal to 101 in shadow useradd (see
shadow-4.6/libmisc/find_new_uid.c: get_ranges()), but 201 in
login-utils/lslogins.c.
Let lslogins use the same fallback as useradd from shadow.
Hopefully most distros define its custom value of SYS_UID_MIN in
/etc/login.defs, so this problem is not visible.
login-utils/lslogins.1 does not mention its default at all. Add a
reference and improve text of lslogins(1) to prevent off-by-one
interpretation.
Signed-off-by: Stanislav Brabec <sbrabec@suse.cz> Signed-off-by: Karel Zak <kzak@redhat.com>
Karel Zak [Tue, 16 Apr 2019 11:42:34 +0000 (13:42 +0200)]
include/closestream: add close_stdout_atexit()
It seems better to have a way to control when atexit(close_stdout()) is
used, because close stdout means that for example ASAN (or another
into binary integrated tool) is not able to print the final summary.
Wang Shilong [Sun, 14 Apr 2019 03:31:56 +0000 (12:31 +0900)]
fstrim: get realpath before trim ioctl
Original motivation is we want to run fstrim command
on Lustre[1] osd server mount point directly, however
our server mount point doesn't export osd directory
to users, and it will cause following command fail:
$fstrim -v /mnt/mds/
But following succeed:
$fstrim -v /mnt/mds
We could improve this a bit by getting realpath
before trapping kernel, this also give benifits
to normal use cases.
Cc: Andreas Dilger <adilger@dilger.ca> Cc: Shuichi Ihara <sihara@ddn.com>
[1] http://wiki.lustre.org/Main_Page Signed-off-by: Wang Shilong <wshilong@ddn.com>
Karel Zak [Mon, 25 Mar 2019 15:39:43 +0000 (16:39 +0100)]
su: change error message
We use PAM and if pam_strerror() returns nothing we have no clue why
authentication failed. It's mistake to blame incorrect password if
there are many possible reason...
Addresses: https://github.com/karelzak/util-linux/issues/778 Signed-off-by: Karel Zak <kzak@redhat.com>
Karel Zak [Wed, 20 Mar 2019 12:12:25 +0000 (13:12 +0100)]
taskset: fix cpuset list parser
taskset hangs when executed with badly formatted cpuset list, for
example:
$ taskset -c 0--1 true
The current cpuset list parser is pretty weak as based on scanf()
without strings verification ("-1" as input for "%u" returns
unexpected number). It seems faster and better to use strtoul() and
isdigit().
Addresses: https://github.com/karelzak/util-linux/issues/77 Signed-off-by: Karel Zak <kzak@redhat.com>
Karel Zak [Tue, 19 Mar 2019 10:09:02 +0000 (11:09 +0100)]
lscpu: report more usable cache sizes
The current version reports cache size as reported by /sys, it means
real size of the one piece of the cache. This way provides minimal
overview about all system as the cache is often shared between CPUs.
It seems better to report all size of the caches in the summary
output. It also does not make sense to report sizes per core (or
socket) as CPU topology may be pretty complicated.
The final solution (not implemented yet) will be to have --list-caches
where we can report all details like all-size, item-size, per-core size,
ways, type, etc.
Addresses: https://github.com/karelzak/util-linux/issues/663 Signed-off-by: Karel Zak <kzak@redhat.com>
Tim Hildering [Mon, 4 Mar 2019 18:15:08 +0000 (19:15 +0100)]
libmount: improve fs referencing in tables
* 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>
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.
Stanislav Brabec [Wed, 27 Feb 2019 22:22:19 +0000 (23:22 +0100)]
agetty: Fix input of non-ASCII characters in get_logname()
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.
dana [Fri, 22 Feb 2019 20:11:29 +0000 (14:11 -0600)]
column: Address fill-order confusion in documentation
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.
Sami Kerola [Sat, 9 Feb 2019 08:47:43 +0000 (08:47 +0000)]
hardlink, wall: fix variable shadowing
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;