]> git.ipfire.org Git - thirdparty/util-linux.git/log
thirdparty/util-linux.git
4 years agofstrim shouldn't run inside a container
Eric Desrochers [Wed, 14 Aug 2019 16:58:39 +0000 (12:58 -0400)] 
fstrim shouldn't run inside a container

Container type implies the following products:
openvz OpenVZ/Virtuozzo
lxc Linux container implementation by LXC
lxc-libvirt Linux container implementation by libvirt
systemd-nspawn systemd's minimal container implementation, see systemd-nspawn(1)
docker Docker container manager
podman Podman container manager
rkt rkt app container runtime
wsl Windows Subsystem for Linux

References:
https://www.freedesktop.org/software/systemd/man/systemd.unit.html
https://www.freedesktop.org/software/systemd/man/systemd-detect-virt.html#

Fix: #840

Signed-off-by: Eric Desrochers <eric.desrochers@canonical.com>
4 years agoRemove unused utime.h header
Rosen Penev [Thu, 8 Aug 2019 19:14:39 +0000 (12:14 -0700)] 
Remove unused utime.h header

It is sometimes unavailable and errors on inclusion. For example, when
disabled in uClibc-ng.

4 years agoRemove isascii usage
Rosen Penev [Thu, 8 Aug 2019 19:12:55 +0000 (12:12 -0700)] 
Remove isascii usage

There is a c_isascii function that can be used.

isascii is deprecated and not available with some libcs like uClibc-ng
where it can be compile time disabled.

4 years agotests: update fdisk output
Karel Zak [Thu, 8 Aug 2019 12:20:05 +0000 (14:20 +0200)] 
tests: update fdisk output

Signed-off-by: Karel Zak <kzak@redhat.com>
4 years agolibfdisk: (script) support shortcuts in the type= field
Karel Zak [Thu, 8 Aug 2019 08:34:27 +0000 (10:34 +0200)] 
libfdisk: (script) support shortcuts in the type= field

The unnamed-field format supports partition type shortcuts:

",1MiB,L'

but for named-field format it requires full type:

 (mbr) "size=1MiB,type=83"
 (gpt)  "size=1MiB,type=0FC63DAF-8483-4772-8E79-3D69D8477DE4"

This patch implements type shortcuts also for named-field format:

"size=1MiB,type=L"

to make it more user-friendly and unified.

Addresses: https://github.com/karelzak/util-linux/issues/837
Signed-off-by: Karel Zak <kzak@redhat.com>
4 years agotests: use subtests for mountpoint(1)
Karel Zak [Wed, 7 Aug 2019 09:45:57 +0000 (11:45 +0200)] 
tests: use subtests for mountpoint(1)

Signed-off-by: Karel Zak <kzak@redhat.com>
4 years agoMerge branch 'issue832' of https://github.com/kerolasa/util-linux
Karel Zak [Wed, 7 Aug 2019 09:20:21 +0000 (11:20 +0200)] 
Merge branch 'issue832' of https://github.com/kerolasa/util-linux

* 'issue832' of https://github.com/kerolasa/util-linux:
  mountpoint: add --nofollow option

4 years agoMerge branch 'master' of https://github.com/chstarkd/util-linux
Karel Zak [Wed, 7 Aug 2019 09:16:14 +0000 (11:16 +0200)] 
Merge branch 'master' of https://github.com/chstarkd/util-linux

* 'master' of https://github.com/chstarkd/util-linux:
  removed double space
  fixed mount man page typo, "bythe" -> "by the"

4 years agolibfdisk: refer to partx(8) rather than to kpartx(8)
Karel Zak [Tue, 6 Aug 2019 10:24:33 +0000 (12:24 +0200)] 
libfdisk: refer to partx(8) rather than to kpartx(8)

Reported-by: Petr Pisar <petr.pisar@atlas.cz>
Signed-off-by: Karel Zak <kzak@redhat.com>
4 years agoremoved double space
Chistyj Arkadij [Sun, 4 Aug 2019 18:21:55 +0000 (21:21 +0300)] 
removed double space

4 years agofixed mount man page typo, "bythe" -> "by the"
Chistyj Arkadij [Sun, 4 Aug 2019 14:06:38 +0000 (17:06 +0300)] 
fixed mount man page typo, "bythe" -> "by the"

4 years agomountpoint: add --nofollow option
Sami Kerola [Fri, 2 Aug 2019 18:39:05 +0000 (19:39 +0100)] 
mountpoint: add --nofollow option

The no follow option will allow user to distinct mount points from symbolic
links pointing to them.  Arguably this is pretty pedantic option, mounting a
device or bind mount to a directory via symlink does not have or cause any
issues.

Addresses: https://github.com/karelzak/util-linux/issues/832
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
4 years agodmesg: fix output hex encoding
Karel Zak [Thu, 1 Aug 2019 09:43:58 +0000 (11:43 +0200)] 
dmesg: fix output hex encoding

