]> git.ipfire.org Git - thirdparty/util-linux.git/log
thirdparty/util-linux.git
4 years agolibsmartcols: add sort sunction to the sample
Karel Zak [Wed, 24 Mar 2021 11:42:58 +0000 (12:42 +0100)] 
libsmartcols: add sort sunction to the sample

Signed-off-by: Karel Zak <kzak@redhat.com>
4 years agotests: make it compatible with meson
Karel Zak [Mon, 22 Mar 2021 14:15:52 +0000 (15:15 +0100)] 
tests: make it compatible with meson

Signed-off-by: Karel Zak <kzak@redhat.com>
4 years agofindmnt: add --shadowed
Karel Zak [Mon, 22 Mar 2021 13:58:05 +0000 (14:58 +0100)] 
findmnt: add --shadowed

Signed-off-by: Karel Zak <kzak@redhat.com>
4 years agolibmount: mnt_table_over_fs() make child optional
Karel Zak [Mon, 22 Mar 2021 13:57:07 +0000 (14:57 +0100)] 
libmount: mnt_table_over_fs() make child optional

Signed-off-by: Karel Zak <kzak@redhat.com>
4 years agofindmnt: sort columns
Karel Zak [Mon, 22 Mar 2021 11:41:37 +0000 (12:41 +0100)] 
findmnt: sort columns

Let's make "Available columns" in --help more readable.

Signed-off-by: Karel Zak <kzak@redhat.com>
4 years agoumount: support over-mounts for --recursive
Karel Zak [Mon, 22 Mar 2021 10:29:28 +0000 (11:29 +0100)] 
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>
4 years agolibmount: add mnt_table_over_fs()
Karel Zak [Mon, 22 Mar 2021 10:24:49 +0000 (11:24 +0100)] 
libmount: add mnt_table_over_fs()

The function returns the first over-mount for specified filesystem.

Signed-off-by: Karel Zak <kzak@redhat.com>
4 years agofindmnt: add PARENT column
Karel Zak [Fri, 19 Mar 2021 15:39:27 +0000 (16:39 +0100)] 
findmnt: add PARENT column

Signed-off-by: Karel Zak <kzak@redhat.com>
4 years agolibfdisk: (gpt) returns location of the backup header too
Karel Zak [Fri, 19 Mar 2021 13:54:34 +0000 (14:54 +0100)] 
libfdisk: (gpt) returns location of the backup header too

Reported-by: Lennart Poettering <lennart@poettering.net>
Signed-off-by: Karel Zak <kzak@redhat.com>
4 years agoprlimit: fix optional arguments parsing
Karel Zak [Thu, 18 Mar 2021 09:23:36 +0000 (10:23 +0100)] 
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>
4 years agomeson: add missing HAVE_ definitions
Karel Zak [Wed, 17 Mar 2021 14:52:08 +0000 (15:52 +0100)] 
meson: add missing HAVE_ definitions

Signed-off-by: Karel Zak <kzak@redhat.com>
4 years agomeson: update for new hardlink
Karel Zak [Wed, 17 Mar 2021 14:42:26 +0000 (15:42 +0100)] 
meson: update for new hardlink

Signed-off-by: Karel Zak <kzak@redhat.com>
4 years agomeson: port localstatedir and sysconfdir
Karel Zak [Wed, 17 Mar 2021 14:07:19 +0000 (15:07 +0100)] 
meson: port localstatedir and sysconfdir

Signed-off-by: Karel Zak <kzak@redhat.com>
4 years agomeson: update sources and dependencies
Karel Zak [Tue, 16 Feb 2021 17:09:24 +0000 (18:09 +0100)] 
meson: update sources and dependencies

Signed-off-by: Karel Zak <kzak@redhat.com>
4 years agomeson: update configuration
Karel Zak [Tue, 16 Feb 2021 11:10:36 +0000 (12:10 +0100)] 
meson: update configuration

