summaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
* fincore: remove unused variable [clang scan]Karel Zak2019-05-161-6/+2Star
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* cal: make sure months_in_row makes sense [coverity scan]Karel Zak2019-05-161-5/+11
| | | | | | | * avoid divide by zero in mountly() dues to wrong months_in_row * make sure months_in_row is at least 1 Signed-off-by: Karel Zak <kzak@redhat.com>
* blkid: improve strcpy() usage [coverity scan]Karel Zak2019-05-161-3/+8
| | | | | | | The old deprecated list output format ("-o list") copies gettex string into fixed buffer, that's really bad idea. Signed-off-by: Karel Zak <kzak@redhat.com>
* utmpdump: check ftello() return valueKarel Zak2019-05-161-0/+3
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* Merge branch 'lscpu-output-fix' of https://github.com/kerolasa/util-linuxKarel Zak2019-05-162-1/+2
|\ | | | | | | | | * 'lscpu-output-fix' of https://github.com/kerolasa/util-linux: lscpu: move trailing null after removing characters from a string
| * lscpu: move trailing null after removing characters from a stringSami Kerola2019-05-162-1/+2
| | | | | | | | | | | | | | | | | | From the test input string ':' characters are removed: cat x86_64-epyc_7451/sys/devices/system/cpu/vulnerabilities/spectre_v2 Mitigation: Full AMD retpoline, IBPB: conditional, STIBP: disabled, RSB filling Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* | libsmartcols: (groups) improve scols_table_group_lines() args check ↵Karel Zak2019-05-151-3/+3
| | | | | | | | | | | | [coverity scan] Signed-off-by: Karel Zak <kzak@redhat.com>
* | libmount: fix memory leak on error [coverity scan]Karel Zak2019-05-151-2/+3
| | | | | | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* | libfdisk: avoid memory leak [coverity scan]Karel Zak2019-05-151-1/+3
| | | | | | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* | libfdisk: avoid division by zero [clang scan]Karel Zak2019-05-151-2/+7
| | | | | | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* | libfdisk: remove unused code [clang scan]Karel Zak2019-05-151-1/+0Star
| | | | | | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* | libfdisk: properly check return code of add_to_partitions_array() [coverity ↵Karel Zak2019-05-151-1/+2
| | | | | | | | | | | | scan] Signed-off-by: Karel Zak <kzak@redhat.com>
* | libblkid: make partitions reference counting more robust [coverity scan]Karel Zak2019-05-151-2/+5
| | | | | | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* | libblkid: don't ignore blkid_probe_set_magic() errors [coverity scan]Karel Zak2019-05-151-4/+5
| | | | | | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* | libblkid: fix possible uninitialized value use [coverity scan]Karel Zak2019-05-151-1/+1
| | | | | | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* | lib/strutils: keep static analyzer happy [coverity scan]Karel Zak2019-05-151-1/+3
| | | | | | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* | lib/path: fix resource leak [coverity scan]Karel Zak2019-05-151-2/+5
| | | | | | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* | lib/path: fix possible NULL dereferencing [coverity scan]Karel Zak2019-05-151-2/+4
| | | | | | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* | lib/path: fix ul_path_get_dirfd() usage [coverity scan]Karel Zak2019-05-151-1/+5
| | | | | | | | | | | | ul_path_get_dirfd() returns negative number on error... Signed-off-by: Karel Zak <kzak@redhat.com>
* | lib/path: consolidate ul_path_mkpath() usageKarel Zak2019-05-151-74/+28Star
| | | | | | | | | | | | | | * always use errno from ul_path_mkpath() * keep code simple and short as possible Signed-off-by: Karel Zak <kzak@redhat.com>
* | lib/path: fix possible NULL pointer dereferencing [coverity scan]Karel Zak2019-05-151-0/+3
|/ | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* column: fix "maybe be" duplicationAustin English2019-05-151-1/+1
| | | | Signed-off-by: Austin English <austinenglish@gmail.com>
* rtcwake: fix "maybe be" duplicationAustin English2019-05-151-2/+2
| | | | Signed-off-by: Austin English <austinenglish@gmail.com>
* mount: fix "maybe be" duplicationAustin English2019-05-151-4/+4
| | | | Signed-off-by: Austin English <austinenglish@gmail.com>
* lsblk: fix "maybe be" duplicationAustin English2019-05-151-3/+3
| | | | Signed-off-by: Austin English <austinenglish@gmail.com>
* libmount: fix "maybe be" duplicationAustin English2019-05-151-1/+1
| | | | Signed-off-by: Austin English <austinenglish@gmail.com>
* lib/colors: fix "maybe be" duplicationAustin English2019-05-151-1/+1
| | | | Signed-off-by: Austin English <austinenglish@gmail.com>
* losetup: keep static analyzer happy [coverity scan]Karel Zak2019-05-141-4/+4
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* lib/colors: keep static analyzer happy [coverity scan]Karel Zak2019-05-141-2/+4
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* lib/canonicalize: verify DM paths [coverity scan]Karel Zak2019-05-141-1/+1
| | | | | | | | | | | | | 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>
* build-sys: add PKG_INSTALLDIR fallbackKarel Zak2019-05-141-0/+24
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* fdisk: initialize buffers for get_user_reply() [coverity scan]Karel Zak2019-05-143-5/+5
| | | | | | It's probably unnecessary, but better be safe than sorry. Signed-off-by: Karel Zak <kzak@redhat.com>
* build-sys: add --with-pkgconfigdirKarel Zak2019-05-142-2/+1Star
| | | | | | | | | | | | | | | | | 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>
* libblkid: Set BLKID_BID_FL_VERIFIED in case revalidation is not neededNikolay Borisov2019-05-141-2/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* libblkid: Don't check BLKID_PROBE_INTERVAL in blkid_verifyNikolay Borisov2019-05-141-2/+1Star
| | | | | | | | | | 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>
* lib/strutils: parse_size() fix frac digit calculationKarel Zak2019-05-131-10/+32
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* lib/strutils: parse_size() fix frac with zerosKarel Zak2019-05-131-7/+12
| | | | | | Fix 0.001G as well as accept 0.000G as valid number. Signed-off-by: Karel Zak <kzak@redhat.com>
* fstrim: affect only warnings by --quietKarel Zak2019-05-092-6/+11
| | | | | | | | 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>
* bash-completion: add fstrim --quietKarel Zak2019-05-091-0/+1
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* Merge branch 'fstrim-bug-789' of https://github.com/kerolasa/util-linuxKarel Zak2019-05-093-6/+31
|\ | | | | | | | | * 'fstrim-bug-789' of https://github.com/kerolasa/util-linux: fstrim: add --quiet option to suppress error messages
| * fstrim: add --quiet option to suppress error messagesSami Kerola2019-05-073-6/+31
| | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* | libmount: return errno on failed fstab stat()Karel Zak2019-05-091-2/+3
|/ | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* build-sys: use __SANITIZE_ADDRESS__ rather than custom USE_CLOSE_ATEXITKarel Zak2019-05-072-4/+1Star
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* lib/loopdev.c: Retry LOOP_SET_STATUS64 on EAGAINRomain Izard2019-05-071-4/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* libsmartcols: use scols_walk_* for calculations and printingKarel Zak2019-05-072-99/+67Star
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* libsmartcols: add generic function to walk on treeKarel Zak2019-05-073-1/+195
| | | | | | | 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>
* lsblk: fix heap-use-after-freeKarel Zak2019-05-061-0/+1
| | | | | Addresses: https://github.com/karelzak/util-linux/issues/787 Signed-off-by: Karel Zak <kzak@redhat.com>
* libsmartcols: cell width calulation cleanupKarel Zak2019-05-032-36/+49
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* libsmartcols: (groups) use print functions tp calculate grpsetKarel Zak2019-05-034-75/+23Star
| | | | | | | 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>
* libsmartcols: (groups) print group childrent after regualr treeKarel Zak2019-05-033-28/+72
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>