The current code ignores single-byte non-printable characters.

Reported-by: Marc Deslauriers <marc.deslauriers@canonical.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
4 years agochoom: improve docs
Karel Zak [Thu, 1 Aug 2019 09:06:06 +0000 (11:06 +0200)] 
choom: improve docs

It's not obvious from the current docs that you have to explicitly
split command line options and wanted commands.

Addresses: https://github.com/karelzak/util-linux/issues/833
Signed-off-by: Karel Zak <kzak@redhat.com>
4 years agolibblkid: fix file descriptor leak in blkid_verify()
Karel Zak [Wed, 31 Jul 2019 14:18:27 +0000 (16:18 +0200)] 
libblkid: fix file descriptor leak in blkid_verify()

The function blkid_verify() uses private device file descriptor and
uses blkid_probe_set_device() to assign the descriptor to low-level
probing code. Unfortunately, close() in this case is not enough as the
prober can internally open whole-disk device too.

The library API has been extended so blkid_probe_set_device()
deallocates and close previously used prober for whole-disk. This new
functionality is used in blkid_verify() now.

Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=1734545
Signed-off-by: Karel Zak <kzak@redhat.com>
4 years agoMerge branch '2019wk29' of https://github.com/kerolasa/util-linux
Karel Zak [Mon, 29 Jul 2019 09:13:51 +0000 (11:13 +0200)] 
Merge branch '2019wk29' of https://github.com/kerolasa/util-linux

* '2019wk29' of https://github.com/kerolasa/util-linux:
  lscpu: prefer memcpy() to manual pointer arithmetic

4 years agocolumn: fix outputing empty column at the end of line
Yousong Zhou [Mon, 29 Jul 2019 01:24:29 +0000 (01:24 +0000)] 
column: fix outputing empty column at the end of line

The following commands manifests the problem.  In old versions before
commit 4762ae9d60 ("column: use libsmartcols for --table"), both of them
should output with 2 "|"

echo '||'  | column -o '|' -s '|' -t
echo '|| ' | column -o '|' -s '|' -t

Fixes: 4762ae9d60 ("column: use libsmartcols for --table")
Signed-off-by: Yousong Zhou <zhouyousong@yunionyun.com>
Reviewed-by: Sami Kerola <kerolasa@iki.fi>
4 years agolscpu: prefer memcpy() to manual pointer arithmetic
Sami Kerola [Sat, 27 Jul 2019 17:55:01 +0000 (18:55 +0100)] 
lscpu: prefer memcpy() to manual pointer arithmetic

With pointer arithmetic clang address sanitizer gives following error this
change addresses.  Notice the following happens only when running as root.

sys-utils/lscpu-dmi.c:83:14: runtime error: load of misaligned address
0x55a1d62f3d1d for type 'const uint16_t' (aka 'const unsigned short'), which
requires 2 byte alignment

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
4 years agolscpu: (man) add note about cache sizes
Karel Zak [Thu, 25 Jul 2019 10:23:59 +0000 (12:23 +0200)] 
lscpu: (man) add note about cache sizes

Addresses: https://github.com/karelzak/util-linux/issues/827
Signed-off-by: Karel Zak <kzak@redhat.com>
4 years agoagetty: simplify code in dolog() preprocessor blocks
Sami Kerola [Sun, 21 Jul 2019 20:36:28 +0000 (21:36 +0100)] 
agetty: simplify code in dolog() preprocessor blocks

Aim is to make dolog() a lot more readable and understandable, with downside
of when (rarely?) USE_SYSLOG it not defined the function will use a bit more
space from stack.  I think that is price well worth paying.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
4 years agologin: simplify string handling
Sami Kerola [Sun, 21 Jul 2019 18:12:03 +0000 (19:12 +0100)] 
login: simplify string handling

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
4 years agolast: replace strncat() with more robust mem2strcpy()
Sami Kerola [Sat, 20 Jul 2019 10:11:01 +0000 (11:11 +0100)] 
last: replace strncat() with more robust mem2strcpy()

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
4 years agotests: (fdisk) update padding in output
Karel Zak [Tue, 23 Jul 2019 14:35:20 +0000 (16:35 +0200)] 
tests: (fdisk) update padding in output

Signed-off-by: Karel Zak <kzak@redhat.com>
4 years agotests: (libsmartcols) add padding tests
Karel Zak [Tue, 23 Jul 2019 14:26:48 +0000 (16:26 +0200)] 
tests: (libsmartcols) add padding tests

Signed-off-by: Karel Zak <kzak@redhat.com>
4 years agolibsmartcols: cleanup and extend padding functionality
Karel Zak [Tue, 23 Jul 2019 14:04:51 +0000 (16:04 +0200)] 
libsmartcols: cleanup and extend padding functionality

LIBSMARTCOLS_DEBUG_PADDING=on in the next examples forces libsmartcols
print '.' as a padding char. See line "ffff" in the exmaples.