Signed-off-by: Karel Zak <kzak@redhat.com>
4 years agomeson: implement building of static programs
Zbigniew Jędrzejewski-Szmek [Mon, 11 May 2020 10:06:39 +0000 (12:06 +0200)] 
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.

4 years agomeson: add second build system
Zbigniew Jędrzejewski-Szmek [Sun, 23 Feb 2020 18:42:55 +0000 (19:42 +0100)] 
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?

4 years agotests/run: create failure directory
Zbigniew Jędrzejewski-Szmek [Thu, 27 Feb 2020 11:13:09 +0000 (12:13 +0100)] 
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.

4 years agotests: update build test results
Karel Zak [Wed, 17 Mar 2021 11:46:22 +0000 (12:46 +0100)] 
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 63f4e199287c6b2cfbb092f1e2b0f0a3e0e576e3)
- 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>
4 years agotools: use libcryptsetup in config-gen.d/all.conf
Karel Zak [Wed, 17 Mar 2021 11:45:40 +0000 (12:45 +0100)] 
tools: use libcryptsetup in config-gen.d/all.conf

Signed-off-by: Karel Zak <kzak@redhat.com>
4 years agohwclock: fix indentation
Łukasz Stelmach [Tue, 16 Mar 2021 11:53:13 +0000 (12:53 +0100)] 
hwclock: fix indentation

Fixes: 042f62dfc ("[clang-tidy] do not use else after return")
Signed-off-by: Łukasz Stelmach <l.stelmach@samsung.com>
4 years agobuild-sys: add EXTRA_LTLIBRARIES beween CLEANFILES
Karel Zak [Tue, 16 Mar 2021 11:32:21 +0000 (12:32 +0100)] 
build-sys: add EXTRA_LTLIBRARIES beween CLEANFILES

Signed-off-by: Karel Zak <kzak@redhat.com>
4 years agopylibmount: PyEval_Call* is deprecate, use PyObject_Call*
Karel Zak [Mon, 15 Mar 2021 15:37:47 +0000 (16:37 +0100)] 
pylibmount: PyEval_Call* is deprecate, use PyObject_Call*

Signed-off-by: Karel Zak <kzak@redhat.com>
4 years agoMerge branch 'extra_ltlibraries' of https://github.com/bluca/util-linux
Karel Zak [Mon, 15 Mar 2021 15:22:20 +0000 (16:22 +0100)] 
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

4 years agolibsmratcols: print title color only when wanted
Karel Zak [Mon, 15 Mar 2021 15:19:23 +0000 (16:19 +0100)] 
libsmratcols: print title color only when wanted

Reference: 676fb001d6b092470d5390adbd0424dfdecafa3c.
Signed-off-by: Karel Zak <kzak@redhat.com>
4 years agoAutomake: install uuidgen bash completion only if it is built
Luca Boccassi [Mon, 15 Mar 2021 12:26:27 +0000 (12:26 +0000)] 
Automake: install uuidgen bash completion only if it is built

Check for BUILD_UUIDGEN instead of BUILD_LIBUUID

4 years agoAutomake: use EXTRA_LTLIBRARIES instead of noinst_LTLIBRARIES
Luca Boccassi [Mon, 15 Mar 2021 12:16:08 +0000 (12:16 +0000)] 
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

4 years agolibsmartcols: fix colors use
Karel Zak [Fri, 12 Mar 2021 15:14:39 +0000 (16:14 +0100)] 
libsmartcols: fix colors use

* use color for all cell
* always switch back to line color

Signed-off-by: Karel Zak <kzak@redhat.com>
4 years agotests: update mountpoint return code chack
Karel Zak [Fri, 12 Mar 2021 10:39:12 +0000 (11:39 +0100)] 
tests: update mountpoint return code chack

This is necessary due to e0ecd196414c03699cd8e8dd2c6f4fe533999837.

Signed-off-by: Karel Zak <kzak@redhat.com>
4 years agofindmnt: (man) add more info about --target
Karel Zak [Fri, 12 Mar 2021 10:00:56 +0000 (11:00 +0100)] 
findmnt: (man) add more info about --target

