Commit Graph

13349 Commits

Author SHA1 Message Date
Karel Zak 0d71a25998 bash-completion: add fstrim --quiet
Signed-off-by: Karel Zak <kzak@redhat.com>
2019-05-09 13:16:03 +02:00
Karel Zak ddd9ffb152 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
2019-05-09 13:15:10 +02:00
Karel Zak cb055909c3 libmount: return errno on failed fstab stat()
Signed-off-by: Karel Zak <kzak@redhat.com>
2019-05-09 10:09:34 +02:00
Sami Kerola 374baa6f64
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>
2019-05-07 20:18:08 +01:00
Karel Zak 084365f1a1 build-sys: use __SANITIZE_ADDRESS__ rather than custom USE_CLOSE_ATEXIT
Signed-off-by: Karel Zak <kzak@redhat.com>
2019-05-07 12:59:52 +02:00
Romain Izard eab90ef8d4 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>
2019-05-07 12:36:00 +02:00
Karel Zak 47b6eccc97 libsmartcols: use scols_walk_* for calculations and printing
Signed-off-by: Karel Zak <kzak@redhat.com>
2019-05-07 11:46:11 +02:00
Karel Zak 19c2e73116 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>
2019-05-07 11:44:24 +02:00
Karel Zak f6f8a671a9 lsblk: fix heap-use-after-free
Addresses: https://github.com/karelzak/util-linux/issues/787
Signed-off-by: Karel Zak <kzak@redhat.com>
2019-05-06 12:39:07 +02:00
Karel Zak 281a2f3212 libsmartcols: cell width calulation cleanup
Signed-off-by: Karel Zak <kzak@redhat.com>
2019-05-03 17:27:17 +02:00
Karel Zak ea7fb72eb2 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>
2019-05-03 17:12:18 +02:00
Karel Zak b94932c063 libsmartcols: (groups) print group childrent after regualr tree
Signed-off-by: Karel Zak <kzak@redhat.com>
2019-05-03 14:53:23 +02:00
Karel Zak 46634fc90d libsmartcols: (groups) improve debug messages
Signed-off-by: Karel Zak <kzak@redhat.com>
2019-05-03 13:25:09 +02:00
Karel Zak fe22543d6b lsblk: add more debug messages
Signed-off-by: Karel Zak <kzak@redhat.com>
2019-05-02 15:51:48 +02:00
Karel Zak 883246a104 libsmartcols: fix groups reset, add debugs
Signed-off-by: Karel Zak <kzak@redhat.com>
2019-05-02 15:51:29 +02:00
Karel Zak 4525b6cf16 libsmartcols: (groups) remove hardcoded const numbers
Signed-off-by: Karel Zak <kzak@redhat.com>
2019-05-02 13:44:12 +02:00
Karel Zak 74a4d22078 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>
2019-05-02 12:48:05 +02:00
Sami Kerola e2aa5d82b9
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>
2019-05-01 20:19:19 +01:00
Sami Kerola 007b9874d8
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>
2019-05-01 19:49:07 +01:00
Sami Kerola e87263aa13
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>
2019-05-01 19:37:54 +01:00
Karel Zak 4267f2bcea build-sys: release++ (v2.34-rc1)
Signed-off-by: Karel Zak <kzak@redhat.com>
2019-04-30 11:56:27 +02:00
Karel Zak 6899ed8b7e docs: update v2.34-ReleaseNotes
Signed-off-by: Karel Zak <kzak@redhat.com>
2019-04-30 11:52:20 +02:00
Karel Zak ee322c23f4 docs: update AUTHORS file
Signed-off-by: Karel Zak <kzak@redhat.com>
2019-04-29 14:59:39 +02:00
Karel Zak df8434230b 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>
2019-04-29 14:47:19 +02:00
Karel Zak 450016eb72 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>
2019-04-25 10:18:08 +02:00
Karel Zak 57f25377c3 po: merge changes
Signed-off-by: Karel Zak <kzak@redhat.com>
2019-04-24 18:39:05 +02:00
Karel Zak 08a2cf7292 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>
2019-04-24 18:31:08 +02:00
Sebastian Rasmussen 8a2c8175f2 po: update sv.po (from translationproject.org) 2019-04-24 18:10:37 +02:00
Božidar Putanec 679bc72cf6 po: update hr.po (from translationproject.org) 2019-04-24 18:10:37 +02:00
Frédéric Marchal bd5d0e0b46 po: update fr.po (from translationproject.org) 2019-04-24 18:10:36 +02:00
Antonio Ceballos Roa fc2e4b525a po: update es.po (from translationproject.org) 2019-04-24 18:10:36 +02:00
Mario Blättermann a166829c7c po: update de.po (from translationproject.org) 2019-04-24 18:10:36 +02:00
Karel Zak 4750cb9126 build-sys: add devel-non-asan.conf
This allows to use "./tools/config-gen devel-non-asan" for ./configure.

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

Signed-off-by: Karel Zak <kzak@redhat.com>
2019-04-24 18:02:39 +02:00
Karel Zak 00749b05b9 su: make comment more friedly to 'make checkxalloc'
Signed-off-by: Karel Zak <kzak@redhat.com>
2019-04-24 12:45:20 +02:00
Karel Zak b97a25162a losetup: man page has repeating words [make checkmans]
Signed-off-by: Karel Zak <kzak@redhat.com>
2019-04-24 12:43:27 +02:00
Karel Zak 0b17c997c0 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>
2019-04-24 12:24:15 +02:00
Stanislav Brabec 0d37969cbe 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>
2019-04-24 11:16:53 +02:00
Wang Shilong ce3d198d7c 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>
2019-04-24 11:08:23 +02:00
Karel Zak 19bc8ef897 tests: fix TS_ENABLE_ASAN usage
Signed-off-by: Karel Zak <kzak@redhat.com>
2019-04-17 10:38:50 +02:00
Karel Zak 2da48ba3cc 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>
2019-04-17 10:10:46 +02:00
Karel Zak 2c308875a7 misc: consolidate version printing and close_stdout()
Signed-off-by: Karel Zak <kzak@redhat.com>
2019-04-16 15:14:13 +02:00
Karel Zak 68224d108d 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>
2019-04-16 13:47:17 +02:00
Karel Zak 31c66833cb 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>
2019-04-16 13:42:34 +02:00
Karel Zak 7f8787d094 chcpu: fix memory leak
The CPU set has been allocated more than once.

Signed-off-by: Karel Zak <kzak@redhat.com>
2019-04-16 10:51:35 +02:00
Karel Zak 2e5ff9db30 libmount: fix compiler warning [-Wsometimes-uninitialized]
Signed-off-by: Karel Zak <kzak@redhat.com>
2019-04-15 13:35:21 +02:00
Karel Zak 7bd44e8ade build-sys: enable ASAN on travis-ci
Addresses: Addresses: https://github.com/systemd/systemd/pull/12252
Signed-off-by: Karel Zak <kzak@redhat.com>
2019-04-15 13:05:33 +02:00
Karel Zak ef61c093d3 build-sys: add ASAN_LDFLAGS
Signed-off-by: Karel Zak <kzak@redhat.com>
2019-04-15 13:01:21 +02:00
Karel Zak 1271e63c49 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>
2019-04-15 12:58:48 +02:00
Karel Zak 82e39473a5 libmount: fix memleak on parse errors
Addresses: https://github.com/systemd/systemd/pull/12252
Signed-off-by: Karel Zak <kzak@redhat.com>
2019-04-15 12:55:46 +02:00