* default output is to fill all except last cell

$ LIBSMARTCOLS_DEBUG_PADDING=on ./sample-scols-fromfile --nlines 10  --width 80 --column tests/ts/libsmartcols/files/col-name --column tests/ts/libsmartcols/files/col-number --column tests/ts/libsmartcols/files/col-string --column tests/ts/libsmartcols/files/col-string tests/ts/libsmartcols/files/data-string tests/ts/libsmartcols/files/data-number tests/ts/libsmartcols/files/data-string-empty tests/ts/libsmartcols/files/data-string-empty 2> /dev/null
NAME.. ......NUM STRINGS STRINGS
aaaa.. ........0 aaaa... aaaa
bbb... ......100 bbb.... bbb
ccccc. .......21 ccccc.. ccccc
dddddd ........3 dddddd. dddddd
ee.... ......411 ee..... ee
ffff.. .....5111 .......
gggggg 678993321 gggggg. gggggg
hhh... ..7666666 hhh.... hhh

* scols_table_enable_minout() minimizes output for tailing empty cells, example:

$ LIBSMARTCOLS_DEBUG_PADDING=on ./sample-scols-fromfile --nlines 10 --minout  --width 80 --column tests/ts/libsmartcols/files/col-name --column tests/ts/libsmartcols/files/col-number --column tests/ts/libsmartcols/files/col-string --column tests/ts/libsmartcols/files/col-string tests/ts/libsmartcols/files/data-string tests/ts/libsmartcols/files/data-number tests/ts/libsmartcols/files/data-string-empty tests/ts/libsmartcols/files/data-string-empty 2> /dev/null
NAME.. ......NUM STRINGS STRINGS
aaaa.. ........0 aaaa... aaaa
bbb... ......100 bbb.... bbb
ccccc. .......21 ccccc.. ccccc
dddddd ........3 dddddd. dddddd
ee.... ......411 ee..... ee
ffff.. .....5111
gggggg 678993321 gggggg. gggggg
hhh... ..7666666 hhh.... hhh

* cleanup up scols_table_enable_maxout() use, example:

$ LIBSMARTCOLS_DEBUG_PADDING=on ./sample-scols-fromfile --nlines 10 --maxout  --width 80 --column tests/ts/libsmartcols/files/col-name --column tests/ts/libsmartcols/files/col-number --column tests/ts/libsmartcols/files/col-string --column tests/ts/libsmartcols/files/col-string tests/ts/libsmartcols/files/data-string tests/ts/libsmartcols/files/data-number tests/ts/libsmartcols/files/data-string-empty tests/ts/libsmartcols/files/data-string-empty 2> /dev/null
NAME.............. ..................NUM STRINGS............ STRINGS............
aaaa.............. ....................0 aaaa............... aaaa...............
bbb............... ..................100 bbb................ bbb................
ccccc............. ...................21 ccccc.............. ccccc..............
dddddd............ ....................3 dddddd............. dddddd.............
ee................ ..................411 ee................. ee.................
ffff.............. .................5111 ................... ...................
gggggg............ ............678993321 gggggg............. gggggg.............
hhh............... ..............7666666 hhh................ hhh................

Note that we cannot make scols_table_enable_minout() default because
for example "column --table" is pretty commonly used with non-blank
columns separator and in this case all cells has to be filled.

$ echo -e "aa,b,ccc\na,,\naaa,bbb,ccc" |  column --table --separator ',' --output-separator '|'
aa |b  |ccc
a  |   |
aaa|bbb|ccc

Addresses: https://github.com/karelzak/util-linux/issues/826
Signed-off-by: Karel Zak <kzak@redhat.com>
4 years agolibfdisk: improve partition copy on resize
Karel Zak [Mon, 22 Jul 2019 10:09:38 +0000 (12:09 +0200)] 
libfdisk: improve partition copy on resize

It seems pretty fragile to copy also reference counting and reference
to table list.

Addresses: https://github.com/karelzak/util-linux/pull/822
Signed-off-by: Karel Zak <kzak@redhat.com>
4 years agolibblkid: (drbd) fix comment formatting
Karel Zak [Mon, 22 Jul 2019 09:49:45 +0000 (11:49 +0200)] 
libblkid: (drbd) fix comment formatting

... to avoid misinterpretation by gtk-docs.

Signed-off-by: Karel Zak <kzak@redhat.com>
4 years agoMerge branch 'master_fix-partition-copy' of https://github.com/vojtechtrefny/util...
Karel Zak [Mon, 22 Jul 2019 09:35:12 +0000 (11:35 +0200)] 
Merge branch 'master_fix-partition-copy' of https://github.com/vojtechtrefny/util-linux

4 years agofstrim: fix systemd service protection
Karel Zak [Mon, 22 Jul 2019 09:10:30 +0000 (11:10 +0200)] 
fstrim: fix systemd service protection

ProtectHome=yes makes /home inaccessible, but we need to open the
directories (mountpoints) read-only.

