]> git.ipfire.org Git - thirdparty/util-linux.git/log
thirdparty/util-linux.git
6 years agortcwake: fix "maybe be" duplication
Austin English [Mon, 13 May 2019 18:53:18 +0000 (13:53 -0500)] 
rtcwake: fix "maybe be" duplication

Signed-off-by: Austin English <austinenglish@gmail.com>
6 years agomount: fix "maybe be" duplication
Austin English [Mon, 13 May 2019 18:53:17 +0000 (13:53 -0500)] 
mount: fix "maybe be" duplication

Signed-off-by: Austin English <austinenglish@gmail.com>
6 years agolsblk: fix "maybe be" duplication
Austin English [Mon, 13 May 2019 18:53:16 +0000 (13:53 -0500)] 
lsblk: fix "maybe be" duplication

Signed-off-by: Austin English <austinenglish@gmail.com>
6 years agolibmount: fix "maybe be" duplication
Austin English [Mon, 13 May 2019 18:53:15 +0000 (13:53 -0500)] 
libmount: fix "maybe be" duplication

Signed-off-by: Austin English <austinenglish@gmail.com>
6 years agolib/colors: fix "maybe be" duplication
Austin English [Mon, 13 May 2019 18:53:14 +0000 (13:53 -0500)] 
lib/colors: fix "maybe be" duplication

Signed-off-by: Austin English <austinenglish@gmail.com>
6 years agolosetup: keep static analyzer happy [coverity scan]
Karel Zak [Tue, 14 May 2019 14:43:40 +0000 (16:43 +0200)] 
losetup: keep static analyzer happy [coverity scan]

Signed-off-by: Karel Zak <kzak@redhat.com>
6 years agolib/colors: keep static analyzer happy [coverity scan]
Karel Zak [Tue, 14 May 2019 14:37:35 +0000 (16:37 +0200)] 
lib/colors: keep static analyzer happy [coverity scan]

Signed-off-by: Karel Zak <kzak@redhat.com>
6 years agolib/canonicalize: verify DM paths [coverity scan]
Karel Zak [Tue, 14 May 2019 13:47:02 +0000 (15:47 +0200)] 
lib/canonicalize: verify DM paths [coverity scan]

Now the code only checks that /sys/.../dm/name exists, but never
verify the device node in /dev (because path prefix is never NULL).

The prefix is used to redirect hardcoded paths to /sys dumps (e.g.
lsblk regression tests, etc.)

This bug has been introduced in v2.33. Fortunately, it's probably no
big issue as /dev is always in sync with /sys (thanks to udevd).

Signed-off-by: Karel Zak <kzak@redhat.com>
6 years agobuild-sys: add PKG_INSTALLDIR fallback
Karel Zak [Tue, 14 May 2019 13:25:07 +0000 (15:25 +0200)] 
build-sys: add PKG_INSTALLDIR fallback

Signed-off-by: Karel Zak <kzak@redhat.com>
6 years agofdisk: initialize buffers for get_user_reply() [coverity scan]
Karel Zak [Tue, 14 May 2019 13:00:01 +0000 (15:00 +0200)] 
fdisk: initialize buffers for get_user_reply() [coverity scan]

It's probably unnecessary, but better be safe than sorry.

Signed-off-by: Karel Zak <kzak@redhat.com>
6 years agobuild-sys: add --with-pkgconfigdir
Karel Zak [Tue, 14 May 2019 11:50:59 +0000 (13:50 +0200)] 
build-sys: add --with-pkgconfigdir

It seems we need a way how to override the default pkg-config install directory.

default:
$ ./configure
$ grep 'pkgconfigdir ='  Makefile
pkgconfigdir = ${usrlib_execdir}/pkgconfig

user-defined:
$ ./configure --with-pkgconfigdir=/usr/share/pkgconfig
$ grep 'pkgconfigdir ='  Makefile
$ pkgconfigdir = /usr/share/pkgconfig

Addresses: https://github.com/karelzak/util-linux/issues/793
Signed-off-by: Karel Zak <kzak@redhat.com>
6 years agolibblkid: Set BLKID_BID_FL_VERIFIED in case revalidation is not needed
Nikolay Borisov [Mon, 13 May 2019 12:44:18 +0000 (15:44 +0300)] 
libblkid: Set BLKID_BID_FL_VERIFIED in case revalidation is not needed

If blkid_verify deems that device revalidation is not needed since BLKID_PROBE_MIN
seconds haven't elapsed since the last revalidation of the device it returns
a blkid_dev. However, if this device has been read from the cache file on disk then
it wont' have BLKID_BID_FL_VERIFIED bit set. This in turn could lead to a later
call to blkid_dev_get free this device in case its part of a multi device
configuration. This is particularly relevant to btrfs raid configurations.