Signed-off-by: Karel Zak <kzak@redhat.com>
4 years agotests: update mountpoint tests
Karel Zak [Thu, 11 Mar 2021 09:52:11 +0000 (10:52 +0100)] 
tests: update mountpoint tests

Signed-off-by: Karel Zak <kzak@redhat.com>
4 years agomountpoint: different exit status for errors and non-mountpoint situation
Karel Zak [Thu, 11 Mar 2021 09:48:36 +0000 (10:48 +0100)] 
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>
4 years agodocs: update TODO
Karel Zak [Wed, 10 Mar 2021 15:15:30 +0000 (16:15 +0100)] 
docs: update TODO

Signed-off-by: Karel Zak <kzak@redhat.com>
4 years agolibsmartcols: add comments to private header file
Karel Zak [Wed, 10 Mar 2021 10:30:53 +0000 (11:30 +0100)] 
libsmartcols: add comments to private header file

Signed-off-by: Karel Zak <kzak@redhat.com>
4 years agodocs: update TODO
Karel Zak [Wed, 10 Mar 2021 09:21:57 +0000 (10:21 +0100)] 
docs: update TODO

Signed-off-by: Karel Zak <kzak@redhat.com>
4 years agolscpu: use size_t for ncolumns
Karel Zak [Tue, 9 Mar 2021 14:55:33 +0000 (15:55 +0100)] 
lscpu: use size_t for ncolumns

Signed-off-by: Karel Zak <kzak@redhat.com>
4 years agolscpu: support +list for -e, -p and -C
Karel Zak [Tue, 9 Mar 2021 09:37:36 +0000 (10:37 +0100)] 
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>
4 years agolscpu: add info that caches sizes are sum
Karel Zak [Mon, 8 Mar 2021 10:25:15 +0000 (11:25 +0100)] 
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>
4 years agofdisk: (man) add info about order for -l
Karel Zak [Mon, 8 Mar 2021 09:56:47 +0000 (10:56 +0100)] 
fdisk: (man) add info about order for -l

Reported-by: Dan Jacobson <jidanni@jidanni.org>
Signed-off-by: Karel Zak <kzak@redhat.com>
4 years agohwclock: use pointer to adjtime data
Karel Zak [Thu, 4 Mar 2021 10:27:47 +0000 (11:27 +0100)] 
hwclock: use pointer to adjtime data

Signed-off-by: Karel Zak <kzak@redhat.com>
4 years agoutmpdup: Ensure flushing when using follow flag
Andrew Shapiro [Mon, 1 Mar 2021 18:18:27 +0000 (13:18 -0500)] 
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>
4 years agodmesg: fix and cleanup --read-clear
Karel Zak [Mon, 1 Mar 2021 15:50:20 +0000 (16:50 +0100)] 
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>
4 years agolsblk: update man page
Karel Zak [Mon, 1 Mar 2021 13:51:28 +0000 (14:51 +0100)] 
lsblk: update man page

Signed-off-by: Karel Zak <kzak@redhat.com>
4 years agoMerge branch 'master' of https://github.com/adigitoleo/util-linux
Karel Zak [Mon, 1 Mar 2021 13:46:50 +0000 (14:46 +0100)] 
Merge branch 'master' of https://github.com/adigitoleo/util-linux

4 years agoUpdate lsblk.8
Leon [Mon, 1 Mar 2021 11:47:27 +0000 (22:47 +1100)] 
Update lsblk.8

4 years agoirqtop: check scols_line_set_data() return code
Karel Zak [Thu, 25 Feb 2021 13:37:17 +0000 (14:37 +0100)] 
irqtop: check scols_line_set_data() return code

Signed-off-by: Karel Zak <kzak@redhat.com>
4 years agoirqtop: small cleanup
Karel Zak [Thu, 25 Feb 2021 08:57:49 +0000 (09:57 +0100)] 
irqtop: small cleanup

