Add some more tests:
* error handling "unknown arch" and "unknown command"
* "noop" test with host arch and no other options
* all options except --uname-2.6
* --uname-2.6 whithout any other options but handle fatal
glibc error "kernel too old" (with debug output)
* add a "real" --uname-2.6 test which validates uname(1)
output
Note the "kernel too old" cases are systems where glibc was
configured to support only kernels > 3.0. On some archs
(e.g. x86) --uname-2.6 still works with such glibc because
2.6.39 had all needed features on board (e.g. vdso).
See https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=806911
Some people reported segfaults (after execvp) but I can only
reproduce it on arm* and aarch64 qemu-user-space builds. We
don't need to fix our tests for such broken systems where
also many other tests fail currently.
Kent Overstreet [Tue, 15 Mar 2016 02:44:36 +0000 (18:44 -0800)]
libblkid: Update for newer bcache superblocks
Later version of bcache add different checksum types, and allow for superblocks
greater than 4k - skipping the checksum check (as in most other probes) is the
easiest solution.
Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
Werner Fink [Tue, 22 Mar 2016 09:38:59 +0000 (10:38 +0100)]
sulogin: Always make echo work after performing getpasswd even if root account is locked
If the root account is locked and no password was provided then the terminal
line is not set back to do echo of the input. This correct a small overlook
in commit 7ff1162e67164cb4ece19dd809c26272461aa254
Dongli Zhang [Tue, 22 Mar 2016 05:38:14 +0000 (13:38 +0800)]
lscpu: correct the Virtualization type on Xen DomU PV guest
Nowadays, most Intel CPUs have "cpuid faulting" available which could trap
the execution of "cpuid" instruction when CPL>0 with GP fault. Thus,
"cpuid" instruction could trap to Xen hypervisor on the paravirtualized PV
guest on most servers today, except on old CPUs prior to 2011. On CPU after
2011, Xen will put "XenVMMXenVMM" on both HVM and PV guests, which could
have lscpu command erroneously classify the guest as type "full". The
current lscpu command, which is based on "cpuid" instruction, still assumes
that it will not cause the trap to Xen hypervisor on Xen PV guest and uses
/proc/xen to identify whether it's running on PV DomU or not. To identify
this kind of information under the help of
/sys/hypervisor/properties/features would be more accurate for the CPU
nowadays. The bit 5 (XENFEAT_mmu_pt_update_preserve_ad) of the features
will be set only when it's running on Xen PV domain. The combo of bit 3 and
8 (XENFEAT_supervisor_mode_kernel and XENFEAT_hvm_callback_vector) will be
set simultaneously only when it's running on Xen PVH domain.
[kzak@redhat.com: - add path_exist()]
Signed-off-by: Dongli Zhang <dongli.zhang@oracle.com> Signed-off-by: Karel Zak <kzak@redhat.com>
Karel Zak [Mon, 21 Mar 2016 20:13:25 +0000 (21:13 +0100)]
docs: add note about CLONE_NEWCGROUP support
The patch has been planned for weeks and now the kernel part is
already in Linus' tree. It's a new feature, but it's probably better
to merge the userspace stuff now (v2.28 rc1) than wait next 6 months
for the next util-linux release.
Ruediger Meier [Mon, 21 Mar 2016 13:04:45 +0000 (14:04 +0100)]
ipcs: consolidate output header printing
Print a warning (instead of header) if --limits fails, like we did
it in past (2.20.1) and like we are still doing for --summary. Note
in past we were printing the same message like for --summary
"kernel not configured for ...", but actually this message is not
really correct.
This patch simply consolidates the current behavior. Probably we
should refactor it regarding warnings (stderr) and exit codes.
Ruediger Meier [Fri, 18 Mar 2016 11:49:17 +0000 (12:49 +0100)]
ipcs: make sure to parse whole lines for shm_data
We want to parse 16 columns _per_row_ without mixing them up. The
existing code is unsafe for more or less columns and could even
run into endless loops. This patch assures that we parse row-wise
and really skip lines with columns != 16.
Probably somehow we could have also done this with fscanf() only.
Using fgets() additionally makes the code more easy to read and
to improve later.
Karel Zak [Fri, 18 Mar 2016 13:28:29 +0000 (14:28 +0100)]
swapon: rewrite control struct usage
The old version has been pretty broken... the most important is to
keep swap options specified on command line as read-only template.
For example if we call "swapon --all" then we cannot modify the global
options for each fstab swap entry.
The another story has been control struct modification due to device
reinitialization etc.
This patch splits all to:
* struct swapon_control; top-level struct with command line options
* struct swap_device; this is device specific and never globally
maintained by swapon_control.
* struct swap_prop; used as global read-only template swap options
and per device swap options (when parse fstab).
Addresses: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=818252 Signed-off-by: Karel Zak <kzak@redhat.com>
Karel Zak [Wed, 16 Mar 2016 12:01:10 +0000 (13:01 +0100)]
tests: mark old bsd fdisk test as deprecated
It seems better to use hexdump rather than md5sum, but it means that
we have to gather hexdumps of the all possible BSD variants. For this
purpose will be introduced a new bsd fdisk test and to verify the
new hexdumps we can use this old test as both tests are exactly the
same.
Ruediger Meier [Wed, 16 Mar 2016 00:40:44 +0000 (01:40 +0100)]
tests: fix fdisk/bsd for alpha
There are special __alpha__ ifdefs in libfdisk/src/bsd.c
Regarding 565964a9 and a80886e9.
BTW it was a bad idea to use md5sum. In case of failure it
would be much easier to debug hexdump diffs. Now it's nearly
impossible to collect all these exotic hexdumps.
CC: Andreas Henriksson <andreas@fatal.se> Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
Sami Kerola [Mon, 14 Mar 2016 21:38:30 +0000 (21:38 +0000)]
vipw: print only one new line when asking about shadow file
Commit 11b86e1733 changed printf() to puts() in favour of more simple
function, but forgot that puts() adds a new line to end of string. That new
line is neither needed, or expected, so use fputs() that is both a simple
printing function and comes without new line side effect.
Vasant Hegde [Mon, 14 Mar 2016 14:48:07 +0000 (20:18 +0530)]
lscpu: Fix model and model name on Power Systems
On Power System, lspcu presently displays system model number instead of
processor model name. 'model' tag in cpuinfo contains system model name,
not processor model. Instead it uses 'cpu' tag for processor model name.
Also it uses 'revision' tag for processor model.
Fix lspcu so that it displays processor model number. Also display processor
model name.
Richard Yao [Fri, 11 Mar 2016 22:03:27 +0000 (17:03 -0500)]
swapon: fix discard=pages docs
The documentation for discard=pages is ambiguous in that it could be
interpreted to mean either that the pages are discarded immediately
after being freed or that the pages are discarded immediately before
being reused by a write. Both implementations would satisfy the
statement "discard freed swap pages before they are avaliable for
reuse", but the kernel does the former.
Doing a discard operation (which is non-queued on SATA drives before
SATA 3.1) before a write operation to the same sector is pointless
unless using, pre-SATA 3.1 drives, where discard is detrimental because
ATA TRIM is a non-queued command.
Anyone who wants discard operations on swap and interprets the man page
as describing the incorrect behavior would opt for discard=once over
discard, when discard provides the behavior of both discard=once and
discard=pages, which is what they likely want.
Lets make a small change to the documentation to clarify the behavior.
Ruediger Meier [Sat, 12 Mar 2016 22:45:00 +0000 (23:45 +0100)]
travis: add OSX build
Of course OSX is not an important target but since it's available on
travis we can (mis)use it to generally improve non-Linux and non-GNU
compatibility. People are using musl, busybox or whatever and
util-linux should work for them. Having OSX build running regularly
will help us to freeze the lately improved BSD compatibility and
to check code which is usually ifdef'ed.
We are using the most recent OSX 10.11.x / Xcode 7.3 though the older
travis OSX images are working too currently.
If it turns out that this OSX build is too annoying when we are about
to add support for latest Linux features then we could add:
allow_failures:
- os: osx
to let it fail silently.
Note I've tried hard to keep .travis-functions.sh readable for the
Linux case. I've removed --with-python because it's default anyway,
--enable-gtk-doc is still tested in discheck.
OSX root check would also work (almost, using another --prefix) but
would only run one more test yet (minix).
OSX distcheck would have some issues with conditionally built man
pages and does not work with default distcheck confopts. No need to
fix that because distcheck is more for maintainer machines.
BTW to increase travis build speed again we could remove some targets
from the matrix without losing tested scenarios:
- nonroot for Linux seems to be waste of time
- clang/Linux could be root check only
For now we keep it as is.
Ruediger Meier [Sat, 12 Mar 2016 22:44:50 +0000 (23:44 +0100)]
travis: switch to Ubuntu 14.04 Trusty
Now we have a reasonable recent build system with systemd, etc. We still
keep old Ubuntu 12.04 Precise to check backward compatibility but
remove the hack to install socat.
Note the new env variable PRECISE="yes" is only there to see it on travis
website.
Ruediger Meier [Sun, 13 Mar 2016 02:19:26 +0000 (03:19 +0100)]
build-sys: fix again UL_SCANF_TYPE_MODIFIER
This reverts commit c8494d88:
"build-sys: fix UL_SCANF_TYPE_MODIFIER for icc"
plus fix the check prog, because it found "%as" to be valid on
systems where "%a" is used for float conversion.
icc warns about "%ms" but it works anyways. Our AC_RUN_IFELSE prog
should do it right now regardless of compiler warnings.
Note "%ms" is POSIX.1-2008 standard but still not available on
many systems. Maybe it's time to remove "%as" fallback for old
glibc which is even less portable.
Ruediger Meier [Sat, 12 Mar 2016 11:23:32 +0000 (12:23 +0100)]
tests: improve skipping of old btrfs-tools
Older Linux distributions came with differently incomplete
btrfs-tools 0.19+git versions (2009-2013). Old mkfs.btrfs
needs minimum device size 256M.
Note the most simple way to skip btrfs-tools < 3.14 would be
btrfs property --help 2>&1 || ts_skip "btrfs too old"
but I want to include 3.12 because of Ubuntu Trusty on travis.
This patch partly reverts/rewrites the following commits: 7e604f3c - tests: don't skip case "output undefined" 076153f8 - tests: don't compare btrfs mount options 370d31f7 - tests: skip btrfs tests if version too old
Ruediger Meier [Thu, 10 Mar 2016 10:29:09 +0000 (11:29 +0100)]
tests: remove invalid argument in libmount/debug
This was usually no problem because of unsafe strtoul(3) usage in
test prog libmount/src/init.c. But musl's strtoul sets errno if
no digit was found in the argument.
Ruediger Meier [Sat, 12 Mar 2016 22:55:48 +0000 (23:55 +0100)]
misc: fix icc/clang compiler warnings
clang warning:
libmount/src/tab.c:1833:6: warning: variable 'rc' is used uninitialized whenever
'if' condition is true [-Wsometimes-uninitialized]
if (!mpc)
^~~~
icc printf warnings:
libmount/src/monitor.c(348): warning #2279: printf/scanf format not a string literal and no format arguments
DBG(MONITOR, ul_debugobj(mn, status == 1 ? " success" : " nothing"));
^
login-utils/vipw.c(348): warning #2279: printf/scanf format not a string literal and no format arguments
: _("You are using shadow passwords on this system.\n"));
^
icc enum warnings:
disk-utils/fdisk-menu.c(150): warning #188: enumerated type mixed with another type
.exclude = FDISK_DISKLABEL_GPT | FDISK_DISKLABEL_BSD,
^
libsmartcols/src/table_print.c(750): warning #188: enumerated type mixed with another type
&width, align,
^
Ruediger Meier [Wed, 9 Mar 2016 16:56:58 +0000 (17:56 +0100)]
misc: fix printf i386 compiler warnings
Still a few printf warnings found on i386 Linux:
libfdisk/src/alignment.c: In function 'fdisk_align_lba':
libfdisk/src/alignment.c:115:3: warning: format '%ju' expects argument of type 'uintmax_t', but argument 6 has type 'long unsigned int' [-Wformat]
sys-utils/lsns.c: In function ‘add_namespace’:
sys-utils/lsns.c:346:2: warning: format ‘%lu’ expects argument of type ‘long unsigned int’, but argument 4 has type ‘ino_t’ [-Wformat]
sys-utils/lsns.c: In function ‘add_process_to_namespace’:
sys-utils/lsns.c:362:2: warning: format ‘%lu’ expects argument of type ‘long unsigned int’, but argument 6 has type ‘ino_t’ [-Wformat]
sys-utils/lsns.c: In function ‘add_scols_line’:
sys-utils/lsns.c:440:4: warning: format ‘%lu’ expects argument of type ‘long unsigned int’, but argument 3 has type ‘ino_t’ [-Wformat]