Commit Graph

90 Commits

Author SHA1 Message Date
Karel Zak ac55a4130f Merge branch 'next'
* 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
  ...
2021-06-02 12:33:07 +02:00
Karel Zak d79a69c564 tools: allow to update specific files on kernel.org
Signed-off-by: Karel Zak <kzak@redhat.com>
2021-06-01 11:45:16 +02:00
Karel Zak 1c0d193441 build-sys: remove with-cryptsetup from tools/config-gen.d/all.conf
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>
2021-05-31 17:44:10 +02:00
Karel Zak 684f921ec2 build-sys: add script to compare config.h from meson and autotools
Signed-off-by: Karel Zak <kzak@redhat.com>
2021-05-26 13:20:21 +02:00
Karel Zak a2c3638f0e tools: add missing stuff to Makefile.am
Signed-off-by: Karel Zak <kzak@redhat.com>
2021-04-09 07:53:21 +02:00
Karel Zak acd1b6b72c tools: replace checkmans.sh with adoc scripts
Signed-off-by: Karel Zak <kzak@redhat.com>
2021-04-08 14:19:52 +02:00
Zbigniew Jędrzejewski-Szmek d4c880d5a4 meson: add second build system
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?
2021-03-17 15:07:27 +01:00
Karel Zak e86e30b89c tools: use libcryptsetup in config-gen.d/all.conf
Signed-off-by: Karel Zak <kzak@redhat.com>
2021-03-17 12:45:40 +01:00
Evgeny Vereshchagin b62ec52e8f tests: add a fuzz target calling fdisk_script_read_file
It has already found a couple of issues mentioned in
https://github.com/karelzak/util-linux/issues/1023#issuecomment-671910621
2020-08-10 23:30:50 +00:00
Evgeny Vereshchagin 6e277b7a97 tests: pack testcases into zip archives
so that OSS-Fuzz can use them as seed corpora

Signed-off-by: Evgeny Vereshchagin <evvers@ya.ru>
2020-08-06 12:33:11 +00:00
Evgeny Vereshchagin 2cdbf06f5e tests: add a fuzzer for process_wtmp_file
Signed-off-by: Evgeny Vereshchagin <evvers@ya.ru>
2020-08-06 12:33:11 +00:00
Evgeny Vereshchagin 02f5fc1407 tools: make it possible to set all the fuzzing flags with config-gen
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>
2020-08-06 12:33:11 +00:00
Evgeny Vereshchagin ccdc47b7f5 tests: add a fuzzer for mnt_table_parse_stream
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-482804040
https://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>
2020-08-06 12:33:11 +00:00
Karel Zak 63f4e19928 tools: remove changes merged by accident
Signed-off-by: Karel Zak <kzak@redhat.com>
2020-07-23 11:22:42 +02:00
Karel Zak d35d646f17 po: merge changes
Signed-off-by: Karel Zak <kzak@redhat.com>
2020-07-22 12:20:36 +02:00
Karel Zak bb6561f1a7 build-sys: add --enable-werror to devel build scenarios
Signed-off-by: Karel Zak <kzak@redhat.com>
2020-07-14 12:37:06 +02:00
Karel Zak fadb5ebf9c build-sys: add --with-cryptsetup to config-gen.d/all.conf
Signed-off-by: Karel Zak <kzak@redhat.com>
2019-12-05 14:57:50 +01:00
Elliott Mitchell 2bb3aa36b2 cleanup: Remove some spurious spaces
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>
2019-10-01 13:01:43 +02:00
Sami Kerola 218b1dd6f9
misc: fix typos [codespell]
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2019-09-12 19:41:46 +01:00
Karel Zak 4750cb9126 build-sys: add devel-non-asan.conf
This allows to use "./tools/config-gen devel-non-asan" for ./configure.

Signed-off-by: Karel Zak <kzak@redhat.com>
2019-04-24 18:04:24 +02:00
Karel Zak 58354269eb build-sys: add 'make checklibdoc'
Let's to be sure that all libs API symbols are documented.

Signed-off-by: Karel Zak <kzak@redhat.com>
2019-04-24 18:02:39 +02:00
Karel Zak 7bd44e8ade build-sys: enable ASAN on travis-ci
Addresses: Addresses: https://github.com/systemd/systemd/pull/12252
Signed-off-by: Karel Zak <kzak@redhat.com>
2019-04-15 13:05:33 +02:00
Karel Zak 1007fb6d9c tools: improve checkmans
* ignore .git/
* don't print error messages when error counters are zero
* add new KNOWN_REPEATS[]

Signed-off-by: Karel Zak <kzak@redhat.com>
2018-03-01 13:52:07 +01:00
Ruediger Meier 66b7469960 tools: add segfault detection for checkusage.sh
Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
2017-06-29 14:04:29 +02:00
Ruediger Meier 99267518a6 tools: checkusage can dump all command output
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>
2017-06-27 08:25:22 +02:00
Ruediger Meier e8e9267f5d tools: ignore unsafe commands in checkusage.sh
These commands behave unusual with --unknownopt.

Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
2017-06-27 08:25:10 +02:00
Ruediger Meier 22174021f8 build-sys: fix chown mistake, add checkusage.sh to the dist
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>
2017-06-26 21:00:09 +02:00
Ruediger Meier a3c29314f1 tools: add checkusage.sh
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>
2017-06-26 14:38:24 +02:00
Karel Zak 6f2eb03433 build-sys: fix --disable-all-programs --enable-schedutils
* 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>
2017-02-20 14:17:37 +01:00
Karel Zak 1854d6dfc6 build-sys: add non-widechar.conf
Signed-off-by: Karel Zak <kzak@redhat.com>
2017-02-16 13:47:44 +01:00
Karel Zak e1a0fd98cd build-sys: use sed to substitute
Travis CI:
tools/git-version-gen: 116: tools/git-version-gen: Bad substitution

