Commit Graph

633 Commits

Author SHA1 Message Date
Karel Zak 22fae330d9 blkreport, blkreset: remove in favour of blkzone
Signed-off-by: Karel Zak <kzak@redhat.com>
2017-02-23 17:03:26 +01:00
Karel Zak 1ad8ef9187 blkzone: add new command (merge blkreport and blkreset)
This new command is based on the original implementation of blkreport
and blkreset command.

Signed-off-by: Karel Zak <kzak@redhat.com>
2017-02-23 16:43:51 +01:00
Karel Zak fc72f51e1f build-sys: simplify UL_ENABLE_ALIAS() semantic
Let's follow only $enable_ variables. In this case the MASTERNAME
(e.g. [schedutils] for --enable-schedutils) has to be without
UL_BUILD_INIT.

Signed-off-by: Karel Zak <kzak@redhat.com>
2017-02-21 11:00:19 +01: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
Shaun Tancheff 70bb534511 blkzonecmd, blkreport: Add new commands for ZAC/ZBC drives
This patch adds:
 - blkreset to issue Reset (Write Pointer) zone commands
 - blkreport to retrieve drive zone information

[kzak@redhat.com: - cleanup man page and usage()
                  - remove command line options aliases,
                  - use strtosize_or_err()
                  - remove unnecessary -ludev
                  - use blkdev.h stuff]

Signed-off-by: Shaun Tancheff <shaun@tancheff.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
2017-02-09 13:19:44 +01:00
Karel Zak 1dc2aaadba Merge branch 'hwclock-jwp-reviewed' of git://github.com/kerolasa/lelux-utiliteetit
* 'hwclock-jwp-reviewed' of git://github.com/kerolasa/lelux-utiliteetit: (25 commits)
  hwclock: remove --compare option
  hwclock: remove trailing dot from messages that include system error message
  hwclock: make --date=argument less prone to injection
  hwclock: fix rtc atexit registration
  hwclock: clarify cmos inb and outb preprocessor directives
  hwclock: try RTCGET and RTCSET only when normal rtc fails
  hwclock: stream line synchronize_to_clock_tick_rtc()
  hwclock: improve coding style
  hwclock: remove division by zero [asan]
  hwclock: add debugging to open_rtc()
  hwclock: remove magic constants from interpret_date_string()
  hwclock: use symbolic magic values passed in between functions
  hwclock: initialize struct adjtime members
  hwclock: alloate date_resp parsing buffer in interpret_date_string()
  hwclock: simplify save_adjtime() execution flow
  hwclock: remove dead code and other minor fixes
  hwclock: move error messages to determine_clock_access_method()
  hwclock: clarify set_cmos_epoch() code
  hwclock: move command-line options to control structure
  hwclock: remove unnecessary type casts
  ...
2017-02-09 11:35:50 +01:00
Carlos Santos 4953018e23 build-sys: improve detection of the "isnan" function in uClibc
Since commit beceb14b45, MATH_LIBS is set
to "-lm" when the isnan function is detected. In uClibc, however, isnan
is a macro that calls __isnan, __isnanf, or __isnanl, depending on the
size of the argument (double, float or long double).

Fixes:
  http://autobuild.buildroot.net/results/2c2/2c29a78ed81ca844a87dcd076ab3e14ea080296d/
  http://autobuild.buildroot.net/results/404/404b10f359b2ae8a7216729fa1bab37fed2d3d4c/

Signed-off-by: Carlos Santos <casantos@datacom.ind.br>
2017-02-09 11:31:49 +01:00
Sami Kerola b72a75e993
lib: add timegm() portability function to lib/timeutils.c
Local timegm() is a replacement function in cases it is missing from libc
implementation.  Hopefully the replacement is never, or very rarely, used.

CC: Ruediger Meier <ruediger.meier@ga-group.nl>
Reviewed-by: J William Piggott <elseifthen@gmx.com>
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2017-02-03 22:31:18 +00:00
Denis Chaplygin 833f9a7aae fallocate: Added posix_fallocate() support.
No all filesystems support Linux fallocate. The new option allow use
posix implementation if necessary.

