Commit Graph

15174 Commits

Author SHA1 Message Date
Karel Zak c59d442809 libsmartcols: add sort sunction to the sample
Signed-off-by: Karel Zak <kzak@redhat.com>
2021-03-24 12:42:58 +01:00
Karel Zak d928b9afe2 tests: make it compatible with meson
Signed-off-by: Karel Zak <kzak@redhat.com>
2021-03-22 15:15:52 +01:00
Karel Zak 3ab4ef3ca9 findmnt: add --shadowed
Signed-off-by: Karel Zak <kzak@redhat.com>
2021-03-22 15:00:47 +01:00
Karel Zak 1c81dfff1a libmount: mnt_table_over_fs() make child optional
Signed-off-by: Karel Zak <kzak@redhat.com>
2021-03-22 15:00:47 +01:00
Karel Zak 667c87c50c findmnt: sort columns
Let's make "Available columns" in --help more readable.

Signed-off-by: Karel Zak <kzak@redhat.com>
2021-03-22 15:00:38 +01:00
Karel Zak e2f6c9eaa2 umount: support over-mounts for --recursive
For example for hierarchy:

  $ findmnt -oTARGET,ID,PARENT
  TARGET                      ID PARENT
  /mnt/A                     802     62
  └─/mnt/A/B                 937    802
    ├─/mnt/A/B/C             964    937
    │ └─/mnt/A/B/C           991    964
    └─/mnt/A/B              1018    937
      └─/mnt/A/B            1045   1018

we need umount in order (id): 1045, 1018, 991, 964, 937, 802. The current
code first tries 991 in 937 branch.

Reported-by: Lennart Poettering <lennart@poettering.net>
Signed-off-by: Karel Zak <kzak@redhat.com>
2021-03-22 11:29:28 +01:00
Karel Zak a605568281 libmount: add mnt_table_over_fs()
The function returns the first over-mount for specified filesystem.

Signed-off-by: Karel Zak <kzak@redhat.com>
2021-03-22 11:24:49 +01:00
Karel Zak 7f8b777407 findmnt: add PARENT column
Signed-off-by: Karel Zak <kzak@redhat.com>
2021-03-19 16:39:27 +01:00
Karel Zak 93737ad351 libfdisk: (gpt) returns location of the backup header too
Reported-by: Lennart Poettering <lennart@poettering.net>
Signed-off-by: Karel Zak <kzak@redhat.com>
2021-03-19 14:54:34 +01:00
Karel Zak 1ad8db5521 prlimit: fix optional arguments parsing
$ prlimit -f=100:100
 failed to parse FSIZE limit

Fixes: https://github.com/karelzak/util-linux/issues/1265
Signed-off-by: Karel Zak <kzak@redhat.com>
2021-03-18 10:23:36 +01:00
Karel Zak 6e13cfed58 meson: add missing HAVE_ definitions
Signed-off-by: Karel Zak <kzak@redhat.com>
2021-03-17 15:52:08 +01:00
Karel Zak bdaed0cde4 meson: update for new hardlink
Signed-off-by: Karel Zak <kzak@redhat.com>
2021-03-17 15:42:26 +01:00
Karel Zak ec98fc6b1a meson: port localstatedir and sysconfdir
Signed-off-by: Karel Zak <kzak@redhat.com>
2021-03-17 15:07:27 +01:00
Karel Zak 308a097968 meson: update sources and dependencies
Signed-off-by: Karel Zak <kzak@redhat.com>
2021-03-17 15:07:27 +01:00
Karel Zak 6e92db54cf meson: update configuration
Signed-off-by: Karel Zak <kzak@redhat.com>
2021-03-17 15:07:27 +01:00
Zbigniew Jędrzejewski-Szmek 69939195bd meson: implement building of static programs
The whole thing is complicated by the fact that we have two layers
of libraries: e.g. libmount also needs libblkid. If we just tell meson
to make libmount static, this is not enough, because we also need it
to link to a static libblkid. Hence in the case of libs that link to
other libs internally, we need to create a different object with a
a different set of link_with items.

To avoid building the libraries twice, libfdisk and libmount are first
built into an internal "convenience" library, which is then linked into
the static and shared versions as appropriate.
2021-03-17 15:07:27 +01: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
Zbigniew Jędrzejewski-Szmek 9fb5486c27 tests/run: create failure directory
The test would occasionally fail with
tests/run.sh: line 241: /home/fedora/util-linux/build/tests/failures: No such file or directory

I don't quite understand why the file does not get created... The outupt directory
missing seems the most likely explanation.
2021-03-17 15:07:27 +01:00
Karel Zak d246854aa8 tests: update build test results
Update as usually before release to see differences (on Fedora 33).