Signed-off-by: Karel Zak <kzak@redhat.com>
4 years agosu: fix man page typos
Štěpán Němec [Tue, 23 Feb 2021 15:25:54 +0000 (16:25 +0100)] 
su: fix man page typos

Signed-off-by: Štěpán Němec <snemec@redhat.com>
4 years agoirqtop: add per-cpu stats
Karel Zak [Wed, 24 Feb 2021 19:10:56 +0000 (20:10 +0100)] 
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>
4 years agoirqtop: print header in reverse mode
Karel Zak [Wed, 24 Feb 2021 13:29:20 +0000 (14:29 +0100)] 
irqtop: print header in reverse mode

Signed-off-by: Karel Zak <kzak@redhat.com>
4 years agodocs: update TODO (scols borders)
Karel Zak [Wed, 24 Feb 2021 12:06:40 +0000 (13:06 +0100)] 
docs: update TODO (scols borders)

Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=1931776
Signed-off-by: Karel Zak <kzak@redhat.com>
4 years agosu: (pty) change owner and mode for pty
Karel Zak [Tue, 23 Feb 2021 10:52:45 +0000 (11:52 +0100)] 
su: (pty) change owner and mode for pty

The current situation:

 # su --pty - kzak
 $ ll $(tty)
 crw--w---- 1 root tty 136, 9 Feb 23 11:53 /dev/pts/9
 $ mesg
 mesg: cannot open /dev/pts/9: Permission denied

the pseudo-terminal is still owned by the original user.

New version:

 # su --pty - kzak
 # ll $(tty)
 crw--w---- 1 kzak tty 136, 9 Feb 23 11:56 /dev/pts/9
 # mesg
 is y

The patch follows login(1) to change the pty owner and group. It
follows "TTYPERM" and "TTYGROUP" from login.defs (or econf lib).

Signed-off-by: Karel Zak <kzak@redhat.com>
4 years agologin: move generic setting to ttyutils.h
Karel Zak [Tue, 23 Feb 2021 10:46:10 +0000 (11:46 +0100)] 
login: move generic setting to ttyutils.h

Signed-off-by: Karel Zak <kzak@redhat.com>
4 years agosu: explicitly enable echo for --pty
Karel Zak [Tue, 23 Feb 2021 10:37:15 +0000 (11:37 +0100)] 
su: explicitly enable echo for --pty

Since 75ccd75a2fa1194c6415c47b0024a438e26f1ad7 we need to explicitly
set echo flag by ul_pty_slave_echo(pty, 1).

Signed-off-by: Karel Zak <kzak@redhat.com>
4 years agofdisk: support partition type name in dialogs
Karel Zak [Tue, 23 Feb 2021 08:25:57 +0000 (09:25 +0100)] 
fdisk: support partition type name in dialogs

Command (m for help): t

Selected partition 1
Partition type or alias (type L to list all): linux root x86
Changed type of partition 'Linux /usr (x86)' to 'Linux root (x86)'.

Signed-off-by: Karel Zak <kzak@redhat.com>
4 years agosfdisk: support for type="partition type name"
Karel Zak [Tue, 23 Feb 2021 08:21:40 +0000 (09:21 +0100)] 
sfdisk: support for type="partition type name"

For example:

 # echo 'size=10MiB, type="linux usr x86"' | sfdisk /dev/sdc
 ...
 New situation:

 Device     Start   End Sectors Size Type
 /dev/sdc1   2048 22527   20480  10M Linux /usr (x86)

Signed-off-by: Karel Zak <kzak@redhat.com>
4 years agolibfdisk: support partition type name parsing
Karel Zak [Tue, 23 Feb 2021 08:19:51 +0000 (09:19 +0100)] 
libfdisk: support partition type name parsing

Add to fdisk_label_advparse_parttype() support for
FDISK_PARTTYPE_PARSE_NAME to parse partition type name.

Signed-off-by: Karel Zak <kzak@redhat.com>
4 years agolib/strutils: add ul_stralnumcmp()
Karel Zak [Tue, 23 Feb 2021 08:19:48 +0000 (09:19 +0100)] 
lib/strutils: add ul_stralnumcmp()