Signed-off-by: Karel Zak <kzak@redhat.com>
2017-01-31 12:51:28 +01:00
Karel Zak feda4342df build-sys: use -lm for scriptreplay if necessary
Reported-by: Bert van Hall <bert.vanhall@avionic-design.de>
Addresses: https://github.com/karelzak/util-linux/pull/397
Signed-off-by: Karel Zak <kzak@redhat.com>
2017-01-18 13:17:21 +01:00
Sami Kerola 875834381d newgrp: use libc explicit_bzero() when it is available
This currently new function will be part of glibc 2.25.

Reference: https://sourceware.org/git/?p=glibc.git;a=commit;h=ea1bd74defcf9d5291d14972e63105168ca9eb4f
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2017-01-16 12:30:09 +01:00
Karel Zak 963f7dfb82 Merge branch 'getrandom' of git://github.com/kerolasa/lelux-utiliteetit
* 'getrandom' of git://github.com/kerolasa/lelux-utiliteetit:
  lib/randutils: use getrandom(2) when it is available
2016-12-22 15:27:25 +01:00
Sami Kerola cc01c2dca4
lib/randutils: use getrandom(2) when it is available
System call getrandom(2) is relatively new, available since kernel 3.17 but
not supported by glibc 2.24.  That in mind autotools is made to check
availability of this function and keep old code as fallback.  It is
reasonable assume it will take years before the syscall(2) and fallback are
unproblematic to remove.

One might ask why bother using getrandom(2).  Main reason is to avoid
unnecessary system calls to achieve exactly same end result.  That
demonstrated with 'strace -c ./mcookie' showing 36 calls before, and 32
after this change.  Secondly the getrandom(2) function got to kernel with
promise it can be used to avoid file descriptor run down, and since uuidd
uses random_get_bytes() it should fulfill it's promise here.

Reference: http://man7.org/linux/man-pages/man2/getrandom.2.html
Reference: https://lwn.net/Articles/606141/
Reviewed-by: Karel Zak <kzak@redhat.com>
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2016-12-11 11:46:54 +00:00
Karel Zak 0a14cc8bcc libmount: revert X-* and x-* meaning
Let's hope this is last change necessary to cleanup x-* usage:

  x-*  persistent option, stored in utab, available for umount, etc.
  X-*  fstab comment only

mount(8) supports x-mount.mkdir= as well as newly recommended X-mount.mkdir=

Advantages:

 * less invasive
 * does not require exception for x-systemd
 * does not require rename x-initrd to X-initrd

The systemd and dracut users will get the new (=fixed) functionality without a
change in fstab configuration. This is the primary goal.

Disadvantages:

 * not 100% compatible libmount behavior, x-* options have not been
   previously stored in utab. The API is the same, options will be still
   available, but on x-* libmount will write to /run/mount/utab. For now
   it seems only systemd uses x-*, and they like this behavior, so...

Addresses: https://github.com/systemd/systemd/pull/4515
Signed-off-by: Karel Zak <kzak@redhat.com>
2016-12-09 15:36:14 +01:00
Karel Zak 5c493bd92f libmount: use x-systemd options as X-*
The previous patch introduces X-* options namespace for options
that have to be maintained in user space.

Unfortunately, systemd users already use mount options that are
necessary by umount or another operations. The conclusion from
discussion with systemd guys is to store all the systemd options
in userspace.

It seems better to add one line exception to libmount than force all
fstab users to rename x-systemd to X-systemd.

Addresses: https://github.com/systemd/systemd/pull/3904
Signed-off-by: Karel Zak <kzak@redhat.com>
2016-12-08 15:27:24 +01:00
Ruediger Meier 809869ca8c build-sys: disable tailf by default
It's deprecated since 3f8478a7, so we shouldn't build it by default.

Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
2016-12-07 12:35:24 +01:00
Ruediger Meier 77835be273 agetty: re-add utmp.h for Debian GNU/kFreeBSD
It's needed there to get login_tty(). On normal FreeBSD we would
need libutil.h.

Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
2016-12-07 12:35:24 +01:00
Ruediger Meier 227ebea75c build-sys: check for POSIX utmpx usage
We simply check for utmpxname and updwtmpx functions to disable
all programs which are not POSIX utmpx compatible, even though
last(1) and utmpdump(1) does not use them, see below.

utmpx.h is used in:
  login agetty write lslogins last runuser su utmpdump wall