- static programs are not enabled by tools/config-gen.d/all.conf
  anymore (see 63f4e19928)
- add new uclampset
- libdl and libpython3 seems unnecessary
- fdformat disabled by default
- new hardlink uses libpcre2-posix

Signed-off-by: Karel Zak <kzak@redhat.com>

Signed-off-by: Karel Zak <kzak@redhat.com>
2021-03-17 14:58:26 +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
Łukasz Stelmach c8650db343 hwclock: fix indentation
Fixes: 042f62dfc ("[clang-tidy] do not use else after return")
Signed-off-by: Łukasz Stelmach <l.stelmach@samsung.com>
2021-03-16 14:23:48 +01:00
Karel Zak 075e9f9cbd build-sys: add EXTRA_LTLIBRARIES beween CLEANFILES
Signed-off-by: Karel Zak <kzak@redhat.com>
2021-03-16 12:32:21 +01:00
Karel Zak f823700f61 pylibmount: PyEval_Call* is deprecate, use PyObject_Call*
Signed-off-by: Karel Zak <kzak@redhat.com>
2021-03-15 16:37:47 +01:00
Karel Zak ff3a3c3c49 Merge branch 'extra_ltlibraries' of https://github.com/bluca/util-linux
* 'extra_ltlibraries' of https://github.com/bluca/util-linux:
  Automake: install uuidgen bash completion only if it is built
  Automake: use EXTRA_LTLIBRARIES instead of noinst_LTLIBRARIES
2021-03-15 16:22:20 +01:00
Karel Zak ef7e258b3d libsmratcols: print title color only when wanted
Reference: 676fb001d6.
Signed-off-by: Karel Zak <kzak@redhat.com>
2021-03-15 16:19:23 +01:00
Luca Boccassi e18f057b56 Automake: install uuidgen bash completion only if it is built
Check for BUILD_UUIDGEN instead of BUILD_LIBUUID
2021-03-15 12:26:27 +00:00
Luca Boccassi c65953d72b Automake: use EXTRA_LTLIBRARIES instead of noinst_LTLIBRARIES
noinst_LTLIBRARIES causes the libraries to be always built
unconditionally. EXTRA_LTLIBRARIES causes them to be built
only if other build target needs them.
In other words, avoid building libcommon.a and libtcolors.a
unless they are needed by another library/executable and
save some build time.

https://www.gnu.org/software/automake/manual/html_node/Libtool-Convenience-Libraries.html
2021-03-15 12:17:31 +00:00
Karel Zak 676fb001d6 libsmartcols: fix colors use
* use color for all cell
* always switch back to line color

Signed-off-by: Karel Zak <kzak@redhat.com>
2021-03-12 16:15:16 +01:00
Karel Zak b09ed927d7 tests: update mountpoint return code chack
This is necessary due to e0ecd19641.

Signed-off-by: Karel Zak <kzak@redhat.com>
2021-03-12 11:39:23 +01:00
Karel Zak 4e9be5a439 findmnt: (man) add more info about --target
Signed-off-by: Karel Zak <kzak@redhat.com>
2021-03-12 11:00:56 +01:00
Karel Zak 70a7b61a84 tests: update mountpoint tests
Signed-off-by: Karel Zak <kzak@redhat.com>
2021-03-11 10:52:11 +01:00
Karel Zak e0ecd19641 mountpoint: different exit status for errors and non-mountpoint situation
Fixes: https://github.com/karelzak/util-linux/issues/1260
Signed-off-by: Karel Zak <kzak@redhat.com>
2021-03-11 10:48:36 +01:00
Karel Zak 6b6dbcbae6 docs: update TODO
Signed-off-by: Karel Zak <kzak@redhat.com>
2021-03-10 16:15:30 +01:00
Karel Zak c173ba11ec libsmartcols: add comments to private header file
Signed-off-by: Karel Zak <kzak@redhat.com>
2021-03-10 11:30:53 +01:00
Karel Zak 2b1322f478 docs: update TODO
Signed-off-by: Karel Zak <kzak@redhat.com>
2021-03-10 10:21:57 +01:00
Karel Zak b4f6006209 lscpu: use size_t for ncolumns
Signed-off-by: Karel Zak <kzak@redhat.com>
2021-03-09 15:55:33 +01:00
Karel Zak 1242c3fde7 lscpu: support +list for -e, -p and -C
For example "lscpu -e=+MHZ" to list the default columns and MHZ. We
use the same in other tools.