Addresses: https://github.com/karelzak/util-linux/issues/824
Signed-off-by: Karel Zak <kzak@redhat.com>
4 years agolibfdisk: Fix double free of *_chs strings in fdisk_partition
Vojtech Trefny [Fri, 19 Jul 2019 11:35:11 +0000 (13:35 +0200)] 
libfdisk: Fix double free of *_chs strings in fdisk_partition

__copy_partition doesn't duplicate these strings which leads to
occasional double free.

Signed-off-by: Vojtech Trefny <vtrefny@redhat.com>
4 years agolibfdisk: don't use NTFS as MBR
Karel Zak [Wed, 17 Jul 2019 10:42:39 +0000 (12:42 +0200)] 
libfdisk: don't use NTFS as MBR

Same as 7c643ed2855058657798d9e8e80701023de14a08.

Signed-off-by: Karel Zak <kzak@redhat.com>
4 years agolibblkid: do not interpret NTFS as MBR
Karel Zak [Wed, 17 Jul 2019 10:35:45 +0000 (12:35 +0200)] 
libblkid: do not interpret NTFS as MBR

 # mkntfs -Q -F /dev/sdc

old version:
 # ./blkid -p /dev/sdc
 /dev/sdc: UUID="0E9E8C5F2F718479" TYPE="ntfs" USAGE="filesystem" PTTYPE="dos"

new version:
 # ./blkid -p /dev/sdc
 /dev/sdc: UUID="0E9E8C5F2F718479" TYPE="ntfs" USAGE="filesystem"

Reported-by: Mike Fleetwood <mike.fleetwood@googlemail.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
4 years agolibfdisk: don't use FAT as MBR
Karel Zak [Wed, 17 Jul 2019 10:11:38 +0000 (12:11 +0200)] 
libfdisk: don't use FAT as MBR

The current libfdisk MBR detection is too weak, the result is that it
reuses MBR from FAT. The correct behavior is to create a new MBR, wipe
first sector (on write) and warn about obsolete FAT superblock.

Reported-by: Mike Fleetwood <mike.fleetwood@googlemail.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
4 years agobuild-sys: improve hwclock CMOS dependences
Karel Zak [Mon, 15 Jul 2019 13:32:49 +0000 (15:32 +0200)] 
build-sys: improve hwclock CMOS dependences

Let's use standard UL_* macros to check for dependencies
(architectures and hwclock).

Signed-off-by: Karel Zak <kzak@redhat.com>
4 years agobuild-sys: add UL_REQUIRES_ARCH()
Karel Zak [Mon, 15 Jul 2019 13:31:40 +0000 (15:31 +0200)] 
build-sys: add UL_REQUIRES_ARCH()

Signed-off-by: Karel Zak <kzak@redhat.com>
4 years agohwclock: use CMOS clock only if available
Carlos Santos [Wed, 3 Jul 2019 16:31:34 +0000 (13:31 -0300)] 
hwclock: use CMOS clock only if available

- Add --disable-hwclock-cmos configuration argument
- Add USE_HWCLOCK_CMOS (enabled by default for i386/x86_64)
- Add define(USE_HWCLOCK_CMOS)
- Compile hwclock-cmos.c only if USE_HWCLOCK_CMOS is true
- Remove all unnecessary #ifdefs from hwclock-cmos.c
- Add #ifdef USE_HWCLOCK_CMOS around the determine_clock_access_method()
  call in hwclock.c

Signed-off-by: Carlos Santos <unixmania@gmail.com>
4 years agotests: (libmount) make X-* and x-* more robust
Karel Zak [Mon, 15 Jul 2019 10:46:11 +0000 (12:46 +0200)] 
tests: (libmount) make X-* and x-* more robust

Addresses: https://github.com/karelzak/util-linux/issues/818
Signed-off-by: Karel Zak <kzak@redhat.com>
4 years agolsblk: fix -E segfault
Karel Zak [Mon, 15 Jul 2019 10:28:26 +0000 (12:28 +0200)] 
lsblk: fix -E segfault

We need to check if referenced wholedisk defines the de-duplication
key...

Addresses: https://github.com/karelzak/util-linux/issues/819
Signed-off-by: Karel Zak <kzak@redhat.com>
4 years agolibblkid: (drbd) simplify padding
Karel Zak [Mon, 15 Jul 2019 10:07:42 +0000 (12:07 +0200)] 
libblkid: (drbd) simplify padding

We do not need all the metadata and it seems the extra padding is
problematic in some cases. Let's keep is simple and use fixed offset
for the metadata rather than sizeof().

References: https://github.com/karelzak/util-linux/pull/820
Signed-off-by: Karel Zak <kzak@redhat.com>
4 years agoMerge branch '2019wk27' of https://github.com/kerolasa/util-linux
Karel Zak [Mon, 15 Jul 2019 09:37:17 +0000 (11:37 +0200)] 
Merge branch '2019wk27' of https://github.com/kerolasa/util-linux