Signed-off-by: Karel Zak <kzak@redhat.com>
4 years agobuild-sys: set localstatedir and sysconfdir default
Karel Zak [Fri, 19 Feb 2021 11:04:39 +0000 (12:04 +0100)] 
build-sys: set localstatedir and sysconfdir default

Let's follow our policy for default directories and explicitly default
to localstatedir=/var and sysconfdir=/etc when the default $prefix is
used.

Reported-by: Bruce Dubbs <bruce.dubbs@gmail.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
4 years agoreadprofile: fix static analyzer warning [coverity scan]
Karel Zak [Thu, 18 Feb 2021 10:15:48 +0000 (11:15 +0100)] 
readprofile: fix static analyzer warning [coverity scan]

Make sure we do not use step=0 and zero "fn_add - add0" as divisor.

Signed-off-by: Karel Zak <kzak@redhat.com>
4 years agorfkill: fix static analyzer warning [coverity scan]
Karel Zak [Thu, 18 Feb 2021 10:09:31 +0000 (11:09 +0100)] 
rfkill: fix static analyzer warning [coverity scan]

>>>     CID 365738:  Uninitialized variables  (UNINIT)
>>>     Using uninitialized value "ret". Field "ret" is uninitialized.
326             return ret;

Signed-off-by: Karel Zak <kzak@redhat.com>
4 years agohardlink: fix typo in man page
Karel Zak [Thu, 18 Feb 2021 09:48:47 +0000 (10:48 +0100)] 
hardlink: fix typo in man page

Addresses: https://github.com/karelzak/util-linux/commit/3292501316f5731d8e311a000012b49a411a36e6#commitcomment-47222034
Signed-off-by: Karel Zak <kzak@redhat.com>
4 years agolibmount: (python) fix compiler warning
Karel Zak [Wed, 17 Feb 2021 11:25:49 +0000 (12:25 +0100)] 
libmount: (python) fix compiler warning

Signed-off-by: Karel Zak <kzak@redhat.com>
4 years agolib: use procutils.c on Linux only
Karel Zak [Wed, 17 Feb 2021 11:24:13 +0000 (12:24 +0100)] 
lib: use procutils.c on Linux only

Fixes: https://github.com/karelzak/util-linux/issues/1251
Signed-off-by: Karel Zak <kzak@redhat.com>
4 years agohardlink: fix indention
Karel Zak [Wed, 17 Feb 2021 10:48:03 +0000 (11:48 +0100)] 
hardlink: fix indention

The original Julian's hardlink.c code is pretty readable, but for
util-linux we use a little different indention (aka Linux kernel
coding style).

Signed-off-by: Karel Zak <kzak@redhat.com>
4 years agotests: update hardlink tests
Karel Zak [Wed, 17 Feb 2021 10:15:45 +0000 (11:15 +0100)] 
tests: update hardlink tests

The important is result, not summary or verbose output.

Signed-off-by: Karel Zak <kzak@redhat.com>
4 years agohardlink: add --quiet option
Karel Zak [Wed, 17 Feb 2021 10:14:54 +0000 (11:14 +0100)] 
hardlink: add --quiet option

Signed-off-by: Karel Zak <kzak@redhat.com>
4 years agohardlink: cleanup man page
Karel Zak [Fri, 5 Feb 2021 10:42:44 +0000 (11:42 +0100)] 
hardlink: cleanup man page

Signed-off-by: Karel Zak <kzak@redhat.com>
4 years agohardlink: s/DEBUG/VERBOSE/
Karel Zak [Fri, 5 Feb 2021 10:13:13 +0000 (11:13 +0100)] 
hardlink: s/DEBUG/VERBOSE/

We usually use "debug" for very detailed information. For end-user
information is better to talk about "verbose" output.

Signed-off-by: Karel Zak <kzak@redhat.com>
4 years agohardlink: translate verbose messages
Karel Zak [Fri, 5 Feb 2021 10:09:50 +0000 (11:09 +0100)] 
hardlink: translate verbose messages