Signed-off-by: Karel Zak <kzak@redhat.com>
2021-03-09 10:37:36 +01:00
Karel Zak 0b83e26373 lscpu: add info that caches sizes are sum
Addresses: https://github.com/karelzak/util-linux/issues/1258
Signed-off-by: Karel Zak <kzak@redhat.com>
2021-03-08 11:25:15 +01:00
Karel Zak 347332796f fdisk: (man) add info about order for -l
Reported-by: Dan Jacobson <jidanni@jidanni.org>
Signed-off-by: Karel Zak <kzak@redhat.com>
2021-03-08 10:56:47 +01:00
Karel Zak 81329c8d1c hwclock: use pointer to adjtime data
Signed-off-by: Karel Zak <kzak@redhat.com>
2021-03-04 11:27:47 +01:00
Andrew Shapiro f3a7b057ac utmpdup: Ensure flushing when using follow flag
The following usages of utmpdump result in no output being flushed to the specified file because the default output buffering is fully buffered:

$ utmpdump --follow --output myOutputFile /var/log/utmp
$ utmpdump --follow /var/log/utmp > myOutputFile

This change configures line buffering for these scenarios so that output will be flushed after each log event.

Signed-off-by: Andrew Shapiro <anshapiro@gmail.com>
2021-03-02 10:49:53 +01:00
Karel Zak 50cc633257 dmesg: fix and cleanup --read-clear
The function read_buffer() implements read and clear functionally, but
we do not differentiate between these actions in main() for error
messages, and one generic "dmesg: read kernel buffer failed" is used
in all cases. That's a bug.

This patch removes the "clear" action from read_buffer() and keeps it
for buffer reading only.  The "clear" action is implemented in main()
by separate klogctl(SYSLOG_ACTION_CLEAR) for cases. It means also for
"dmesg --read-clear"; we do not use SYSLOG_ACTION_READ_CLEAR anymore.

Now "clear+read" is:

 * syslog: SYSLOG_ACTION_READ_ALL + SYSLOG_ACTION_CLEAR
 * kmsg:   /dev/kmsg read()       + SYSLOG_ACTION_CLEAR

In old versions "dmesg --syslog --read-clear" (syalog backed) was
implemented by      logctl(SYSLOG_ACTION_READ_CLEAR) and it returns no
data for non-root  users (due to EPERM), "dmesg --read-clear" (kmsg)
returns data and EPERM for the "clear" action.

Now the command "dmesg --syslog --read-clear" and "dmesg --read-clear"
behaves in the same way -- returns data and EPERM for the "clear"
action.

Fixes: https://github.com/karelzak/util-linux/issues/1255
Signed-off-by: Karel Zak <kzak@redhat.com>
2021-03-01 16:50:20 +01:00
Karel Zak 66134b5c2b lsblk: update man page
Signed-off-by: Karel Zak <kzak@redhat.com>
2021-03-01 14:51:28 +01:00
Karel Zak 7de3b2ce59 Merge branch 'master' of https://github.com/adigitoleo/util-linux 2021-03-01 14:46:50 +01:00
Leon 679686b27c
Update lsblk.8 2021-03-01 22:47:27 +11:00
Karel Zak 55d2dfa12c irqtop: check scols_line_set_data() return code
Signed-off-by: Karel Zak <kzak@redhat.com>
2021-02-25 14:37:17 +01:00
Karel Zak 61074478fa irqtop: small cleanup
Signed-off-by: Karel Zak <kzak@redhat.com>
2021-02-25 09:57:49 +01:00
Štěpán Němec 3d0620a9a8 su: fix man page typos
Signed-off-by: Štěpán Němec <snemec@redhat.com>
2021-02-25 09:34:30 +01:00
Karel Zak a23aecc1bf irqtop: add per-cpu stats
irqtop | total: 1245107402 delta: 7394 | ws.net.home | 2021-02-24 20:11:09+01:00

        cpu0 cpu1 cpu2 cpu3 cpu4 cpu5 cpu6 cpu7
  %irq: 12.9 13.0 12.8 11.9 12.4 13.4 11.6 12.0
%delta: 13.7  9.7 22.6  7.9  9.5 17.5  8.3 10.8

       IRQ      TOTAL      DELTA NAME
       LOC  989162414       6111 Local timer interrupts
       TLB  100492740         67 TLB shootdowns
       CAL   95058001        321 Function call interrupts
        42   23893801        241 IR-PCI-MSI 1048576-edge nvidia
        30   20209392        494 IR-PCI-MSI 327680-edge xhci_hcd
       RES   12996335         86 Rescheduling interrupts
        29    1354219          4 IR-PCI-MSI 512000-edge ahci[0000:00:1f.2]
        41     682653         31 IR-PCI-MSI 409600-edge eno1
   ...

Signed-off-by: Karel Zak <kzak@redhat.com>
2021-02-24 20:11:05 +01:00
Karel Zak 1b889dcc07 irqtop: print header in reverse mode
Signed-off-by: Karel Zak <kzak@redhat.com>
2021-02-24 14:29:20 +01:00