* '2019wk27' of https://github.com/kerolasa/util-linux:
  libblkid: fix address sanitizer issues
  libblkid: check number of test_blkid_save arguments correctly
  include/xalloc: ensure xstrdup() and xstrndup() returns nonnull attribute
  libmount: fix potential null pointer dereference
  libfdisk: fix variable shadowing
  lib/ttyutils: avoid checking same thing twice

4 years agobuild-sys: Include <stdlib.h> in ./configure wchar_t test
Florian Weimer [Fri, 5 Jul 2019 15:20:27 +0000 (17:20 +0200)] 
build-sys: Include <stdlib.h> in ./configure wchar_t test

Without #include <stdlib.h>, this configure check fails for strict
C99/C11 compilers which do not support implicit function declarations
(which are a C90 feature removed from C99).

Signed-off-by: Karel Zak <kzak@redhat.com>
4 years agolibblkid: fix address sanitizer issues
Sami Kerola [Sun, 14 Jul 2019 09:17:32 +0000 (10:17 +0100)] 
libblkid: fix address sanitizer issues

With aligned attribute many blkid tests fail with following error.  So
instead of aligning to 4K add padding that makes the struct same size
without causing asan trip over.

    libblkid/src/superblocks/drbd.c:179:6: runtime error: member access
    within misaligned address 0x55913d7e6958 for type 'struct
    meta_data_on_disk_9', which requires 4096 byte alignment

In zfs structure it seems compiler is adding padding, that does not mix well
with be32_to_cpu() and other bit operations.

    libblkid/src/superblocks/zfs.c:109:23: runtime error: load of misaligned
    address 0x7ff6406540e4 for type 'uint32_t' (aka 'unsigned int'), which
    requires 8 byte alignment

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
4 years agolibblkid: check number of test_blkid_save arguments correctly
Sami Kerola [Sat, 13 Jul 2019 08:31:06 +0000 (09:31 +0100)] 
libblkid: check number of test_blkid_save arguments correctly

Without this running test_blkid_save without arguments will cause a crash
when strdup() refers to none-exiting file name.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
4 years agoinclude/xalloc: ensure xstrdup() and xstrndup() returns nonnull attribute
Sami Kerola [Fri, 12 Jul 2019 21:28:10 +0000 (22:28 +0100)] 
include/xalloc: ensure xstrdup() and xstrndup() returns nonnull attribute

Turned out lsblk is passing null as argument to xstrdup(), so fix that and
add assert() to make sure promise of not returning null is kept in future.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
4 years agolibmount: fix potential null pointer dereference
Sami Kerola [Fri, 12 Jul 2019 20:56:52 +0000 (21:56 +0100)] 
libmount: fix potential null pointer dereference

This is false positive warning, but lets silence it so that if and when
warnings crop up they are easy to notice and take seriously.

libmount/src/optstr.c:354:29: warning: potential null pointer dereference
[-Wnull-dereference]

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
4 years agolibfdisk: fix variable shadowing
Sami Kerola [Fri, 12 Jul 2019 20:45:50 +0000 (21:45 +0100)] 
libfdisk: fix variable shadowing

libfdisk/src/context.c:678:7: warning: declaration of ‘rc’ shadows a
previous local [-Wshadow]

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
4 years agolib/ttyutils: avoid checking same thing twice
Sami Kerola [Mon, 1 Jul 2019 21:02:06 +0000 (22:02 +0100)] 
lib/ttyutils: avoid checking same thing twice

Check cols and lines are not NULL only once.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
4 years agolsblk: force to print PKNAME for partition
Karel Zak [Thu, 27 Jun 2019 07:22:18 +0000 (09:22 +0200)] 
lsblk: force to print PKNAME for partition

PKNAME (parent kernel device name) is based on printed tree according
to parent -> child relationship. The tree is optional and not printed
if partition specified (.e.g "lsblk -o+PKNAME /dev/sda1"), but old
versions print the PKNAME also in this case.

Addresses: https://github.com/karelzak/util-linux/issues/813
Signed-off-by: Karel Zak <kzak@redhat.com>
4 years agoTODO: fix typo
Sanchit Saini [Fri, 21 Jun 2019 17:51:46 +0000 (23:21 +0530)] 
TODO: fix typo

4 years agoFix translations for losetup typo fix
Stanislav Brabec [Thu, 20 Jun 2019 21:42:40 +0000 (23:42 +0200)] 
Fix translations for losetup typo fix

Signed-off-by: Stanislav Brabec <sbrabec@suse.cz>
4 years agolosetup: Typo fix
Stanislav Brabec [Thu, 20 Jun 2019 21:41:30 +0000 (23:41 +0200)] 
losetup: Typo fix

Fix a typo in usage introduced in a1a41597bf.