Signed-off-by: Karel Zak <kzak@redhat.com>
4 years agohardlink: cleanup summary
Karel Zak [Fri, 5 Feb 2021 10:06:48 +0000 (11:06 +0100)] 
hardlink: cleanup summary

Signed-off-by: Karel Zak <kzak@redhat.com>
4 years agohardlink: use size_to_human_string()
Karel Zak [Fri, 5 Feb 2021 09:58:29 +0000 (10:58 +0100)] 
hardlink: use size_to_human_string()

Signed-off-by: Karel Zak <kzak@redhat.com>
4 years agohardlink: use only err.h to print errors and warnings
Karel Zak [Thu, 4 Feb 2021 12:56:45 +0000 (13:56 +0100)] 
hardlink: use only err.h to print errors and warnings

Signed-off-by: Karel Zak <kzak@redhat.com>
4 years agohardlink: use monotonic time like other utils
Karel Zak [Thu, 4 Feb 2021 12:43:05 +0000 (13:43 +0100)] 
hardlink: use monotonic time like other utils

- use out gettime_monotonic()
- use timeval for calculation rather than double

Signed-off-by: Karel Zak <kzak@redhat.com>
4 years agohardlink: use errx() when parse options
Karel Zak [Thu, 4 Feb 2021 12:23:32 +0000 (13:23 +0100)] 
hardlink: use errx() when parse options

Don't waste time with some cleanup on --exclude and --include regex
errors.

Signed-off-by: Karel Zak <kzak@redhat.com>
4 years agohardlink: use err() if possible
Karel Zak [Thu, 4 Feb 2021 12:14:51 +0000 (13:14 +0100)] 
hardlink: use err() if possible

Signed-off-by: Karel Zak <kzak@redhat.com>
4 years agohardlink: cleanup --minimum-size stuff
Karel Zak [Thu, 4 Feb 2021 12:06:56 +0000 (13:06 +0100)] 
hardlink: cleanup --minimum-size stuff

* use uintmax_t
* use strtosize_or_err()
* add info about suffixes to man page

Signed-off-by: Karel Zak <kzak@redhat.com>
4 years agohardlink: move default to options initialization
Karel Zak [Thu, 4 Feb 2021 11:54:45 +0000 (12:54 +0100)] 
hardlink: move default to options initialization

Signed-off-by: Karel Zak <kzak@redhat.com>
4 years agohardlink: cleanup usage()
Karel Zak [Thu, 4 Feb 2021 11:50:10 +0000 (12:50 +0100)] 
hardlink: cleanup usage()

Let's make --help more util-linux compatible.

Signed-off-by: Karel Zak <kzak@redhat.com>
4 years agohardlink: use our xalloc.h
Karel Zak [Thu, 4 Feb 2021 11:19:34 +0000 (12:19 +0100)] 
hardlink: use our xalloc.h

Signed-off-by: Karel Zak <kzak@redhat.com>
4 years agohardlink: check and use sys/xattr.h
Karel Zak [Thu, 4 Feb 2021 11:14:13 +0000 (12:14 +0100)] 
hardlink: check and use sys/xattr.h

Signed-off-by: Karel Zak <kzak@redhat.com>
4 years agohardlink: use PRCE2 posix header file
Karel Zak [Thu, 4 Feb 2021 11:06:53 +0000 (12:06 +0100)] 
hardlink: use PRCE2 posix header file

Signed-off-by: Karel Zak <kzak@redhat.com>
4 years agohardlink: cleanup includes and types
Karel Zak [Thu, 4 Feb 2021 10:12:21 +0000 (11:12 +0100)] 
hardlink: cleanup includes and types

* use config.h like other code on package
* use c.h and remove from code stuff defined in the header file
* remove FALSE/TRUE redefinition

Signed-off-by: Karel Zak <kzak@redhat.com>
4 years agohardlink: replace with code from Debian
Karel Zak [Thu, 4 Feb 2021 09:42:53 +0000 (10:42 +0100)] 
hardlink: replace with code from Debian