Namely this  was exhibited by btrfs-progs which use blkid for device enumeration.
In case of a multi-device filesystem (i.e raid10) running xfstest btrfs/011
would fail sporadically since cached devices read from cache were not revalidated
due to being recently validated (according to timestamp in the cache file) at
the same time their in-memory blkid_dev structures didn't have BLKID_BID_FL_VERIFIED
set. This lead to their untimely removal from the cache from blkid_get_dev.

Fix this by setting the BLKID_BID_FL_VERIFIED when returning from blkid_verify
with a valid device irrespective of whether full revalidation was performed or
the device is deemed valid due to being recently validated.

[kzak@redhat.com: - remove also check for BLKID_BID_FL_VERIFIED, the
                    function needs to check for elapsed time only]

Signed-off-by: Nikolay Borisov <nborisov@suse.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
6 years agolibblkid: Don't check BLKID_PROBE_INTERVAL in blkid_verify
Nikolay Borisov [Mon, 13 May 2019 12:44:17 +0000 (15:44 +0300)] 
libblkid: Don't check BLKID_PROBE_INTERVAL in blkid_verify

That constant is set to 200 seconds and is already check in probe_all().
It essentially controls how often blkid_probe_all can do a full cache
revalidation. Since blkid_verify is called from within probe_all() iff at least
BLKID_PROBE_INTERVAL seconds have elapsed it makes no sense to check this value
in blkid_verify.

Signed-off-by: Nikolay Borisov <nborisov@suse.com>
6 years agolib/strutils: parse_size() fix frac digit calculation
Karel Zak [Mon, 13 May 2019 15:07:14 +0000 (17:07 +0200)] 
lib/strutils: parse_size() fix frac digit calculation

Old code:

./test_strutils --size 0.5MiB
0.5MiB :               512000 :     500K :      500 KiB
./test_strutils --size 0.50MiB
0.50MiB :              5120000 :     4.9M :      4.9 MiB

New code:
./test_strutils --size 0.5MiB
0.5MiB :               524288 :     512K :      512 KiB
./test_strutils --size 0.50MiB
       0.50MiB :               524288 :     512K :      512 KiB

Note that the new implementation also does not use float points,
because we need to support PiB and so on... it seems good enough for
things like:

        ./test_strutils --size 7.13G
                7.13G :           7656104581 :     7.1G :      7.1 GiB
        ./test_strutils --size 7.16G
                7.16G :           7690675814 :     7.2G :      7.2 GiB

to avoid situation where cfdisk creates partition with completely
crazy numbers.

Addresses: https://github.com/karelzak/util-linux/issues/782
Signed-off-by: Karel Zak <kzak@redhat.com>
6 years agolib/strutils: parse_size() fix frac with zeros
Karel Zak [Mon, 13 May 2019 14:15:58 +0000 (16:15 +0200)] 
lib/strutils: parse_size() fix frac with zeros

Fix 0.001G as well as accept 0.000G as valid number.

Signed-off-by: Karel Zak <kzak@redhat.com>
6 years agofstrim: affect only warnings by --quiet
Karel Zak [Thu, 9 May 2019 11:59:54 +0000 (13:59 +0200)] 
fstrim: affect only warnings by --quiet

We need the same return code from fstrim_filesystem() independently on
--quiet command line option.

Addresses: https://github.com/karelzak/util-linux/pull/791
Signed-off-by: Karel Zak <kzak@redhat.com>
6 years agobash-completion: add fstrim --quiet
Karel Zak [Thu, 9 May 2019 11:16:03 +0000 (13:16 +0200)] 
bash-completion: add fstrim --quiet

Signed-off-by: Karel Zak <kzak@redhat.com>
6 years agoMerge branch 'fstrim-bug-789' of https://github.com/kerolasa/util-linux
Karel Zak [Thu, 9 May 2019 11:15:10 +0000 (13:15 +0200)] 
Merge branch 'fstrim-bug-789' of https://github.com/kerolasa/util-linux

* 'fstrim-bug-789' of https://github.com/kerolasa/util-linux:
  fstrim: add --quiet option to suppress error messages

6 years agolibmount: return errno on failed fstab stat()
Karel Zak [Thu, 9 May 2019 08:09:34 +0000 (10:09 +0200)] 
libmount: return errno on failed fstab stat()

Signed-off-by: Karel Zak <kzak@redhat.com>
6 years agofstrim: add --quiet option to suppress error messages
Sami Kerola [Tue, 7 May 2019 19:18:08 +0000 (20:18 +0100)] 
fstrim: add --quiet option to suppress error messages

When fstrim interacts with NTFS it result can be error reporting bad file
descriptor.  That seems to be a bug in NTFS.  While waiting driver to get on
top of the issue and be commonly available lets add to fstrim option to make
it be more silent about errno 9 aka EBADF, Bad file descriptor.