Non-Posix utmpx usage:
   utmpxname        -> login agetty write lslogins
   updwtmpx         -> login agetty                     runuser su
   _PATH_.TMP       -> login agetty write lslogins last runuser su
   utmpx.ut_addr_v6 -> login                       last            utmpdump

POSIX utmpx usage:
   wall

Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
2016-12-07 12:35:24 +01:00
Ruediger Meier b4b919fe5e login-utils: switch to utmpx.h
Now the build will fail on many non-Linux systems because
utmpx.h is available everywhere but we still use non-POSIX
features. We'll fix this next commit.

Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
2016-12-07 12:35:24 +01:00
Ruediger Meier 81580f79fa agetty: remove obsolete HAVE_UPDWTMP fallback
Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
2016-12-07 12:35:24 +01:00
Ruediger Meier 6578ced75c login: re-add lastlog.h header
This include was removed in a365953a but we will need it again
when we move from utmp.h to utmpx.h.

On Linux (glibc, musl) the struct lastlog is defined in utmp.h
and lastlog.h just includes utmp.h.

Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>

Conflicts:
	login-utils/login.c

Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
2016-12-07 12:35:24 +01:00
Ruediger Meier a341a5e2e4 build-sys: cosmetics, avoid useless m4 quotes
Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
2016-11-29 12:42:11 +01:00
Ruediger Meier 0f0972ac6b build-sys: cosmetics PACKAGE_VERSION_MINOR
This should changes nothing.

Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
2016-11-29 10:47:11 +01:00
Ruediger Meier b5511797f2 build-sys: update package release number during development
Now we use
   v2.29-5-g8ffab30  -> 2.29.5-8ffa   (libblkid 2.29.5)
instead of
   v2.29-5-g8ffab30  -> 2.29.5-8ffa   (libblkid 2.29.0)

otherwise the bugfix releases (2.29.1) would look newer that latest HEAD.

Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
2016-11-29 10:47:11 +01:00
Ruediger Meier c42a6d4d34 build-sys: fix empty package release number
Was broken for major releases since b0e6b25e:
  $ blkid -V
  blkid from util-linux 2.28  (libblkid 2.28., 12-Apr-2016)

Now we also set 0 in this case, like:
  $ blkid -V
  blkid from util-linux 2.30  (libblkid 2.30.0, 12-Apr-2016)

Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
2016-11-29 10:47:11 +01:00
Karel Zak bdfe4601c3 build-sys: mark lsmem and chmem as Linux only
Signed-off-by: Karel Zak <kzak@redhat.com>
2016-11-09 10:02:32 +01:00
Heiko Carstens 30e1ea8ba1 chmem: new tool
Move the s390 specific chmem tool to util-linux.

The chmem tool was originally written in perl and is part of the
s390-tools package which can be found here:
https://www.ibm.com/developerworks/linux/linux390/s390-tools.html

Given that the tool is architecture independent, there is no reason to
keep it in an s390 specific repository. It seems to be useful for
other architectures as well.

This patch converts the tool to C and adds it to util-linux, while the
command line options stay compatible. The only exception is the option
"-v" which used to be the short form of "--version". That got changed
to "-V" so it behaves like most other tools contained within
util-linux.

The chmem tool can be used to set memory online or offline. This can
be achieved by specifying a memory range:

Memory Block 19 (0x0000000130000000-0x000000013fffffff) disabled

or by specifying a size where chmem will automatically select memory
blocks:

Memory Block 21 (0x0000000150000000-0x000000015fffffff) disable failed
Memory Block 18 (0x0000000120000000-0x000000012fffffff) disabled
Memory Block 17 (0x0000000110000000-0x000000011fffffff) disabled
Memory Block 16 (0x0000000100000000-0x000000010fffffff) disabled
Memory Block 15 (0x00000000f0000000-0x00000000ffffffff) disabled

or by specifying memory block numbers instead of address ranges:

Memory Block 15 (0x00000000f0000000-0x00000000ffffffff) disabled
Memory Block 16 (0x0000000100000000-0x000000010fffffff) disabled
Memory Block 17 (0x0000000110000000-0x000000011fffffff) disabled
Memory Block 18 (0x0000000120000000-0x000000012fffffff) disabled

