* next: (26 commits)
build-sys: add script to compare config.h from meson and autotools
meson: add missing header files check
docs: update TODO
tests: update lscpu outputs
lscpu: read MHZ from /sys/.../cpufreq/scaling_cur_freq
lscpu: use locale-independent strtod() when read from kernel
lib/c_strtod; add locale independent strtod()
tests: update lscpu output
lscpu: use MHZ as number to be locale sensitive
lscpu: add SCALMHZ% and "CPU scaling MHz:"
sulogin: fix whitespace error
sulogin: ignore none-existing console devices
lsns: fix old error message
lsns: fix copy & past in man page
lsns: fill UID and USER columns for interpolated namespaces
fixup! lsns: interpolate missing namespaces for converting forests to a tree
lsns: interpolate missing namespaces for converting forests to a tree
lsns: reorganize members specifying other namespaces in lsns_namespace
lsns: make namespace having no process printable
libblkid: support zone reset for wipefs
...
Unfortunately libtools is not smart enough to link libblkid
dynamically if we link in-tree static libmount.a for libmount tests.
In this case libtools always uses also libblkid.a, but it's problem
for libcryptsetup which requires versioned symbols from libblkid.so
This is no problem for normal binaries, but for libmount tests only
(where we need static library to by-pass public library API).
Signed-off-by: Karel Zak <kzak@redhat.com>
To build: meson build && ninja -C build
To run tests: ninja -C build check
To install for packaging: DESTDIR=/var/tmp/inst ninja -C build install
To install for realz: sudo ninja -C build install
v2:
- Optional items are now based on the 'feature' feature in meson.
Built libraries which are disabled turn into disabler() objects
and also poison any executables which link to them.
What is there:
- building of the binaries and libs and the python module
- installation of binaries, libs, python module, localization files,
man pages, pkgconfig files
- running of tests
- most options to configure build equivalently to the
./configure settings
Partially implemented:
- disabling of stuff when things missing. In the C code, the defines
are all used, so that should be fine. In the build system, some
files should be skipped, but that is probably not always done properly.
Getting this right might require some testing of various build option
combinations to get the details right.
Not implemented:
- static builds of fdisk and other binaries
- things marked with XXX or FIXME
- ???
Differences:
- .la files are not created. They are useless and everybody hates them.
- Requires.private in pkgconfig files are not present in the
autogenerated .pc file. Not sure if they should be there or not. If
necessary, they can be added by hand.
- man pages and systemd units are installed by the install target. Not
sure why 'make install' doesn't do that.
- the split between / and /usr is probably wrong. But it's all pointless
anyway, so maybe we could simplify things but not implementing it at
all under meson?
so that the fuzz targets (along with everything else) can be built
and run with:
```
./tools/config-gen fuzz
make check
```
Signed-off-by: Evgeny Vereshchagin <evvers@ya.ru>
The fuzzer is supposed to cover `mnt_table_parse_stream`, which is
used by systemd to parse /proc/self/mountinfo. The systemd project
has run into memory leaks there at least twice:
https://github.com/systemd/systemd/pull/12252#issuecomment-482804040https://github.com/systemd/systemd/issues/8504
so it seems to be a good idea to continuously fuzz that particular
function.
The patch can be tested locally by installing clang and running
./tools/oss-fuzz.sh. Currently the fuzzer is failing with
```
=================================================================
==96638==ERROR: LeakSanitizer: detected memory leaks
Direct leak of 216 byte(s) in 1 object(s) allocated from:
#0 0x50cd77 in calloc (/home/vagrant/util-linux/out/test_mount_fuzz+0x50cd77)
#1 0x58716a in mnt_new_fs /home/vagrant/util-linux/libmount/src/fs.c:36:25
#2 0x54f224 in __table_parse_stream /home/vagrant/util-linux/libmount/src/tab_parse.c:728:9
#3 0x54eed8 in mnt_table_parse_stream /home/vagrant/util-linux/libmount/src/tab_parse.c:804:8
#4 0x5448b2 in LLVMFuzzerTestOneInput /home/vagrant/util-linux/libmount/src/fuzz.c:19:16
#5 0x44cc88 in fuzzer::Fuzzer::ExecuteCallback(unsigned char const*, unsigned long) (/home/vagrant/util-linux/out/test_mount_fuzz+0x44cc88)
#6 0x44d8b0 in fuzzer::Fuzzer::RunOne(unsigned char const*, unsigned long, bool, fuzzer::InputInfo*, bool*) (/home/vagrant/util-linux/out/test_mount_fuzz+0x44d8b0)
#7 0x44e270 in fuzzer::Fuzzer::MutateAndTestOne() (/home/vagrant/util-linux/out/test_mount_fuzz+0x44e270)
#8 0x450617 in fuzzer::Fuzzer::Loop(std::vector<fuzzer::SizedFile, fuzzer::fuzzer_allocator<fuzzer::SizedFile> >&) (/home/vagrant/util-linux/out/test_mount_fuzz+0x450617)
#9 0x43adbb in fuzzer::FuzzerDriver(int*, char***, int (*)(unsigned char const*, unsigned long)) (/home/vagrant/util-linux/out/test_mount_fuzz+0x43adbb)
#10 0x42ad46 in main (/home/vagrant/util-linux/out/test_mount_fuzz+0x42ad46)
#11 0x7fa084f621a2 in __libc_start_main (/lib64/libc.so.6+0x271a2)
SUMMARY: AddressSanitizer: 216 byte(s) leaked in 1 allocation(s).
INFO: to ignore leaks on libFuzzer side use -detect_leaks=0.
```
Once the bug is fixed and the OSS-Fuzz counterpart is merged it should be possible
to turn on CIFuzz to make sure the fuzz target can be built and run for some time
without crashing: https://google.github.io/oss-fuzz/getting-started/continuous-integration/
Signed-off-by: Evgeny Vereshchagin <evvers@ya.ru>
Sorry detail-oriented people tend to wipe these out if they notice them.
Add in automated tools and lots of excess end-of-line spaces get wiped
out.
Addresses: https://github.com/karelzak/util-linux/pull/849
Signed-off-by: Karel Zak <kzak@redhat.com>
use
$ make CU_DUMP=1 checkusage
for easily reviewing and comparing all output in
/tmp/checkusage--help
/tmp/checkusage--version
/tmp/checkusage--unknownopt
This was a big help when doing all my last usage cleanup.
Actually I used it to dump the original output, edited it
how I would like it, and then changed our programs to match
the wanted output.
Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
Sorry, don't know why I reverted fad561b0.
But for travis we need it only in check_nonroot().
check_root() *can* do chown and the check_dist() is handled
by Makefile.
Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
Just some simple generic tests for our UL commands, regarding
options --help, --version and --unknownopt.
The script looks still a bit weired but could be polished to
be used in tests/. It would be the first time testing at least
"something" for *all* built binaries (currently 109! commands).
For the record here are the current candidates with possible
problems:
$ make checkusage
agetty: --unknownopt, stderr too long: 45
blockdev: --unknownopt, stderr too long: 28
flock: --help, no stdout
flock: --help, non-empty stderr
getopt: --help, returns error
kill: --unknownopt, stderr too short: 1
lsipc: --unknownopt, stderr too long: 77
pg: --unknownopt, stderr too long: 23
renice: --unknownopt, stderr too long: 18
rtcwake: --unknownopt, non-empty stdout
rtcwake: --unknownopt, stderr too long: 21
sulogin: --unknownopt, stderr too long: 17
write: --unknownopt, stderr too long: 12
Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
* add UL_ENABLE_ALIAS(NAME, MASTERNAME) to initialize $enable_<name>
according to MASTERNAME. Note that we have to use $build_<mastername>,
the $enable_<mastername> is just AC_ARG_ENABLE() stuff only. The
$build_ is evaluated and modified by our UL_...() functions.
* add enable-schedutils.conf to have build-system regression test for
this use-case
Addresses: https://github.com/karelzak/util-linux/issues/415
Signed-off-by: Karel Zak <kzak@redhat.com>
We have "make" targets which depends on tools/check*.sh scripts. It's
ugly to exclude these scripts from the release tar balls (as generated
by "make distcheck").
Signed-off-by: Karel Zak <kzak@redhat.com>
The checkmans.sh tried to validate shared libraries, such as
./.libs/libsmartcols.so.1, causing the check output to a have
lot of pointless garbage.
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
checkman.sh depends upon the man-db package:
Add using grog when lexgrog not installed.
/dev/null some troff noise.
Signed-off-by: J William Piggott <elseifthen@gmx.com>
checkman.sh fails if 'git' or 'lib' are
anywhere in the tested file's path:
Change to using relative paths.
Improve the 'find' command call.
checkman.sh depends upon the man-db package:
Remove all instants of the man command and
use troff directly to improve portability.
Signed-off-by: J William Piggott <elseifthen@gmx.com>