Reported-by: https://github.com/moviuro
Proposed-by: Dave Reisner <dreisner@archlinux.org>
Reference: https://bugs.archlinux.org/task/62288
Addresses: https://github.com/karelzak/util-linux/issues/789
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
6 years agobuild-sys: use __SANITIZE_ADDRESS__ rather than custom USE_CLOSE_ATEXIT
Karel Zak [Tue, 7 May 2019 10:59:52 +0000 (12:59 +0200)] 
build-sys: use __SANITIZE_ADDRESS__ rather than custom USE_CLOSE_ATEXIT

Signed-off-by: Karel Zak <kzak@redhat.com>
6 years agolib/loopdev.c: Retry LOOP_SET_STATUS64 on EAGAIN
Romain Izard [Fri, 3 May 2019 13:42:22 +0000 (15:42 +0200)] 
lib/loopdev.c: Retry LOOP_SET_STATUS64 on EAGAIN

A recent bugfix in the Linux kernel made it possible for the
LOOP_SET_STATUS64 ioctl to fail when called with a non-zero offset,
with an EAGAIN errno:

5db470e229e2 loop: drop caches if offset or block_size are changed

This fix changes a silent failure (where mount could sometimes access
the backing loop image through the cache without the specified offset)
to an explicit failure, and it has also been backported on stable
branches.

On a 5.0 kernel, other changes to the loop driver make it hard to get
generate the EAGAIN error, but this bugfix has also been backported to
stables branches, without these changes. At least with the 4.14 stable
branch, the EAGAIN error can be quickly generated with the following loop:

while mount -o loop,offset=239 disk point && umount point; do :; done

Retry the ioctl when it fails with EAGAIN, which means that mount or
losetup will eventually succeed when encountering this case.

[kzak@redhat.com: - use our local portable xusleep()]

Signed-off-by: Romain Izard <romain.izard.pro@gmail.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
6 years agolibsmartcols: use scols_walk_* for calculations and printing
Karel Zak [Tue, 7 May 2019 09:46:11 +0000 (11:46 +0200)] 
libsmartcols: use scols_walk_* for calculations and printing

Signed-off-by: Karel Zak <kzak@redhat.com>
6 years agolibsmartcols: add generic function to walk on tree
Karel Zak [Tue, 7 May 2019 09:44:24 +0000 (11:44 +0200)] 
libsmartcols: add generic function to walk on tree

Now we implement the same thing on more places. Let's add one set of
functions to walk the tree and use it everywhere.

Signed-off-by: Karel Zak <kzak@redhat.com>
6 years agolsblk: fix heap-use-after-free
Karel Zak [Mon, 6 May 2019 10:39:07 +0000 (12:39 +0200)] 
lsblk: fix heap-use-after-free

Addresses: https://github.com/karelzak/util-linux/issues/787
Signed-off-by: Karel Zak <kzak@redhat.com>
6 years agolibsmartcols: cell width calulation cleanup
Karel Zak [Fri, 3 May 2019 15:27:17 +0000 (17:27 +0200)] 
libsmartcols: cell width calulation cleanup

Signed-off-by: Karel Zak <kzak@redhat.com>
6 years agolibsmartcols: (groups) use print functions tp calculate grpset
Karel Zak [Fri, 3 May 2019 15:12:18 +0000 (17:12 +0200)] 
libsmartcols: (groups) use print functions tp calculate grpset

Now we have extra code to calculate grpset. It seems better to use
only one way how we wall the tree.

Signed-off-by: Karel Zak <kzak@redhat.com>
6 years agolibsmartcols: (groups) print group childrent after regualr tree
Karel Zak [Fri, 3 May 2019 12:53:23 +0000 (14:53 +0200)] 
libsmartcols: (groups) print group childrent after regualr tree

Signed-off-by: Karel Zak <kzak@redhat.com>
6 years agolibsmartcols: (groups) improve debug messages
Karel Zak [Fri, 3 May 2019 11:25:09 +0000 (13:25 +0200)] 
libsmartcols: (groups) improve debug messages

Signed-off-by: Karel Zak <kzak@redhat.com>
6 years agolsblk: add more debug messages
Karel Zak [Thu, 2 May 2019 13:51:48 +0000 (15:51 +0200)] 
lsblk: add more debug messages

Signed-off-by: Karel Zak <kzak@redhat.com>
6 years agolibsmartcols: fix groups reset, add debugs
Karel Zak [Thu, 2 May 2019 13:51:29 +0000 (15:51 +0200)] 
libsmartcols: fix groups reset, add debugs

Signed-off-by: Karel Zak <kzak@redhat.com>
6 years agolibsmartcols: (groups) remove hardcoded const numbers
Karel Zak [Thu, 2 May 2019 11:44:12 +0000 (13:44 +0200)] 
libsmartcols: (groups) remove hardcoded const numbers

Signed-off-by: Karel Zak <kzak@redhat.com>
6 years agohardlink: fix compiler warnings [-Wsign-compare -Wmaybe-uninitialized]]
Karel Zak [Thu, 2 May 2019 10:48:05 +0000 (12:48 +0200)] 
hardlink: fix compiler warnings [-Wsign-compare -Wmaybe-uninitialized]]