This is based on a patch from Clemens von Mann.

Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com>
2016-11-09 10:02:32 +01:00
Heiko Carstens cad2d1ac92 lsmem: new tool
Move the s390 specific lsmem tool to util-linux.

The lsmem tool was originally written in perl and is part of the
s390-tools package which can be found here:
https://www.ibm.com/developerworks/linux/linux390/s390-tools.html

Given that the tool is architecture independent, there is no reason to
keep it in an s390 specific repository. It seems to be useful for
other architectures as well.

This patch converts the tool to C and adds it to util-linux, while the
command line options stay compatible. The only exception is the option
"-v" which used to be the short form of "--version". That got changed
to "-V" so it behaves like most other tools contained within
util-linux.

The lsmem tool inspect the contents of /sys/devices/system/memory and
prints a summary output similar to what lscpu does:

RANGE                                 SIZE STATE   REMOVABLE BLOCK
0x0000000000000000-0x000000005fffffff 1,5G online  yes       0-5
0x0000000060000000-0x000000007fffffff 512M online  no        6-7
0x0000000080000000-0x000000013fffffff   3G online  yes       8-19
0x0000000140000000-0x000000014fffffff 256M offline -         20
0x0000000150000000-0x000000017fffffff 768M online  no        21-23

Memory block size   :     256M
Total online memory :     5,8G
Total offline memory:     256M

In order to keep the output small the tool merges subsequent address
ranges where the attributes are identical. To avoid merging of line
the "-a" option can be used.

The lsmem tool also has "--extendend" and "--parsable" option which
can be used to customize the output, e.g.  limit the output to
specified columns. This is quite similar to what the lscpu tool does.

This is based on a patch from Clemens von Mann.

Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com>
2016-11-09 10:02:32 +01:00
Karel Zak 5bd2b14de4 build-sys: release++ (v2.29)
Signed-off-by: Karel Zak <kzak@redhat.com>
2016-11-08 11:35:40 +01:00
Ruediger Meier 4b439e2d00 build-sys: fix missing ncursesw message
Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
2016-10-20 18:32:21 +02:00
Karel Zak e5cc93b5a8 build-sys: use ncurses-config rather than pkg-config
It's painful, but ncurses upstream does not distribute .pc files by
default and it seems that ncurses{6,5}-config is the preferred solution.

For better compatibility lets use ncurses-config.

Reported-by: Ruediger Meier <sweet_f_a@gmx.de>
Signed-off-by: Karel Zak <kzak@redhat.com>
2016-10-20 16:52:31 +02:00
Karel Zak d7b32ebe12 build-sys: release++ (v2.29-rc2)
Signed-off-by: Karel Zak <kzak@redhat.com>
2016-10-19 14:33:55 +02:00
Karel Zak 23f7509326 Revert "su,runuser: add libseccomp based workaround for TIOCSTI ioctl"
This reverts commit 8e49250168.

Stupid hack...
2016-10-03 16:56:56 +02:00
Karel Zak 37301faa01 build-sys: release++ (v2.29-rc1)
Signed-off-by: Karel Zak <kzak@redhat.com>
2016-09-30 11:24:42 +02:00
Karel Zak 8e49250168 su,runuser: add libseccomp based workaround for TIOCSTI ioctl
This patch add libseccomp based syscalls filter to disable TIOCSTI
ioctl in su/runuser children.

IMHO it is not elegant solution due to dependence on libseccomp
(--without-seccomp if hate it)... but there is nothing better for now.

Addresses: CVE-2016-2779
Signed-off-by: Karel Zak <kzak@redhat.com>
2016-09-29 16:32:33 +02:00
Karel Zak 169b4a8cd5 findmnt: (verify) add source verification
Signed-off-by: Karel Zak <kzak@redhat.com>
2016-09-23 13:21:02 +02:00
Karel Zak f319e301a9 build-sys: add parisc to define ARCH_
Signed-off-by: Karel Zak <kzak@redhat.com>
2016-08-16 13:39:07 +02:00
Sami Kerola 00971cca8a
pg: stop building the command by default
The pg command is marked deprecated in POSIX since 1997, and this project
has thought the same since Feb 2013.  Time has come to stop shipping this
binary by default.

Reference: 956e582874
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2016-08-14 13:30:36 +01:00
Karel Zak 3d7cad18e7 build-sys: remove global dependence between widechar and ncursesw
It seems that globally defined dependence between ncursesw and
wide-char support is overkill, because in some cases (e.g. cal(1)) we
can use ncurses independently on wide-char support.