Signed-off-by: Stanislav Brabec <sbrabec@suse.cz>
4 years agoagetty: Remove superfluous fflush()
Stanislav Brabec [Thu, 20 Jun 2019 20:16:42 +0000 (22:16 +0200)] 
agetty: Remove superfluous fflush()

eval_issue_file() contains fflush(stdout). It comes from an old code that
used fputs() to write to the console.

In the new code, we write to a temporary memstream, and
fclose(ie->output) fully replaces possible fflush(ie->output) in this
implementation.

The new print_issue_file() does not need it as well, as it uses
unbuffered write_all().

Signed-off-by: Stanislav Brabec <sbrabec@suse.cz>
4 years agolibfdisk: fix typos
Marcos Mello [Thu, 20 Jun 2019 11:22:25 +0000 (08:22 -0300)] 
libfdisk: fix typos

4 years agoRevert "lib/loopdev.c: Inline loopcxt_has_device"
Karel Zak [Tue, 18 Jun 2019 20:05:16 +0000 (22:05 +0200)] 
Revert "lib/loopdev.c: Inline loopcxt_has_device"

... no caller in that file, this change has no effect.

This reverts commit 3bb960c7b5f1428f1bff885b2667787e8af5001b.

4 years agolibfdisk: add fdisk_assign_device_by_fd()
Karel Zak [Tue, 18 Jun 2019 11:30:42 +0000 (13:30 +0200)] 
libfdisk: add fdisk_assign_device_by_fd()

It's possible that caller has the device already opened for some
other task, so let's reuse the file descriptor.

Requested-by: Lennart Poettering <lennart@poettering.net>
Signed-off-by: Karel Zak <kzak@redhat.com>
4 years agoMerge branch 'su_err_msg' of https://github.com/jhrozek/util-linux
Karel Zak [Tue, 18 Jun 2019 09:26:12 +0000 (11:26 +0200)] 
Merge branch 'su_err_msg' of https://github.com/jhrozek/util-linux

* 'su_err_msg' of https://github.com/jhrozek/util-linux:
  su: More descriptive error message on malformed user entry

4 years agoMerge branch 'topic/wdctl'
Karel Zak [Mon, 17 Jun 2019 13:48:28 +0000 (15:48 +0200)] 
Merge branch 'topic/wdctl'

4 years agowdctl; read from /sys if necessary
Karel Zak [Thu, 6 Jun 2019 09:17:13 +0000 (11:17 +0200)] 
wdctl; read from /sys if necessary

The device can be inaccessible for non-root user or busy (already used
by another process). In this case it seems better to read information
from /sys.

Note that /sys does not provide struct watchdog_info.options, so we
cannot print list of supported watchdog features.

Addresses: https://github.com/karelzak/util-linux/issues/804
Signed-off-by: Karel Zak <kzak@redhat.com>
4 years agolib/path: make sure ul_path_read_buffer() derminate result
Karel Zak [Thu, 6 Jun 2019 09:09:17 +0000 (11:09 +0200)] 
lib/path: make sure ul_path_read_buffer() derminate result

Signed-off-by: Karel Zak <kzak@redhat.com>
4 years agowdctl: default to /dev/watchdog0
Karel Zak [Fri, 31 May 2019 12:49:23 +0000 (14:49 +0200)] 
wdctl: default to /dev/watchdog0

Let's use miscdev /dev/watchdog as fallback only. We need (if possible)
cdev /dev/watchdog0 as this device has entry in /sys/class/watchdog.

Signed-off-by: Karel Zak <kzak@redhat.com>
4 years agowdctl: remove printing from main()
Karel Zak [Fri, 31 May 2019 12:25:41 +0000 (14:25 +0200)] 
wdctl: remove printing from main()

Signed-off-by: Karel Zak <kzak@redhat.com>
4 years agowdctl: add control struct
Karel Zak [Fri, 31 May 2019 12:18:19 +0000 (14:18 +0200)] 
wdctl: add control struct

* remove global variables
* keep all together

Signed-off-by: Karel Zak <kzak@redhat.com>
4 years agowdctl: rename watch dog info struct
Karel Zak [Fri, 31 May 2019 12:06:04 +0000 (14:06 +0200)] 
wdctl: rename watch dog info struct

Signed-off-by: Karel Zak <kzak@redhat.com>
4 years agoinclude/closestream: avoid close more than once
Karel Zak [Thu, 13 Jun 2019 11:25:44 +0000 (13:25 +0200)] 
include/closestream: avoid close more than once

Signed-off-by: Karel Zak <kzak@redhat.com>
4 years agomisc: replaces atexit(close_stdout) with new close_stdout_atexit()
Karel Zak [Thu, 13 Jun 2019 11:22:32 +0000 (13:22 +0200)] 
misc: replaces atexit(close_stdout) with new close_stdout_atexit()

Signed-off-by: Karel Zak <kzak@redhat.com>
4 years agolibfdisk: fix fdisk_script_get_table()
Karel Zak [Mon, 10 Jun 2019 09:43:56 +0000 (11:43 +0200)] 
libfdisk: fix fdisk_script_get_table()