misc-utils/hardlink.c: In function ‘process_path’:
misc-utils/hardlink.c:287:30: warning: operand of ?: changes signedness from ‘off_t’ {aka ‘long int’} to ‘long unsigned int’ due to unsignedness of other operand [-Wsign-compare]

misc-utils/hardlink.c: In function ‘main’:
misc-utils/hardlink.c:455:5: warning: ‘exclude_pattern’ may be used uninitialized in this function [-Wmaybe-uninitialized]

Signed-off-by: Karel Zak <kzak@redhat.com>
6 years agohardlink: retire NIOBUF in favour of more common BUFSIZ
Sami Kerola [Wed, 1 May 2019 19:04:24 +0000 (20:04 +0100)] 
hardlink: retire NIOBUF in favour of more common BUFSIZ

Reason to retire NIOBUF is that it is obscure local definition, while BUFSIZ
is well understood and commonly used constant.  Besized sizes of these are
not far off, the NIOBUF was 4096 bytes and BUFSIZ tends to be 8192 bytes.

Proposed-by: Karel Zak <kzak@redhat.com>
Reference: https://github.com/karelzak/util-linux/pull/783
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
6 years agohardlink: move global variables to a control structure
Sami Kerola [Sat, 27 Apr 2019 08:54:11 +0000 (09:54 +0100)] 
hardlink: move global variables to a control structure

Well, sort of.  Due to use of ctl values in atexit() print_summary() there
is need for global control structure.

Secondly couple variables can be moved to more restricted scope, namely the
PCRE variables are now in main().

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
6 years agohardlink: use flexible array member rather than zero-size array
Sami Kerola [Sat, 27 Apr 2019 08:54:05 +0000 (09:54 +0100)] 
hardlink: use flexible array member rather than zero-size array

This fixes two standards compliancy warnings.

hardlink.c:65:7: warning: ISO C forbids zero-size array ‘name’ [-Wpedantic]

Reference: https://en.wikipedia.org/wiki/Flexible_array_member
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
6 years agobuild-sys: release++ (v2.34-rc1) v2.34-rc1
Karel Zak [Tue, 30 Apr 2019 09:56:27 +0000 (11:56 +0200)] 
build-sys: release++ (v2.34-rc1)

Signed-off-by: Karel Zak <kzak@redhat.com>
6 years agodocs: update v2.34-ReleaseNotes
Karel Zak [Tue, 30 Apr 2019 09:52:20 +0000 (11:52 +0200)] 
docs: update v2.34-ReleaseNotes

Signed-off-by: Karel Zak <kzak@redhat.com>
6 years agodocs: update AUTHORS file
Karel Zak [Mon, 29 Apr 2019 12:59:39 +0000 (14:59 +0200)] 
docs: update AUTHORS file

Signed-off-by: Karel Zak <kzak@redhat.com>
6 years agotests: build-sys update
Karel Zak [Mon, 29 Apr 2019 12:47:19 +0000 (14:47 +0200)] 
tests: build-sys update

* libblkid does not depend on libuuid anymore
* libncurses depends on libdl due to

  $ ncursesw6-config --libs
  -lncursesw -ltinfo -ldl