Signed-off-by: Karel Zak <kzak@redhat.com>
2016-11-29 14:25:23 +01:00
Ruediger Meier 85004b142a build-sys: fix "remove the g in git describe"
The "g" was not always removed and "-rc*" follow-ups were handled
incorrectly.

So now after last commits we have these versions:

 git describe            -> blkid -V
 --------------------------------------------------------------
 v2.29-rc4               -> 2.29-rc4          (libblkid 2.29.0)
 v2.29-rc4-3-g4c8928d    -> 2.29-rc4-3-4c89   (libblkid 2.29.0)

 v2.29                   -> 2.29              (libblkid 2.29.0)
 v2.29-78-g4c8928d       -> 2.29.78-4c89      (libblkid 2.29.78)

 v2.29.1                 -> 2.29.1            (libblkid 2.29.1)
 v2.29.1-4-g4c8928d      -> 2.29.1.4-4c89     (libblkid 2.29.1)

 v2.29.1-rc2             -> 2.29.1-rc2        (libblkid 2.29.1)
 v2.29.1-rc2-3-g4c8928d  -> 2.29.1-rc2-3-4c89 (libblkid 2.29.1)

Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
2016-11-29 10:47:11 +01:00
Ruediger Meier 6ac59b5bd5 build-sys: remove old git fallback from git-version-gen
Just make the script more readable. Nobody is using 10 years old
git.

Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
2016-11-29 10:47:11 +01:00
Karel Zak b5a58919a9 tools: make ko-release-gen usable with gpg2
Signed-off-by: Karel Zak <kzak@redhat.com>
2016-10-01 01:20:06 +02:00
Karel Zak 702b6b5f7f build-sys: add tools/Makemodule.am
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>
2016-05-25 15:59:15 +02:00
Karel Zak 5d25b7814f tools: add script to load .po from translationproject.org
I use it for years, let's keep it in the repository.

Signed-off-by: Karel Zak <kzak@redhat.com>
2016-05-25 15:28:42 +02:00
Karel Zak 5ae7ae8adb tools: add missing checkcompletion.sh
Signed-off-by: Karel Zak <kzak@redhat.com>
2016-03-17 14:34:29 +01:00
Ruediger Meier 51658498c4 build-sys: portable usage of find command
- use dot instead of skipping search-path
 - avoid -perm /a+x
 - avoid -path

Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
2016-02-18 12:53:47 +01:00
Sami Kerola 6e93ae8414 tools: stop checkmans.sh validating libtool builds
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>
2015-08-07 21:34:42 +01:00
Karel Zak d43ec106e4 tools: add hexdump badconv() to noreturn smatch list
Signed-off-by: Karel Zak <kzak@redhat.com>
2015-08-05 13:18:40 +02:00
Karel Zak 06df240c92 tools: add err_oom() to smatch no_return_funcs
Signed-off-by: Karel Zak <kzak@redhat.com>
2015-08-05 12:41:17 +02:00
Karel Zak 9465221848 tools: add libfdisk docs to kernel.org release generator
Signed-off-by: Karel Zak <kzak@redhat.com>
2015-02-19 13:43:42 +01:00
J William Piggott b8239769f9 tools: checkmans.sh add stats
Add test results statistics.
Fix-up 'KNOWN_REPEATS'.
Version bump.

Signed-off-by: J William Piggott <elseifthen@gmx.com>
2015-01-13 11:43:46 -05:00
J William Piggott 7d2ba7ad23 tools: checkmans.sh clean up 'let'
Clean up 'let' issues and loop iteration.

Signed-off-by: J William Piggott <elseifthen@gmx.com>
2015-01-13 11:43:45 -05:00
J William Piggott 34317b9292 tools: checkman.sh portability lexgrog
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>
2015-01-13 11:43:45 -05:00
J William Piggott d1fd99e8e0 tools: checkman.sh portability
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>
2015-01-13 11:43:45 -05:00
Karel Zak ae2f2f5617 build-sys: add libsmartcols to ko-release-gen script
Signed-off-by: Karel Zak <kzak@redhat.com>
2014-06-18 15:42:09 +02:00
Karel Zak b56dd06df6 tests: update build tests
Signed-off-by: Karel Zak <kzak@redhat.com>
2014-06-18 12:46:04 +02:00
Karel Zak fd0e5ae46e build-sys: add non-libsmartcols.conf
Signed-off-by: Karel Zak <kzak@redhat.com>
2014-06-18 12:44:37 +02:00
Karel Zak f080cc99c8 build-sys: add disable-all.conf to config-gen
Signed-off-by: Karel Zak <kzak@redhat.com>
2014-05-27 11:37:18 +02:00