Make sure we never return NULL and we reuse the table in code.

Signed-off-by: Karel Zak <kzak@redhat.com>
4 years agolibfdisk: (docs) add notes about fdisk_enable_wipe()
Karel Zak [Fri, 7 Jun 2019 11:21:23 +0000 (13:21 +0200)] 
libfdisk: (docs) add notes about fdisk_enable_wipe()

Signed-off-by: Karel Zak <kzak@redhat.com>
4 years agolibfdisk: add fdisk_script_set_table()
Karel Zak [Fri, 7 Jun 2019 10:20:53 +0000 (12:20 +0200)] 
libfdisk: add fdisk_script_set_table()

This small change improves possibility to modify by script described
PT and use script API in another tools as primary way to create
partitions.

All you need is to compose script by fdisk_script_set_header() and
fdisk_script_set_table() and than apply by fdisk_apply_script().

Requested-by: Lennart Poettering <lennart@poettering.net>
Signed-off-by: Karel Zak <kzak@redhat.com>
4 years agolscpu: add a new columns to --cache
Karel Zak [Thu, 6 Jun 2019 12:05:26 +0000 (14:05 +0200)] 
lscpu: add a new columns to --cache

References: https://www.kernel.org/doc/Documentation/ABI/testing/sysfs-devices-system-cpu
Signed-off-by: Karel Zak <kzak@redhat.com>
4 years agodocs: we have 2019 already
Karel Zak [Mon, 17 Jun 2019 10:55:25 +0000 (12:55 +0200)] 
docs: we have 2019 already

Signed-off-by: Karel Zak <kzak@redhat.com>
4 years agobuild-sys: release++ (v2.34) v2.34
Karel Zak [Fri, 14 Jun 2019 10:34:10 +0000 (12:34 +0200)] 
build-sys: release++ (v2.34)

Signed-off-by: Karel Zak <kzak@redhat.com>
4 years agodocs: update v2.34-ReleaseNotes
Karel Zak [Fri, 14 Jun 2019 10:32:22 +0000 (12:32 +0200)] 
docs: update v2.34-ReleaseNotes

Signed-off-by: Karel Zak <kzak@redhat.com>
4 years agodocs: update AUTHORS file
Karel Zak [Fri, 14 Jun 2019 10:30:20 +0000 (12:30 +0200)] 
docs: update AUTHORS file

Signed-off-by: Karel Zak <kzak@redhat.com>
4 years agopo: merge changes
Karel Zak [Fri, 14 Jun 2019 10:18:19 +0000 (12:18 +0200)] 
po: merge changes

Signed-off-by: Karel Zak <kzak@redhat.com>
4 years agopo: update zh_CN.po (from translationproject.org)
Boyuan Yang [Fri, 14 Jun 2019 10:13:54 +0000 (12:13 +0200)] 
po: update zh_CN.po (from translationproject.org)

4 years agopo: update uk.po (from translationproject.org)
Yuri Chornoivan [Fri, 14 Jun 2019 10:13:54 +0000 (12:13 +0200)] 
po: update uk.po (from translationproject.org)

4 years agopo: update sv.po (from translationproject.org)
Sebastian Rasmussen [Fri, 14 Jun 2019 10:13:53 +0000 (12:13 +0200)] 
po: update sv.po (from translationproject.org)

4 years agopo: update pt_BR.po (from translationproject.org)
Rafael Fontenelle [Fri, 14 Jun 2019 10:13:53 +0000 (12:13 +0200)] 
po: update pt_BR.po (from translationproject.org)

4 years agopo: update pl.po (from translationproject.org)
Jakub Bogusz [Fri, 14 Jun 2019 10:13:53 +0000 (12:13 +0200)] 
po: update pl.po (from translationproject.org)

4 years agopo: update ja.po (from translationproject.org)
Takeshi Hamasaki [Fri, 14 Jun 2019 10:13:53 +0000 (12:13 +0200)] 
po: update ja.po (from translationproject.org)

4 years agopo: update hr.po (from translationproject.org)
Božidar Putanec [Fri, 14 Jun 2019 10:13:53 +0000 (12:13 +0200)] 
po: update hr.po (from translationproject.org)

4 years agopo: update fr.po (from translationproject.org)
Frédéric Marchal [Fri, 14 Jun 2019 10:13:53 +0000 (12:13 +0200)] 
po: update fr.po (from translationproject.org)

4 years agopo: update es.po (from translationproject.org)
Antonio Ceballos Roa [Fri, 14 Jun 2019 10:13:53 +0000 (12:13 +0200)] 
po: update es.po (from translationproject.org)

4 years agopo: update de.po (from translationproject.org)
Mario Blättermann [Fri, 14 Jun 2019 10:13:53 +0000 (12:13 +0200)] 
po: update de.po (from translationproject.org)