* new command hardlink (with dependence on libpcre2-8
* hwclock needs librt

Signed-off-by: Karel Zak <kzak@redhat.com>
6 years agobuild-sys: don't use ASAN on XOS
Karel Zak [Thu, 25 Apr 2019 08:18:08 +0000 (10:18 +0200)] 
build-sys: don't use ASAN on XOS

It seems that Apple Clang is not mature enough to use ASAN.

  AddressSanitizer: detect_leaks is not supported on this platform.

Let's disable ASAN on XOS at all.

Signed-off-by: Karel Zak <kzak@redhat.com>
6 years agopo: merge changes
Karel Zak [Wed, 24 Apr 2019 16:39:05 +0000 (18:39 +0200)] 
po: merge changes

Signed-off-by: Karel Zak <kzak@redhat.com>
6 years agohardlink: remove \r from output
Karel Zak [Wed, 24 Apr 2019 16:31:08 +0000 (18:31 +0200)] 
hardlink: remove \r from output

* remove \r from internationalized messages
* remove \r from all output to make it easy to use (see for example
  output file from "hardlink -vv --dry-run . &> log")

* remove unnecessary formatting stuff from output, just keep is simple
  and stupid...

Signed-off-by: Karel Zak <kzak@redhat.com>
6 years agopo: update sv.po (from translationproject.org)
Sebastian Rasmussen [Wed, 24 Apr 2019 16:10:37 +0000 (18:10 +0200)] 
po: update sv.po (from translationproject.org)

6 years agopo: update hr.po (from translationproject.org)
Božidar Putanec [Wed, 24 Apr 2019 16:10:37 +0000 (18:10 +0200)] 
po: update hr.po (from translationproject.org)

6 years agopo: update fr.po (from translationproject.org)
Frédéric Marchal [Wed, 24 Apr 2019 16:10:36 +0000 (18:10 +0200)] 
po: update fr.po (from translationproject.org)

6 years agopo: update es.po (from translationproject.org)
Antonio Ceballos Roa [Wed, 24 Apr 2019 16:10:36 +0000 (18:10 +0200)] 
po: update es.po (from translationproject.org)

6 years agopo: update de.po (from translationproject.org)
Mario Blättermann [Wed, 24 Apr 2019 16:10:36 +0000 (18:10 +0200)] 
po: update de.po (from translationproject.org)

6 years agobuild-sys: add devel-non-asan.conf
Karel Zak [Wed, 24 Apr 2019 16:04:24 +0000 (18:04 +0200)] 
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>
6 years agobuild-sys: add 'make checklibdoc'
Karel Zak [Wed, 24 Apr 2019 16:02:39 +0000 (18:02 +0200)] 
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>
6 years agosu: make comment more friedly to 'make checkxalloc'
Karel Zak [Wed, 24 Apr 2019 10:45:20 +0000 (12:45 +0200)] 
su: make comment more friedly to 'make checkxalloc'

Signed-off-by: Karel Zak <kzak@redhat.com>
6 years agolosetup: man page has repeating words [make checkmans]
Karel Zak [Wed, 24 Apr 2019 10:43:27 +0000 (12:43 +0200)] 
losetup: man page has repeating words [make checkmans]

Signed-off-by: Karel Zak <kzak@redhat.com>
6 years agotests: auto-enable ASAN option if necessary
Karel Zak [Wed, 24 Apr 2019 10:24:15 +0000 (12:24 +0200)] 
tests: auto-enable ASAN option if necessary

Let's detect ASAN LDFLAGS in top level Makefile to make sure we call
tests with --memcheck-asan if build-system has been configured with
--enable-asan.

Signed-off-by: Karel Zak <kzak@redhat.com>
6 years agolslogins: Fix discrepancies of SYS_UID_MIN
Stanislav Brabec [Wed, 24 Apr 2019 09:16:53 +0000 (11:16 +0200)] 
lslogins: Fix discrepancies of SYS_UID_MIN

util-linux does not contain useradd. Its most popular implementation
comes from shadow. SYS_UID_MIN is one of common parameters. Its
hardcoded fallback value is equal to 101 in shadow useradd (see
shadow-4.6/libmisc/find_new_uid.c: get_ranges()), but 201 in
login-utils/lslogins.c.

Let lslogins use the same fallback as useradd from shadow.

Hopefully most distros define its custom value of SYS_UID_MIN in
/etc/login.defs, so this problem is not visible.

login-utils/lslogins.1 does not mention its default at all. Add a
reference and improve text of lslogins(1) to prevent off-by-one
interpretation.

Signed-off-by: Stanislav Brabec <sbrabec@suse.cz>
Signed-off-by: Karel Zak <kzak@redhat.com>
6 years agofstrim: document kernel return minlen explicitly
Wang Shilong [Tue, 23 Apr 2019 14:58:28 +0000 (23:58 +0900)] 
fstrim: document kernel return minlen explicitly

Filesystem will modify @minlen according to its
block size etc, and will return actual unit
to userspace, document it into manpage.

Cc: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Wang Shilong <wshilong@ddn.com>
Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>
6 years agotests: fix TS_ENABLE_ASAN usage
Karel Zak [Wed, 17 Apr 2019 08:38:50 +0000 (10:38 +0200)] 
tests: fix TS_ENABLE_ASAN usage

Signed-off-by: Karel Zak <kzak@redhat.com>
6 years agotests: use TS_ENABLE_ASAN in tests to detect ASAN
Karel Zak [Wed, 17 Apr 2019 08:10:46 +0000 (10:10 +0200)] 
tests: use TS_ENABLE_ASAN in tests to detect ASAN

It seems better to not use any random ASAN variable.

Signed-off-by: Karel Zak <kzak@redhat.com>
6 years agomisc: consolidate version printing and close_stdout()
Karel Zak [Tue, 16 Apr 2019 13:14:13 +0000 (15:14 +0200)] 
misc: consolidate version printing and close_stdout()

Signed-off-by: Karel Zak <kzak@redhat.com>
6 years agoinclude/c: add print_version() macro
Karel Zak [Tue, 16 Apr 2019 11:47:17 +0000 (13:47 +0200)] 
include/c: add print_version() macro

Let's consolidate the version printing code. It also seems better to
use exit() after --version, because it's handled in different way by
ASAN.

It's strange, but ASAN reports leaks after return in main(). Note that
we do not use free-before-exit.

Signed-off-by: Karel Zak <kzak@redhat.com>
6 years agoinclude/closestream: add close_stdout_atexit()
Karel Zak [Tue, 16 Apr 2019 11:42:34 +0000 (13:42 +0200)] 
include/closestream: add close_stdout_atexit()

It seems better to have a way to control when atexit(close_stdout()) is
used, because close stdout means that for example ASAN (or another
into binary integrated tool) is not able to print the final summary.

Signed-off-by: Karel Zak <kzak@redhat.com>
6 years agochcpu: fix memory leak
Karel Zak [Tue, 16 Apr 2019 08:51:35 +0000 (10:51 +0200)] 
chcpu: fix memory leak

The CPU set has been allocated more than once.

Signed-off-by: Karel Zak <kzak@redhat.com>
6 years agolibmount: fix compiler warning [-Wsometimes-uninitialized]
Karel Zak [Mon, 15 Apr 2019 11:35:21 +0000 (13:35 +0200)] 
libmount: fix compiler warning [-Wsometimes-uninitialized]

Signed-off-by: Karel Zak <kzak@redhat.com>
6 years agobuild-sys: enable ASAN on travis-ci
Karel Zak [Mon, 15 Apr 2019 11:05:33 +0000 (13:05 +0200)] 
build-sys: enable ASAN on travis-ci

Addresses: Addresses: https://github.com/systemd/systemd/pull/12252
Signed-off-by: Karel Zak <kzak@redhat.com>
6 years agobuild-sys: add ASAN_LDFLAGS
Karel Zak [Mon, 15 Apr 2019 11:01:21 +0000 (13:01 +0200)] 
build-sys: add ASAN_LDFLAGS

Signed-off-by: Karel Zak <kzak@redhat.com>
6 years agotests: ignore errors with enabled ASAN in python bindings
Karel Zak [Mon, 15 Apr 2019 10:58:48 +0000 (12:58 +0200)] 
tests: ignore errors with enabled ASAN in python bindings

temporary solution... as it ends with
undefined symbol: __asan_option_detect_stack_use_after_return

Signed-off-by: Karel Zak <kzak@redhat.com>
6 years agolibmount: fix memleak on parse errors
Karel Zak [Mon, 15 Apr 2019 10:55:46 +0000 (12:55 +0200)] 
libmount: fix memleak on parse errors

Addresses: https://github.com/systemd/systemd/pull/12252
Signed-off-by: Karel Zak <kzak@redhat.com>
6 years agofstrim: get realpath before trim ioctl
Wang Shilong [Sun, 14 Apr 2019 03:31:56 +0000 (12:31 +0900)] 
fstrim: get realpath before trim ioctl

Original motivation is we want to run fstrim command
on Lustre[1] osd server mount point directly, however
our server mount point doesn't export osd directory
to users, and it will cause following command fail:

 $fstrim -v /mnt/mds/

But following succeed:

 $fstrim -v /mnt/mds

We could improve this a bit by getting realpath
before trapping kernel, this also give benifits
to normal use cases.

Cc: Andreas Dilger <adilger@dilger.ca>
Cc: Shuichi Ihara <sihara@ddn.com>
[1] http://wiki.lustre.org/Main_Page
Signed-off-by: Wang Shilong <wshilong@ddn.com>
6 years agotests: update lscpu due to 'Vulnerability' fields
Karel Zak [Thu, 11 Apr 2019 11:55:51 +0000 (13:55 +0200)] 
tests: update lscpu due to 'Vulnerability' fields

Signed-off-by: Karel Zak <kzak@redhat.com>
6 years agolscpu: wrap default output long lines on terminal
Karel Zak [Thu, 11 Apr 2019 11:53:03 +0000 (13:53 +0200)] 
lscpu: wrap default output long lines on terminal

Signed-off-by: Karel Zak <kzak@redhat.com>
6 years agolscpu: report CPU vulnerabilities
Karel Zak [Thu, 11 Apr 2019 11:45:29 +0000 (13:45 +0200)] 
lscpu: report CPU vulnerabilities

Signed-off-by: Karel Zak <kzak@redhat.com>
6 years agoinclude/strutils: add functions to replace and remove chars from string
Karel Zak [Thu, 11 Apr 2019 11:13:06 +0000 (13:13 +0200)] 
include/strutils: add functions to replace and remove chars from string

Signed-off-by: Karel Zak <kzak@redhat.com>
6 years agolib/fileutils: add xreaddir()
Karel Zak [Thu, 11 Apr 2019 11:11:53 +0000 (13:11 +0200)] 
lib/fileutils: add xreaddir()

Remove duplicate code and keep only one implementation in
include/fileutils.h.

Signed-off-by: Karel Zak <kzak@redhat.com>
6 years agosetarch: add new e2k subarches
Andrew Savchenko [Fri, 23 Mar 2018 14:40:22 +0000 (17:40 +0300)] 
setarch: add new e2k subarches

Signed-off-by: Karel Zak <kzak@redhat.com>
6 years agotests: add /mnt/test/foo^Mbar to mountinfo tests
Karel Zak [Mon, 8 Apr 2019 11:33:04 +0000 (13:33 +0200)] 
tests: add /mnt/test/foo^Mbar to mountinfo tests

Addresses: https://github.com/karelzak/util-linux/issues/780
Signed-off-by: Karel Zak <kzak@redhat.com>
6 years agolibmount: don't use sscanf() for swaps parsing
Karel Zak [Mon, 8 Apr 2019 11:33:04 +0000 (13:33 +0200)] 
libmount: don't use sscanf() for swaps parsing

Addresses: https://github.com/karelzak/util-linux/issues/780
Signed-off-by: Karel Zak <kzak@redhat.com>
6 years agolibmount: don't use sscanf() for mountinfo parsing
Karel Zak [Mon, 8 Apr 2019 11:33:04 +0000 (13:33 +0200)] 
libmount: don't use sscanf() for mountinfo parsing

Addresses: https://github.com/karelzak/util-linux/issues/780
Signed-off-by: Karel Zak <kzak@redhat.com>
6 years agolibmount: don't use sscanf() for fstab parsing
Karel Zak [Mon, 8 Apr 2019 11:33:04 +0000 (13:33 +0200)] 
libmount: don't use sscanf() for fstab parsing

Addresses: https://github.com/karelzak/util-linux/issues/780
Signed-off-by: Karel Zak <kzak@redhat.com>
6 years agoMerge branch 'spelling' of https://github.com/jwilk-forks/util-linux
Karel Zak [Tue, 2 Apr 2019 10:05:25 +0000 (12:05 +0200)] 
Merge branch 'spelling' of https://github.com/jwilk-forks/util-linux

* 'spelling' of https://github.com/jwilk-forks/util-linux:
  docs: fix typo

6 years agofstrim.c: Remove commnet about vfat not supporting fstrim
Marcos Paulo de Souza [Mon, 1 Apr 2019 21:38:31 +0000 (18:38 -0300)] 
fstrim.c: Remove commnet about vfat not supporting fstrim

Commit f663b5b38f ("fat: add FITRIM ioctl for FAT file system") in
linux kernel added support for using fstrim with vfat filesystem.

Signed-off-by: Marcos Paulo de Souza <marcos.souza.org@gmail.com>
6 years agotastset: (man) add :N stride for CPU lists
Karel Zak [Fri, 29 Mar 2019 12:00:42 +0000 (13:00 +0100)] 
tastset: (man) add :N stride for CPU lists

Signed-off-by: Karel Zak <kzak@redhat.com>
6 years agofsck: (man) labels are available for all filesystems
Karel Zak [Thu, 28 Mar 2019 14:29:09 +0000 (15:29 +0100)] 
fsck: (man) labels are available for all filesystems

Signed-off-by: Karel Zak <kzak@redhat.com>
6 years agosu: change error message
Karel Zak [Mon, 25 Mar 2019 15:39:43 +0000 (16:39 +0100)] 
su: change error message

We use PAM and if pam_strerror() returns nothing we have no clue why
authentication failed. It's mistake to blame incorrect password if
there are many possible reason...

Addresses: https://github.com/karelzak/util-linux/issues/778
Signed-off-by: Karel Zak <kzak@redhat.com>
6 years agodocs: fix typo
Jakub Wilk [Fri, 22 Mar 2019 12:27:33 +0000 (13:27 +0100)] 
docs: fix typo

Signed-off-by: Jakub Wilk <jwilk@jwilk.net>
6 years agotaskset: fix cpuset list parser
Karel Zak [Wed, 20 Mar 2019 12:12:25 +0000 (13:12 +0100)] 
taskset: fix cpuset list parser

taskset hangs when executed with badly formatted cpuset list, for
example:

 $ taskset -c 0--1 true

The current cpuset list parser is pretty weak as based on scanf()
without strings verification ("-1" as input for "%u" returns
unexpected number). It seems faster and better to use strtoul() and
isdigit().

Addresses: https://github.com/karelzak/util-linux/issues/77
Signed-off-by: Karel Zak <kzak@redhat.com>
6 years agolscpu: (man) tiny changes
Karel Zak [Tue, 19 Mar 2019 16:00:01 +0000 (17:00 +0100)] 
lscpu: (man) tiny changes

6 years agolscpu: fix excl[] array order
Karel Zak [Tue, 19 Mar 2019 15:56:28 +0000 (16:56 +0100)] 
lscpu: fix excl[] array order

It (rows and columns) must be in ASCII order.

Signed-off-by: Karel Zak <kzak@redhat.com>
6 years agolscpu: fix and document --output-all
Karel Zak [Tue, 19 Mar 2019 15:47:55 +0000 (16:47 +0100)] 
lscpu: fix and document --output-all

Signed-off-by: Karel Zak <kzak@redhat.com>
6 years agolscpu: define libsmartcols flags for -e
Karel Zak [Tue, 19 Mar 2019 15:40:51 +0000 (16:40 +0100)] 
lscpu: define libsmartcols flags for -e

Signed-off-by: Karel Zak <kzak@redhat.com>
6 years agolscpu: fix --caches order
Karel Zak [Tue, 19 Mar 2019 15:24:54 +0000 (16:24 +0100)] 
lscpu: fix --caches order

Signed-off-by: Karel Zak <kzak@redhat.com>
6 years agolscpu: (man) make SYNOPSIS compatible with another utils
Karel Zak [Tue, 19 Mar 2019 13:22:33 +0000 (14:22 +0100)] 
lscpu: (man) make SYNOPSIS compatible with another utils

In this case is really no reason to duplicate all options in SYNOPSIS.

Signed-off-by: Karel Zak <kzak@redhat.com>
6 years agolscpu: add --bytes
Karel Zak [Tue, 19 Mar 2019 13:21:02 +0000 (14:21 +0100)] 
lscpu: add --bytes

Signed-off-by: Karel Zak <kzak@redhat.com>
6 years agolscpu: add --caches
Karel Zak [Tue, 19 Mar 2019 12:47:11 +0000 (13:47 +0100)] 
lscpu: add --caches

$ lscpu -C
NAME ONE-SIZE ALL-SIZE WAYS TYPE        LEVEL
L3         8M       8M   16 Unified         3
L2       256K       1M    8 Unified         2
L1i       32K     128K    8 Instruction     1
L1d       32K     128K    8 Data            1

The patch also updates extra caches (s390) output in lsblk summary to
be compatible with output about normal caches.

Addresses: https://github.com/karelzak/util-linux/issues/663
Signed-off-by: Karel Zak <kzak@redhat.com>
6 years agolib/path: remove extra semi-colons
Karel Zak [Tue, 19 Mar 2019 11:40:49 +0000 (12:40 +0100)] 
lib/path: remove extra semi-colons

Signed-off-by: Karel Zak <kzak@redhat.com>
6 years agolscpu: rename macros and functions
Karel Zak [Tue, 19 Mar 2019 10:36:43 +0000 (11:36 +0100)] 
lscpu: rename macros and functions

We need to differentiate between output about CPUs and another stuff
(caches in future). Let's make it more obvious in code.

Signed-off-by: Karel Zak <kzak@redhat.com>
6 years agotests: update lscpu output
Karel Zak [Tue, 19 Mar 2019 12:56:26 +0000 (13:56 +0100)] 
tests: update lscpu output

Signed-off-by: Karel Zak <kzak@redhat.com>
6 years agolscpu: report more usable cache sizes
Karel Zak [Tue, 19 Mar 2019 10:09:02 +0000 (11:09 +0100)] 
lscpu: report more usable cache sizes

The current version reports cache size as reported by /sys, it means
real size of the one piece of the cache. This way provides minimal
overview about all system as the cache is often shared between CPUs.

It seems better to report all size of the caches in the summary
output. It also does not make sense to report sizes per core (or
socket) as CPU topology may be pretty complicated.

The final solution (not implemented yet) will be to have --list-caches
where we can report all details like all-size, item-size, per-core size,
ways, type, etc.

Addresses: https://github.com/karelzak/util-linux/issues/663
Signed-off-by: Karel Zak <kzak@redhat.com>
6 years agolsblk: force tree on --json --tree independently on used columns
Karel Zak [Mon, 18 Mar 2019 15:58:41 +0000 (16:58 +0100)] 
lsblk: force tree on --json --tree independently on used columns

Signed-off-by: Karel Zak <kzak@redhat.com>
6 years agodocs: TODO lscpu --list-caches
Karel Zak [Mon, 18 Mar 2019 13:14:09 +0000 (14:14 +0100)] 
docs: TODO lscpu --list-caches

Addresses: https://github.com/karelzak/util-linux/issues/663
Signed-off-by: Karel Zak <kzak@redhat.com>
6 years agolscpu: add 'Frequency boost'
Karel Zak [Fri, 15 Mar 2019 12:33:40 +0000 (13:33 +0100)] 
lscpu: add 'Frequency boost'

Show turbo boost status on platforms where is available a file
/sys/devices/system/cpu/cpufreq/boost.

Addresses: https://github.com/karelzak/util-linux/issues/755
Signed-off-by: Karel Zak <kzak@redhat.com>
6 years agoMerge branch 'swapon-btrfs' of https://github.com/marcosfrm/util-linux
Karel Zak [Mon, 11 Mar 2019 11:09:30 +0000 (12:09 +0100)] 
Merge branch 'swapon-btrfs' of https://github.com/marcosfrm/util-linux

* 'swapon-btrfs' of https://github.com/marcosfrm/util-linux:
  swapon.8: mention btrfs(5)