It would be better to care about relation between wide-char and
ncurses individually (per util).

Signed-off-by: Karel Zak <kzak@redhat.com>
2016-06-09 12:39:44 +02:00
Karel Zak db4e264574 build-sys: workaround for autoconf "present but cannot be compiled"
See also:
https://www.gnu.org/software/autoconf/manual/autoconf-2.64/html_node/Present-But-Cannot-Be-Compiled.html

Signed-off-by: Karel Zak <kzak@redhat.com>
2016-06-08 13:38:48 +02:00
Karel Zak dfe177dadb build-sys: add non-action for ncurses pkg-cong test
Signed-off-by: Karel Zak <kzak@redhat.com>
2016-06-08 12:24:10 +02:00
Karel Zak 18dae5d879 build-sys: clean up relation between ncurses[w] and wide-char support
* error if wide-char enabled/supported, but (non-wide) ncurses
  explicitly requested

* disable ncurses at all if widechar enabled/supported, but ncursesw
  not found

Reported-by: Stanislav Brabec <sbrabec@suse.cz>
Signed-off-by: Karel Zak <kzak@redhat.com>
2016-06-08 12:03:15 +02:00
Karel Zak 4ffcc7a93e build-sys: cleanup --with-ncurses
* don't use UL_CHECK_LIB(), only use pkg-config to avoid complexity

 * split --with-ncursesw and --with-ncurses; ncurses (widechar) is the
   default, check for ncurses only if ncursesw disabled/unavailabled

 * don't use generic placeholders, just have_ncursesw and have_ncurses

Signed-off-by: Karel Zak <kzak@redhat.com>
2016-06-08 11:31:31 +02:00
Waldemar Brodkorb bac7fbdb2d build-sys: fix uClibc-ng scanf check
uClibc-ng tries to be compatible with GNU libc and defines
__GLIBC__ and pretend to be version 2.2.
We once changed it to 2.10, but then some hard to fix problems
in different software packages (gcc) occured.
It would be better if we disable the special GNU libc checks
for uClibc-ng here. uClibc-ng implements the required scanf
functionality.

Signed-off-by: Waldemar Brodkorb <wbx@uclibc-ng.org>
2016-06-06 10:04:25 +02:00
Karel Zak d67f61c06d build-sys: use UL_DEFAULT_ENABLE() only for programs
The UL_DEFAULT_ENABLE modifies $enable_<name> according to the global
--enable-all-programs. This makes sense only for programs, but not for
any built-in code.

Signed-off-by: Karel Zak <kzak@redhat.com>
2016-06-03 13:42:40 +02:00
Karel Zak 4cb6fea5cc build-sys: add --disable-widechar
Signed-off-by: Karel Zak <kzak@redhat.com>
2016-06-03 13:41:51 +02:00
Karel Zak 1eb16fd780 build-sys: add --disable-plymouth-support
The plymouth support depends on Linux specific SOCK_* flags and all
the feature is probably unnecessary in some cases (non-plymouth
distros, etc.)

Signed-off-by: Karel Zak <kzak@redhat.com>
2016-05-26 15:08:53 +02:00
Sami Kerola cf582a2e86
build-sys: test functions does not return void
Found using scan-build.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2016-04-19 21:27:54 +01:00
Karel Zak e778642a9e libmount: don't support /etc/mtab by default
The file mtab is evil and already unused by mainstream distributions.

Now libmount is able to detect mtab->/proc/mounts and use
/proc/self/mountinfo if necessary. This heuristic seems overkill in
many cases. It's also dangerous on systems where mountinfo is strongly
required (systemd based distros).

This patch #ifdefs mtab code and forces libmount to always use
/proc/self/mountinfo.

The new configure option --enable-libmount-support-mtab is necessary
to enable old behavior to support mtab.

Signed-off-by: Karel Zak <kzak@redhat.com>
2016-04-14 14:26:54 +02:00
Ruediger Meier 3e584e8576 build-sys: add --enable-libuuid-force-uuidd
To build libuuid with uuidd support even though the daemon is
disabled (--disable-uuidd).

Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
2016-04-14 12:56:12 +02:00