4 years agopo: update da.po (from translationproject.org)
Joe Hansen [Fri, 14 Jun 2019 10:13:53 +0000 (12:13 +0200)] 
po: update da.po (from translationproject.org)

4 years agopo: update cs.po (from translationproject.org)
Petr Písař [Fri, 14 Jun 2019 10:13:53 +0000 (12:13 +0200)] 
po: update cs.po (from translationproject.org)

4 years agotests: update build-sys output
Karel Zak [Fri, 14 Jun 2019 10:06:58 +0000 (12:06 +0200)] 
tests: update build-sys output

It seems, no more libgcc_s...

Signed-off-by: Karel Zak <kzak@redhat.com>
4 years agolibsmartcols: fix docs
Karel Zak [Thu, 13 Jun 2019 11:45:46 +0000 (13:45 +0200)] 
libsmartcols: fix docs

Signed-off-by: Karel Zak <kzak@redhat.com>
4 years agolibmount: fix docs typo
Karel Zak [Thu, 13 Jun 2019 11:45:39 +0000 (13:45 +0200)] 
libmount: fix docs typo

Signed-off-by: Karel Zak <kzak@redhat.com>
4 years agorev: be careful with close()
Karel Zak [Thu, 13 Jun 2019 10:59:39 +0000 (12:59 +0200)] 
rev: be careful with close()

Addresses: https://github.com/karelzak/util-linux/issues/807
Signed-off-by: Karel Zak <kzak@redhat.com>
4 years agofindmnt: (verify) ignore passno for XFS
Karel Zak [Wed, 12 Jun 2019 09:02:51 +0000 (11:02 +0200)] 
findmnt: (verify) ignore passno for XFS

Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=1719069
Signed-off-by: Karel Zak <kzak@redhat.com>
4 years agolib/sysfs: fix reference counting for parent
Karel Zak [Tue, 11 Jun 2019 10:11:32 +0000 (12:11 +0200)] 
lib/sysfs: fix reference counting for parent

Signed-off-by: Karel Zak <kzak@redhat.com>
4 years agocfdisk: free libfdisk items
Karel Zak [Tue, 11 Jun 2019 09:22:22 +0000 (11:22 +0200)] 
cfdisk: free libfdisk items

Signed-off-by: Karel Zak <kzak@redhat.com>
4 years agofstrim: update man page, reuse libmnt_iter
Karel Zak [Tue, 11 Jun 2019 09:05:12 +0000 (11:05 +0200)] 
fstrim: update man page, reuse libmnt_iter

* add info about read-only to the man page
* don't be systemd specific, people aso use crond
* reuse libmnt_iter

Signed-off-by: Karel Zak <kzak@redhat.com>
4 years agocfdisk: simplify code
Karel Zak [Tue, 11 Jun 2019 08:54:22 +0000 (10:54 +0200)] 
cfdisk: simplify code

Signed-off-by: Karel Zak <kzak@redhat.com>
4 years agofstrim: properly de-duplicate fstrim -A
Stanislav Brabec [Mon, 10 Jun 2019 19:59:17 +0000 (21:59 +0200)] 
fstrim: properly de-duplicate fstrim -A

fstab can contain tag based mounts. De-duplication by source has to be
done after resolving the full source path.

Perform the table iteration twice. First time, prepare for
de-duplication, second time perform the TRIM itself.

Signed-off-by: Stanislav Brabec <sbrabec@suse.cz>
4 years agofstrim -a/-A: Skip read-only volumes
Stanislav Brabec [Mon, 10 Jun 2019 19:59:45 +0000 (21:59 +0200)] 
fstrim -a/-A: Skip read-only volumes

Calling TRIM on some read-only volumes can fail with:
fstrim: /win: FITRIM ioctl failed: Bad file descriptor

Skipping all read-only mounts seems to be safe and logical strategy.

Fixes opensuse#1106214.

Signed-off-by: Stanislav Brabec <sbrabec@suse.cz>
4 years agofstrim: Fix fstrim_all() comment
Stanislav Brabec [Mon, 10 Jun 2019 19:59:21 +0000 (21:59 +0200)] 
fstrim: Fix fstrim_all() comment

"convert LABEL=" does not happens in mnt_fs_get_source(), but later in
mnt_resolve_spec(). To make this more clean, move the comment before this
chunk of code.

Signed-off-by: Stanislav Brabec <sbrabec@suse.cz>
4 years agolib/canonicalize: fix compiler warning [-Wsign-compare]
Karel Zak [Mon, 10 Jun 2019 09:00:38 +0000 (11:00 +0200)] 
lib/canonicalize: fix compiler warning [-Wsign-compare]

Signed-off-by: Karel Zak <kzak@redhat.com>
4 years agolibmount: (docs) add reference to v2.33 and v2.34
Karel Zak [Fri, 7 Jun 2019 10:37:28 +0000 (12:37 +0200)] 
libmount: (docs) add reference to v2.33 and v2.34

Signed-off-by: Karel Zak <kzak@redhat.com>