The current version used in util-linux is based on original code from
Jakub Jelinek.

The new version is based on Debian implementation from
https://salsa.debian.org/jak/hardlink.  This new version uses nftw()
to walk on directories tree and organize internal data binary tree
(tsearch() and twalk()). This new version provides more features like
--ignore-{mode,owner,time}, --respect-xattrs, --respect-name,
--include, --keep-oldest, --minimize, --maximize, etc.

Note that the new version uses -f for --respect-name, the old version
uses -f to hardlinking across filesystems (very probably rarely unused
feature).

Addresses: https://github.com/karelzak/util-linux/issues/808
Signed-off-by: Karel Zak <kzak@redhat.com>
4 years agoci: trigger CiFuzz for the master branch only
Evgeny Vereshchagin [Mon, 15 Feb 2021 13:25:19 +0000 (13:25 +0000)] 
ci: trigger CiFuzz for the master branch only

CIFuzz and OSS-Fuzz are in sync with the master branch so it would
probably make sense to avoid running it for long-lived branches.

Inspired by https://github.com/karelzak/util-linux/pull/1248#issuecomment-776342252

Signed-off-by: Evgeny Vereshchagin <evvers@ya.ru>
4 years agotests: don't reply on scsi_debug partitions
Karel Zak [Thu, 11 Feb 2021 11:44:44 +0000 (12:44 +0100)] 
tests: don't reply on scsi_debug partitions

The disk layout as created by scsi_debug depends on kernel version.
Let's make the partition sizes hardcoded in our tests than rely on
kernel.

Signed-off-by: Karel Zak <kzak@redhat.com>
4 years agolibfdisk: (dos) fix last possible sector calculation
Karel Zak [Thu, 11 Feb 2021 10:49:56 +0000 (11:49 +0100)] 
libfdisk: (dos) fix last possible sector calculation

* rename 'last' to 'first' as we use this value as the first available free
  sector rather than last used

* use '-1' when calculate last partition sector to compare with last
  disk sector

* improve debug messages

Fixes: https://github.com/karelzak/util-linux/issues/1249
Signed-off-by: Karel Zak <kzak@redhat.com>
4 years agoagetty: tty eol defaults to REPRINT
Sami Loone [Tue, 9 Feb 2021 09:46:36 +0000 (10:46 +0100)] 
agetty: tty eol defaults to REPRINT

Adapting tty eol settings from defaults misbehaves as CTRL('r') aka
REPRINT is confused with CR. Consequently --skip-login does not set
tty CR<->NL translations and thus acts against advertised CR as eol
default.

[kzak@redhat.com:
   It seems this issue has been introduced by commit f566447 where we
   merged sulogin and agetty terminal initialization together to the file
   include/ttyutils.h.

  The original agetty has really used .eol=13 (aka CR) for the default.
  The problem is invisible for sulogin(1) because it always asks for a
  password and .eol= is set to NL/CR, the same agetty when it asks for
  username.]

Addresses: https://github.com/karelzak/util-linux/pull/1247
Signed-off-by: Karel Zak <kzak@redhat.com>
4 years agoMerge branch 'switch_root-check-if-mounted' of https://github.com/Whissi/util-linux
Karel Zak [Wed, 10 Feb 2021 09:52:16 +0000 (10:52 +0100)] 
Merge branch 'switch_root-check-if-mounted' of https://github.com/Whissi/util-linux

4 years agotests: be explicit with file permissions for cramfs
Karel Zak [Tue, 9 Feb 2021 17:02:13 +0000 (18:02 +0100)] 
tests: be explicit with file permissions for cramfs

Signed-off-by: Karel Zak <kzak@redhat.com>
4 years agolibmount: fix /{etc,proc}/filesystems use
Karel Zak [Tue, 9 Feb 2021 09:36:04 +0000 (10:36 +0100)] 
libmount: fix /{etc,proc}/filesystems use

* always update context->helper
* consolidate helper and syscall status use

Signed-off-by: Karel Zak <kzak@redhat.com>
4 years agoswitch_root: check if mount point to move even exists
Thomas Deutschmann [Mon, 8 Feb 2021 14:30:25 +0000 (15:30 +0100)] 
switch_root: check if mount point to move even exists

Signed-off-by: Thomas Deutschmann <whissi@gentoo.org>
4 years agobuild-sys: add --disable-scriptutils
Karel Zak [Mon, 8 Feb 2021 14:01:33 +0000 (15:01 +0100)] 
build-sys: add --disable-scriptutils

This new ./configure option disables script, scriptreplay ans
scriptlive.

Fixes: https://github.com/karelzak/util-linux/issues/1244
Signed-off-by: Karel Zak <kzak@redhat.com>
4 years agolibsmartcols: remove unnecessary code
Karel Zak [Mon, 8 Feb 2021 13:47:38 +0000 (14:47 +0100)] 
libsmartcols: remove unnecessary code

Fixes: https://github.com/karelzak/util-linux/pull/1243
Signed-off-by: Karel Zak <kzak@redhat.com>
4 years agogithub: fix distcheck job
Karel Zak [Fri, 5 Feb 2021 14:21:56 +0000 (15:21 +0100)] 
github: fix distcheck job

Signed-off-by: Karel Zak <kzak@redhat.com>
4 years agogithub: add 'distcheck' workflow job
Karel Zak [Fri, 5 Feb 2021 14:03:49 +0000 (15:03 +0100)] 
github: add 'distcheck' workflow job

Signed-off-by: Karel Zak <kzak@redhat.com>
4 years agoMerge branch 'gh-actions-bionic' of https://github.com/mrc0mmand/util-linux
Karel Zak [Fri, 5 Feb 2021 09:29:26 +0000 (10:29 +0100)] 
Merge branch 'gh-actions-bionic' of https://github.com/mrc0mmand/util-linux

* 'gh-actions-bionic' of https://github.com/mrc0mmand/util-linux:
  ci: run the build test for each pull request
  ci: build both w/ and w/o sanitizers on GH Actions
  ci: code cleanup
  ci: deal with uninstrumented binaries using instrumented libs
  text-utils: correctly detect ASan under clang
  ci: use the correct compiler version
  ci: 'downgrade' Ubuntu version to Bionic

4 years agobuild-sys: fix schedutils/sched_attr.h include
Karel Zak [Fri, 5 Feb 2021 09:23:04 +0000 (10:23 +0100)] 
build-sys: fix schedutils/sched_attr.h include

Signed-off-by: Karel Zak <kzak@redhat.com>
4 years agologin: use full tty path for PAM_TTY
Karel Zak [Wed, 3 Feb 2021 13:45:15 +0000 (14:45 +0100)] 
login: use full tty path for PAM_TTY

pam_set_item() man page:
 PAM_TTY
   The terminal name: prefixed by /dev/ if it is a device file;
   for graphical, X-based, applications the value for this item
   should be the $DISPLAY variable.

It seems for example pam_timestamp module is not robust enough to
differentiate between /dev/ and pty/0 and it assumes that '/' in the
path always means '/dev/' prefix ...

Fixes: https://github.com/karelzak/util-linux/issues/1242
Signed-off-by: Karel Zak <kzak@redhat.com>
4 years agosu: use full tty path for PAM_TTY
Karel Zak [Wed, 3 Feb 2021 13:45:15 +0000 (14:45 +0100)] 
su: use full tty path for PAM_TTY

pam_set_item() man page:
 PAM_TTY
   The terminal name: prefixed by /dev/ if it is a device file;
   for graphical, X-based, applications the value for this item
   should be the $DISPLAY variable.

It seems for example pam_timestamp module is not robust enough to
differentiate between /dev/ and pty/0 and it assumes that '/' in the
path always means '/dev/' prefix ...

Fixes: https://github.com/karelzak/util-linux/issues/1242
Signed-off-by: Karel Zak <kzak@redhat.com>