]> git.ipfire.org Git - thirdparty/util-linux.git/log
thirdparty/util-linux.git
7 years agobuild-sys: release++ (v2.28.2) stable/v2.28 v2.28.2
Karel Zak [Wed, 7 Sep 2016 11:35:24 +0000 (13:35 +0200)] 
build-sys: release++ (v2.28.2)

Signed-off-by: Karel Zak <kzak@redhat.com>
7 years agodocs: update v2.28.2-ReleaseNotes
Karel Zak [Wed, 7 Sep 2016 11:34:09 +0000 (13:34 +0200)] 
docs: update v2.28.2-ReleaseNotes

Signed-off-by: Karel Zak <kzak@redhat.com>
7 years agodocs: update AUTHORS file
Karel Zak [Wed, 7 Sep 2016 11:31:58 +0000 (13:31 +0200)] 
docs: update AUTHORS file

Signed-off-by: Karel Zak <kzak@redhat.com>
7 years agopo: merge changes
Karel Zak [Wed, 7 Sep 2016 11:29:22 +0000 (13:29 +0200)] 
po: merge changes

Signed-off-by: Karel Zak <kzak@redhat.com>
7 years agolibsmartcols: fix padding for non-maxout output
Karel Zak [Tue, 6 Sep 2016 11:34:07 +0000 (13:34 +0200)] 
libsmartcols: fix padding for non-maxout output

Signed-off-by: Karel Zak <kzak@redhat.com>
7 years agolibsmartcols: fix empty cell padding
Karel Zak [Tue, 6 Sep 2016 09:02:59 +0000 (11:02 +0200)] 
libsmartcols: fix empty cell padding

The code does not print columns separator.

Signed-off-by: Karel Zak <kzak@redhat.com>
7 years agotests: Fix fdisk/id and fdisk/mbr-nondos-mode on Sparc
James Clarke [Thu, 14 Jul 2016 08:02:24 +0000 (09:02 +0100)] 
tests: Fix fdisk/id and fdisk/mbr-nondos-mode on Sparc

On Sparc, fdisk defaults to using SUN disk labels, which causes the
output from these tests to differ from non-Sparc.

Signed-off-by: James Clarke <jrtc27@jrtc27.com>
7 years agobuild-sys: add parisc to define ARCH_
Karel Zak [Tue, 16 Aug 2016 11:39:07 +0000 (13:39 +0200)] 
build-sys: add parisc to define ARCH_

Signed-off-by: Karel Zak <kzak@redhat.com>
7 years agotests: keep 'hppa' in fdisk/bsd test too
Karel Zak [Tue, 16 Aug 2016 11:40:44 +0000 (13:40 +0200)] 
tests: keep 'hppa' in fdisk/bsd test too

Signed-off-by: Karel Zak <kzak@redhat.com>
7 years agotests: really fix fdisk/bsd for hppa
Helge Deller [Mon, 15 Aug 2016 20:26:30 +0000 (22:26 +0200)] 
tests: really fix fdisk/bsd for hppa

Finally fix the bsd testcase on the hppa architecture.

Commit 1b7be556e553cdcef6213ead6340832c306011ed tried to fix it,
but missed the fact that "uname -m" returns "parisc" or "parisc64"
instead of "hppa*".

Signed-off-by: Helge Deller <deller@gmx.de>
Cc: 827225@bugs.debian.org
7 years agopathnames: guard clashing definitions on FreeBSD
Franco Fichtner [Thu, 11 Aug 2016 13:03:50 +0000 (15:03 +0200)] 
pathnames: guard clashing definitions on FreeBSD

7 years agoblkdev: guard against missing DIOCGDINFO on FreeBSD 11
Franco Fichtner [Thu, 11 Aug 2016 12:56:08 +0000 (14:56 +0200)] 
blkdev: guard against missing DIOCGDINFO on FreeBSD 11

DIOCGMEDIASIZE is supported and available since FreeBSD 5, it may
make sense to kill the backwards-glue completely instead.

7 years agolib/loopdev: Set errno in is_loopdev on error
Tobias Stoeckmann [Tue, 30 Aug 2016 19:00:38 +0000 (21:00 +0200)] 
lib/loopdev: Set errno in is_loopdev on error

The function is_loopdev does not set errno if the supplied string does
not reference a valid loop device. Fix this to avoid an error message
like this one:

  losetup: /: failed to use device: Success

I prefer this one:

  losetup: /: failed to use device: No such device

Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
7 years agolibblkid: [exfat] Limit maximum number of iterations in find_label
Rostislav Skudnov [Tue, 30 Aug 2016 10:07:49 +0000 (10:07 +0000)] 
libblkid: [exfat] Limit maximum number of iterations in find_label

Do not hang if there is a cluster chain loop in rootdir

[kzak@redhat.com: - add return NULL]

Signed-off-by: Karel Zak <kzak@redhat.com>
7 years agoumount: fix obsolete info about loop= in umount.8
Karel Zak [Tue, 30 Aug 2016 08:25:44 +0000 (10:25 +0200)] 
umount: fix obsolete info about loop= in umount.8

Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=1370959
Signed-off-by: Karel Zak <kzak@redhat.com>
7 years agolibblkid: Avoid OOB access on illegal ZFS superblocks
Tobias Stoeckmann [Sun, 28 Aug 2016 19:15:59 +0000 (21:15 +0200)] 
libblkid: Avoid OOB access on illegal ZFS superblocks

64 bit systems can trigger an out of boundary access while performing
a ZFS superblock probe.

This happens due to a possible integer overflow while calculating
the remaining available bytes. The variable is of type "int" and the
string length is allowed to be larger than INT_MAX, which means that
avail calculation can overflow, circumventing the "avail < 0" check and
therefore accessing memory outside the "buff" array later on.

Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
7 years agolibblkid: Check that cluster size is nonzero when probing exFAT
Rostislav Skudnov [Thu, 11 Aug 2016 18:24:00 +0000 (18:24 +0000)] 
libblkid: Check that cluster size is nonzero when probing exFAT

This should prevent division by zero in find_label()

Signed-off-by: Rostislav Skudnov <rostislav@tuxera.com>
7 years agolsns: missing ns/<name> is not error
Karel Zak [Mon, 15 Aug 2016 09:02:18 +0000 (11:02 +0200)] 
lsns: missing ns/<name> is not error

For example user namespace is optional it does not make sense to
ignore process completely if the ns/user file is missing.

Reported-by: Michał Bartoszkiewicz <mbartoszkiewicz@gmail.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
7 years agoRevert "sfdisk: exit with error if rereading partition table fails"
Karel Zak [Wed, 31 Aug 2016 09:01:03 +0000 (11:01 +0200)] 
Revert "sfdisk: exit with error if rereading partition table fails"

This reverts commit e0d30ef4c0a8baf5ad52f4ebce2ceef1944d711b. It was
mistake to applied this commit to the stable branch. It's already
reverted in master branch too (see
78e7f78896f2c9cf1b2615c8c555a64dcd9d2642 for more details).

Signed-off-by: Karel Zak <kzak@redhat.com>
7 years agobuild-sys: release++ (v2.28.1) v2.28.1
Karel Zak [Thu, 11 Aug 2016 09:28:45 +0000 (11:28 +0200)] 
build-sys: release++ (v2.28.1)

Signed-off-by: Karel Zak <kzak@redhat.com>
7 years agodocs: update v2.28.1-ReleaseNotes
Karel Zak [Thu, 11 Aug 2016 09:27:19 +0000 (11:27 +0200)] 
docs: update v2.28.1-ReleaseNotes

Signed-off-by: Karel Zak <kzak@redhat.com>
7 years agodocs: update AUTHORS file
Karel Zak [Thu, 11 Aug 2016 09:23:05 +0000 (11:23 +0200)] 
docs: update AUTHORS file

Signed-off-by: Karel Zak <kzak@redhat.com>
7 years agopo: merge changes
Karel Zak [Thu, 11 Aug 2016 09:20:46 +0000 (11:20 +0200)] 
po: merge changes

Signed-off-by: Karel Zak <kzak@redhat.com>
7 years agopo: update sv.po (from translationproject.org)
Sebastian Rasmussen [Thu, 11 Aug 2016 09:16:50 +0000 (11:16 +0200)] 
po: update sv.po (from translationproject.org)

7 years agopo: update nl.po (from translationproject.org)
Benno Schulenberg [Thu, 11 Aug 2016 09:16:50 +0000 (11:16 +0200)] 
po: update nl.po (from translationproject.org)

7 years agopo: update ja.po (from translationproject.org)
Takeshi Hamasaki [Thu, 11 Aug 2016 09:16:50 +0000 (11:16 +0200)] 
po: update ja.po (from translationproject.org)

7 years agotools: add script to load .po from translationproject.org
Karel Zak [Wed, 25 May 2016 13:28:42 +0000 (15:28 +0200)] 
tools: add script to load .po from translationproject.org

I use it for years, let's keep it in the repository.

Signed-off-by: Karel Zak <kzak@redhat.com>
7 years agotests: Use proper word splitting when executing tests
Filipe Brandenburger [Wed, 10 Aug 2016 20:17:12 +0000 (13:17 -0700)] 
tests: Use proper word splitting when executing tests

Use the shell special variable "$@" instead of the inferior $* to
execute the test command in ts_valgrind.  The expansion of "$@" respects
proper word splitting and makes it possible to pass the command empty
arguments.  It might also prevent surprises with quoting in corner
cases.

Tested that `make check` passes.

Valgrind run with `make check TS_OPTS='--nonroot --memcheck'` passes.

Signed-off-by: Filipe Brandenburger <filbranden@google.com>
7 years agolibmount: Preserve empty string value in optstr parsing
Filipe Brandenburger [Wed, 10 Aug 2016 20:27:07 +0000 (13:27 -0700)] 
libmount: Preserve empty string value in optstr parsing

Recent mount (since the switch to libmount in v2.22) drops the '=' in
mount options that are set to an empty value.  For example, the command
line below will be affected:

  # mount -o rw,myopt='' -t tmpfs tmpfs /mnt/tmp

Fix that by preserving an empty string in the options passed to the
mount(2) syscall when they are present on the command line.

Add test cases to ensure empty string handling is working as expected
and in order to prevent regressions in the future.

Also tested manually by stracing mount commands (on a kernel which
accepts a special extra option, for testing purposes.)

Before this commit:

  # strace -e mount ./mount -t tmpfs -o rw,myopt='' tmpfs /mnt/tmp
  mount("tmpfs", "/mnt/tmp", "tmpfs", MS_MGC_VAL, "myarg") = -1 EINVAL (Invalid argument)

After this commit:

  # strace -e mount ./mount -t tmpfs -o rw,myopt='' tmpfs /mnt/tmp
  mount("tmpfs", "/mnt/tmp", "tmpfs", MS_MGC_VAL, "myopt=") = 0

All test cases pass, including newly added test cases.  Also checked
them with valgrind using:

  $ tests/run.sh --memcheck libmount/optstr

Fixes #332.

Signed-off-by: Filipe Brandenburger <filbranden@google.com>
7 years agotests: update build-sys test
Karel Zak [Wed, 10 Aug 2016 13:24:42 +0000 (15:24 +0200)] 
tests: update build-sys test

Signed-off-by: Karel Zak <kzak@redhat.com>
7 years agotaskset: clarify that masks are always hex in man page
Chris Metcalf [Tue, 9 Aug 2016 09:31:41 +0000 (11:31 +0200)] 
taskset: clarify that masks are always hex in man page

The man page confusingly says that the mask is "typically"
hexadecimal, when in fact it is always hexadecimal.  Fix the
language, and provide an additional example with no leading "0x".

Also, provide an example using the --cpu-list option.

Signed-off-by: Chris Metcalf <cmetcalf@mellanox.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
7 years agosfdisk: add show-pt-geometry to usage() and sfdisk.8
Karel Zak [Mon, 8 Aug 2016 10:15:47 +0000 (12:15 +0200)] 
sfdisk: add show-pt-geometry to usage() and sfdisk.8

Signed-off-by: Karel Zak <kzak@redhat.com>
7 years agodeprecated.txt: Add sfdisk --show-pt-geometry
Stanislav Brabec [Fri, 5 Aug 2016 11:05:39 +0000 (13:05 +0200)] 
deprecated.txt: Add sfdisk --show-pt-geometry

7 years agosfdisk: Add --show-pt-geometry compatibility code
Stanislav Brabec [Thu, 4 Aug 2016 18:15:57 +0000 (20:15 +0200)] 
sfdisk: Add --show-pt-geometry compatibility code

--show-pt-geometry existed since cf3f26bf (2006), and it is used by third party
tools. To prevent failure of these tools, add a minimal compatibility code.

Signed-off-by: Stanislav Brabec <sbrabec@suse.cz>
7 years agoliblkid: fix probe_nilfs2 I/O error backup
Karel Zak [Fri, 15 Jul 2016 08:39:20 +0000 (10:39 +0200)] 
liblkid: fix probe_nilfs2 I/O error backup

Signed-off-by: Karel Zak <kzak@redhat.com>
7 years agolibsmartcols: Corrected JSON escaping
Karel Zak [Tue, 2 Aug 2016 09:58:50 +0000 (11:58 +0200)] 
libsmartcols: Corrected JSON escaping

Based on patch set https://github.com/karelzak/util-linux/pull/331
from Fordi.

Addresses: https://github.com/karelzak/util-linux/issues/330
Co-Author: Bryan Elliott <fordiman@gmail.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
7 years agoagetty: call uname() only when necessary
Karel Zak [Wed, 20 Jul 2016 11:20:14 +0000 (13:20 +0200)] 
agetty: call uname() only when necessary

Signed-off-by: Karel Zak <kzak@redhat.com>
7 years agoagetty: fix \S usage
Karel Zak [Wed, 20 Jul 2016 11:16:13 +0000 (13:16 +0200)] 
agetty: fix \S usage

If \S without argument used then uninitialized 'varname' compared with
ANSI_COLOR.

Addresses: https://github.com/karelzak/util-linux/issues/329
Signed-off-by: Karel Zak <kzak@redhat.com>
7 years agotailf: Fix previously adjusted segfault patch
Tobias Stoeckmann [Sat, 16 Jul 2016 10:51:42 +0000 (12:51 +0200)] 
tailf: Fix previously adjusted segfault patch

Casting the value to be checked to size_t renders the check useless.
If st_size is SIZE_MAX+1, it will be truncated to 0 and the check
succeeds. In fact, this check can never be false because every value
stored in a size_t is smaller or equal to SIZE_MAX.

I think this adjustment was meant to fix a compiler warning for 64 bit
systems for which sizeof(off_t) is sizeof(size_t), but the signedness
differs.

Going unconditionally to the greatest possible unsigned int type if
st_size is positive (off_t is signed) will fix this issue.

Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
7 years agotailf: Fix segmentation fault in tailf on 32 bit
Tobias Stoeckmann [Sun, 10 Jul 2016 14:14:08 +0000 (16:14 +0200)] 
tailf: Fix segmentation fault in tailf on 32 bit

tailf crashes with a segmentation fault when used with a file that is
exactly 4GB in size due to an integer overflow between off_t and size_t:

$ dd if=/dev/zero of=tailf.crash bs=1 count=1 seek=4294967295
$ tailf tailf.crash
Segmentation fault
$ _

Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
Signed-off-by: Karel Zak <kzak@redhat.com>
7 years agoblkdiscard: Improve man page
Allon Mureinik [Thu, 14 Jul 2016 10:19:25 +0000 (12:19 +0200)] 
blkdiscard: Improve man page

Improve the grammar and phrasing of the --verbose option and how it
interacts with the --step option.

Signed-off-by: Allon Mureinik <amureini@redhat.com>
7 years agofdisk: make -l <dev ...> behaves like fdisk -l
Thierry Vignaud [Tue, 5 Jul 2016 16:39:05 +0000 (18:39 +0200)] 
fdisk: make -l <dev ...> behaves like fdisk -l

aka having the same spacing between disks

Signed-off-by: Karel Zak <kzak@redhat.com>
7 years agolibblkid: avoid non-empty recursion in EBR
Karel Zak [Tue, 12 Jul 2016 11:34:54 +0000 (13:34 +0200)] 
libblkid: avoid non-empty recursion in EBR

This is extension to the patch 7164a1c34d18831ac61c6744ad14ce916d389b3f.

We also need to detect non-empty recursion in the EBR chain. It's
possible to create standard valid logical partitions and in the last one
points back to the EBR chain. In this case all offsets will be non-empty.

Unfortunately, it's valid to create logical partitions that are not in
the "disk order" (sorted by start offset). So link somewhere back is
valid, but this link cannot points to already existing partition
(otherwise we will see recursion).

This patch forces libblkid to ignore duplicate logical partitions, the
duplicate chain segment is interpreted as non-data segment, after 100
iterations with non-data segments it will break the loop -- no memory
is allocated in this case by the loop.

Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=1349536
References: http://seclists.org/oss-sec/2016/q3/40
Signed-off-by: Karel Zak <kzak@redhat.com>
7 years agolibblkid: ignore extended partition at zero offset
Karel Zak [Thu, 7 Jul 2016 12:22:41 +0000 (14:22 +0200)] 
libblkid: ignore extended partition at zero offset

If the extended partition starts at zero LBA then MBR is interpreted
as EBR and all is recursively parsed... result is out-of-memory.

 MBR --extended-partition--> EBR --> MBR --> ENB --> MBR ...

Note that such PT is not possible to create by standard partitioning
tools.

Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=1349536
Signed-off-by: Karel Zak <kzak@redhat.com>
7 years agolibblkid: Add metadata signature check for IMSM on 4Kn drives
Alexey Obitotskiy [Fri, 24 Jun 2016 09:59:35 +0000 (11:59 +0200)] 
libblkid: Add metadata signature check for IMSM on 4Kn drives

Drives with 512 and 4K sectors have different offset for
metadata signature. Without signature detected on 4Kn drives
those drives will not be recognized as raid member. This
patch adds checking for IMSM signature for 4Kn drives.

Signed-off-by: Alexey Obitotskiy <aleksey.obitotskiy@intel.com>
7 years agoagetty: don't modify argv[] when parse speeds
Karel Zak [Thu, 30 Jun 2016 12:00:44 +0000 (14:00 +0200)] 
agetty: don't modify argv[] when parse speeds

Signed-off-by: Karel Zak <kzak@redhat.com>
7 years agoliblkid: Add length check in probe_nilfs2 before crc32
Torsten Hilbrich [Mon, 20 Jun 2016 05:09:10 +0000 (07:09 +0200)] 
liblkid: Add length check in probe_nilfs2 before crc32

The bytes variable is read from the file system to probe and must be
checked before used as length parameter in the crc32 call.

The following problems may occur here:

- bytes smaller than sumoff + 4: underflow in length calculation
- bytes larger than remaining space in sb: overflow of buffer

This fixes a problem where an encrypted volume had the correct magic
values 0x3434 at offset 0x406 and the following uint16_t (which is
read into the nilfs_super_block.s_bytes struct) was parsed as 1.

Then crc32 was called with the length value 18446744073709551597
causing a segmentation fault.

[kzak@redhat.com: - fix probe_nilfs2() return code]

Signed-off-by: Karel Zak <kzak@redhat.com>
7 years agolibfdisk: (gpt) be more careful with 64bit constants
Karel Zak [Tue, 21 Jun 2016 12:06:14 +0000 (14:06 +0200)] 
libfdisk: (gpt) be more careful with 64bit constants

It's probably more robust (and readable) to be explicit when we count
with constant and 64bit numbers.

Addresses: http://bugzilla.redhat.com/show_bug.cgi?id=1344482
Signed-off-by: Karel Zak <kzak@redhat.com>
7 years agologger: be more precise about --port description
Karel Zak [Tue, 21 Jun 2016 11:32:14 +0000 (13:32 +0200)] 
logger: be more precise about --port description

Signed-off-by: Karel Zak <kzak@redhat.com>
7 years agochfn: chsh: use selinux_check_passwd_access()
Karel Zak [Tue, 14 Jun 2016 11:15:44 +0000 (13:15 +0200)] 
chfn: chsh: use selinux_check_passwd_access()

* selinux/av_permissions.h and magic constants are deprecated, the
  recommended solution is to use string_to_security_class() and
  string_to_av_perm() to get access vector

* it also seems that selinux_check_passwd_access() does exactly the
  same as our checkAccess(), let's use it.

Signed-off-by: Karel Zak <kzak@redhat.com>
7 years agobuild-sys: workaround for autoconf "present but cannot be compiled"
Karel Zak [Wed, 8 Jun 2016 11:38:48 +0000 (13:38 +0200)] 
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>
7 years agobuild-sys: fix uClibc-ng scanf check
Waldemar Brodkorb [Fri, 3 Jun 2016 02:23:28 +0000 (04:23 +0200)] 
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>
7 years agocfdisk: use libsmartcols ASCII for non-widechar environment
Karel Zak [Fri, 3 Jun 2016 10:20:24 +0000 (12:20 +0200)] 
cfdisk: use libsmartcols ASCII for non-widechar environment

Reported-by: Stanislav Brabec <sbrabec@suse.cz>
Signed-off-by: Karel Zak <kzak@redhat.com>
7 years agolsblk: improve support for nvme
Karel Zak [Thu, 2 Jun 2016 12:41:08 +0000 (14:41 +0200)] 
lsblk: improve support for nvme

Signed-off-by: Karel Zak <kzak@redhat.com>
7 years agolsblk: use ID_WWN_WITH_EXTENSION is possible
Karel Zak [Wed, 25 May 2016 14:11:51 +0000 (16:11 +0200)] 
lsblk: use ID_WWN_WITH_EXTENSION is possible

Addresses: https://github.com/karelzak/util-linux/issues/321
Signed-off-by: Karel Zak <kzak@redhat.com>
7 years agobuild-sys: add tools/Makemodule.am
Karel Zak [Wed, 25 May 2016 13:59:15 +0000 (15:59 +0200)] 
build-sys: add tools/Makemodule.am

We have "make" targets which depends on tools/check*.sh scripts. It's
ugly to exclude these scripts from the release tar balls (as generated
by "make distcheck").

Signed-off-by: Karel Zak <kzak@redhat.com>
7 years agoman pages: fix spacing between man page name & section number
Mike Frysinger [Tue, 10 May 2016 19:26:54 +0000 (15:26 -0400)] 
man pages: fix spacing between man page name & section number

Most have standardized correctly, but fix a few latent ones.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
7 years agolibfdisk: fix range checking for fdisk_set_last_lba
Sassan Panahinejad [Thu, 12 May 2016 12:09:00 +0000 (13:09 +0100)] 
libfdisk: fix range checking for fdisk_set_last_lba

7 years agologger: add man page note about the default --tag
Karel Zak [Mon, 16 May 2016 13:05:28 +0000 (15:05 +0200)] 
logger: add man page note about the default --tag

Signed-off-by: Karel Zak <kzak@redhat.com>
7 years agowrite: fix setuid related regression
Wayne Pollock [Wed, 4 May 2016 16:15:14 +0000 (17:15 +0100)] 
write: fix setuid related regression

The write(1) is commonly a setuid binary, because common users cannot by
default write to each others terminals.  Since the commit in reference, that
is part of releases v2.24 to v2.28, the write(1) has used access(2) to check
capability to write to a destination terminal.  The catch is that access(2)
uses real UID and GID to when performing the accessibility.  The obvious
correction is to avoid access(2) when in context of setuid binaries.

As a smaller fix, but equally important fix, ensure the 'msgsok' variable is
initialized to indicate no access.  Uninitialized variable will almost
certainly do wrong thing at the time of check.

Breaking-commit: 0233a8ea18bec17dd59cfe1fec8281
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
Signed-off-by: Karel Zak <kzak@redhat.com>
Signed-off-by: Wayne Pollock <profwaynepollock@gmail.com>
7 years agosfdisk: exit with error if rereading partition table fails
Victor Dodon [Thu, 21 Apr 2016 07:24:58 +0000 (00:24 -0700)] 
sfdisk: exit with error if rereading partition table fails

Use the return value of fdisk_reread_partition_table in write_changes so that
sfdisk exits with error if re-reading the partition table fails.

Signed-off-by: Victor Dodon <dodonvictor@gmail.com>
7 years agolibblkid: make I/O errors on CDROMs non-fatal
Karel Zak [Thu, 28 Apr 2016 11:54:01 +0000 (13:54 +0200)] 
libblkid: make I/O errors on CDROMs non-fatal

It seems too tricky to get a real size of the data track on hybrid
disks with audio+data. It seems overkill to analyze all header in
libblkid and on some disks it's probably possible to get I/O error
almost everywhere due to crazy copy protection etc.

Signed-off-by: Karel Zak <kzak@redhat.com>
7 years agolibfdisk: don't offer zero length freespace
Karel Zak [Mon, 25 Apr 2016 09:59:06 +0000 (11:59 +0200)] 
libfdisk: don't offer zero length freespace

Reported-by: Kay Sievers <kay@vrfy.org>
Signed-off-by: Karel Zak <kzak@redhat.com>
7 years agofsck: fix racing between unlock/unlink and open
Yuriy M. Kaminskiy [Thu, 7 Apr 2016 21:38:56 +0000 (00:38 +0300)] 
fsck: fix racing between unlock/unlink and open

Process A Process B Process C
open()
[creates file]
lock()
[succeed]
open()
[open existing]
lock()...
running()
close()
[...succeed]
unlink()
running()
open()
[creates file] {BAD!}
lock()
[succeed] {BAD!}
running() {BAD!}
close()

Cons: leaves empty (unlocked/harmless) .lock files in /run/fsck/
Signed-off-by: Yuriy M. Kaminskiy <yumkam@gmail.com>
7 years agolib: avoid double free in loopdev.c
Sami Kerola [Sun, 3 Apr 2016 16:43:19 +0000 (17:43 +0100)] 
lib: avoid double free in loopdev.c

Found with scan-build.

Reviewed-by: Yuriy M. Kaminskiy <yumkam@gmail.com>
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
7 years agosetpwnam: fix memory leak
Sami Kerola [Sun, 3 Apr 2016 16:39:41 +0000 (17:39 +0100)] 
setpwnam: fix memory leak

Found with scan-build.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
7 years agolibmount: fix memory leak
Sami Kerola [Sun, 3 Apr 2016 16:34:53 +0000 (17:34 +0100)] 
libmount: fix memory leak

Found with scan-build.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
7 years agolibblkid: make blkid_do_wipe() work with probes with offset
Petr Uzel [Mon, 18 Apr 2016 14:22:05 +0000 (16:22 +0200)] 
libblkid: make blkid_do_wipe() work with probes with offset

When a probe is created with an offset, e.g. via
blkid_probe_set_device(), this offset is correctly used when looking for
the signatures, but is not respected by blkid_do_wipe() function.
Therefore the signature is removed from an invalid location.

Usecase: Wiping signatures from an area on the block device where
partition is to be created (but as it does not exist yet, there's no
device node for it and probe on the whole block device has to be used
with correct offset and length).

Reproducer:
======================== wiper.c ===========================

const char *dev;
unsigned long offset;
unsigned long size;

int main(int argc, char** argv) {

        if (argc != 4) {
                printf("usage: wiper dev offset size\n");
                exit(1);
        }

        dev = argv[1];
        offset = strtoull(argv[2], NULL, 10);
        size = strtoull(argv[3], NULL, 10);

        printf("dev=%s, off=%llu, size=%llu\n", dev, offset, size);

        int fd = open (dev, O_RDWR);
        if (fd == -1) {
                perror("open");
                exit(1);
        }

        blkid_loff_t wipe_offset = offset * SECTOR_SIZE;
        blkid_loff_t wipe_size = size * SECTOR_SIZE;

        int ret;

        blkid_probe pr;
        pr = blkid_new_probe();
        if (!pr)
                return 0;
        ret = blkid_probe_set_device(pr, fd, wipe_offset, wipe_size);
        ret = blkid_probe_enable_superblocks(pr, 1);
        ret = blkid_probe_set_superblocks_flags(pr, BLKID_SUBLKS_MAGIC);

        while (blkid_do_probe(pr) == 0) {
                ret = blkid_do_wipe(pr, 0);
        }

        blkid_free_probe(pr);
        close(fd);
}
======================== wiper.c ===========================

Steps to reproduce:
modprobe scsi_debug
parted -s /dev/sdX mklabel gpt
parted -s /dev/sdX mkpart first 2048s 4095s
mkfs.ext2 /dev/sdX1

wipefs -np /dev/sdX1

./wiper /dev/sdX1 2048 2048

Actual result: wiper gets into endless loop, because
blkid_do_wipe() wipes at wrong location (1080), leaving the signature
on /dev/sdc1. So it is again found by blkid_do_probe(), and so on.

Expected result: wiper clears the ext2 signature at offset 1049656(=1080+2048*512).

Signed-off-by: Petr Uzel <petr.uzel@suse.cz>
7 years agopylibmount: include c.h
Karel Zak [Mon, 18 Apr 2016 11:19:12 +0000 (13:19 +0200)] 
pylibmount: include c.h

... for sys/sysmacros.h and major() and minor() macros.

Reported-by: Mike Frysinger <vapier@gentoo.org>
Signed-off-by: Karel Zak <kzak@redhat.com>
7 years agomkswap: tolerate ENOTSUP when failing to relabel
Lubomir Rintel [Mon, 18 Apr 2016 07:01:23 +0000 (09:01 +0200)] 
mkswap: tolerate ENOTSUP when failing to relabel

It might be that the underlying filesystem just doesn't support SELinux
labeling. This fixes creating swap on vfat live media:

  # livecd-iso-to-disk.sh --msdos --swap-size-mb 666 ...

Signed-off-by: Lubomir Rintel <lkundrak@v3.sk>
7 years agomount: try to tell what mount was doing when it failed
Sami Kerola [Sat, 16 Apr 2016 18:05:58 +0000 (19:05 +0100)] 
mount: try to tell what mount was doing when it failed

Earlier output did not give enough information to system admin to fix an
issue in /etc/fstab effectively.

$ sudo mount -a
mount: mount(2) failed: No such file or directory

Addresses: https://bugs.launchpad.net/bugs/1557145
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
7 years agodmesg: --notime should not suppress --show-delta
Sami Kerola [Sat, 16 Apr 2016 17:35:02 +0000 (18:35 +0100)] 
dmesg: --notime should not suppress --show-delta

The --show-delta is off by default, which means it can be only on when user
has requested to see these time stamps.  The --notime option should not turn
the delta outputing off, because then option order matters and no-one wants
that.  Example of the old output:

$ dmesg --notime --show-delta | sed -n 's/ version.*//p; q'
[<    0.000000>] Linux
$ dmesg --show-delta --notime | sed -n 's/ version.*//p; q'
Linux

Addresses: https://bugs.launchpad.net/bugs/1544595
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
7 years agoscript: avoid trying fclose(NULL)
Sami Kerola [Sat, 16 Apr 2016 16:43:01 +0000 (17:43 +0100)] 
script: avoid trying fclose(NULL)

Here is a one-liner to reproduce the issue.

$ mkdir example && cd example && chmod 0500 . && script
Script started, file is typescript
script: cannot open typescript: Permission denied
                                                 Script done, file is typescript
Segmentation fault (core dumped)

Addresses: https://bugs.launchpad.net/bugs/1537518
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
7 years agoumount: add note about FS names differences to the man page
Karel Zak [Fri, 15 Apr 2016 08:47:12 +0000 (10:47 +0200)] 
umount: add note about FS names differences to the man page

Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=1327209
Signed-off-by: Karel Zak <kzak@redhat.com>
8 years agolibmount: make kernel_fs_postparse() more robust
Karel Zak [Fri, 15 Apr 2016 12:48:29 +0000 (14:48 +0200)] 
libmount: make kernel_fs_postparse() more robust

Signed-off-by: Karel Zak <kzak@redhat.com>
8 years agolibmount: fix mnt_table_parse_stream() logic
Karel Zak [Fri, 15 Apr 2016 12:30:43 +0000 (14:30 +0200)] 
libmount: fix mnt_table_parse_stream() logic

Signed-off-by: Karel Zak <kzak@redhat.com>
8 years agobuild-sys: add --enable-libuuid-force-uuidd
Ruediger Meier [Wed, 6 Apr 2016 13:43:07 +0000 (15:43 +0200)] 
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>
8 years agowipefs: force GPT detection
Karel Zak [Wed, 13 Apr 2016 12:41:47 +0000 (14:41 +0200)] 
wipefs: force GPT detection

The library libblkid (as well as fdisks) requires protective MBR when
probe for GPT by default.  This is unnecessary for wipefs where we're
more promiscuous and we want to delete as much as possible. This patch
enables BLKID_PARTS_FORCE_GPT for wipefs.

Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=1326474
Signed-off-by: Karel Zak <kzak@redhat.com>
8 years agocolcrt: avoid the command getting hung [afl]
Sami Kerola [Sat, 2 Apr 2016 15:58:14 +0000 (16:58 +0100)] 
colcrt: avoid the command getting hung [afl]

Some inputs make getwc(3) not to progress file descriptor and neither to
report EILSEQ.  Detect such situation and skip the bad input.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
8 years agoscript: use empty-slave heuristic more carefully
Karel Zak [Wed, 13 Apr 2016 09:52:43 +0000 (11:52 +0200)] 
script: use empty-slave heuristic more carefully

script(1) waits for empty slave FD (shell stdin) before it writes to
master. This feature has been intorduiced by 54c6611d6f7b73609a5331f4d0bcf63c4af6429e
to avoid misbehavior when we need to send EOF to the shell.

Unfortunately, this feature has been used all time for all messages.
This is wrong because command in the session (or shell) may ignore
stdin at all and wait forever in busy loop is really bad idea. Test
case:

 script /dev/null
 tailf /etc/passwd
 <enter>
 <enter>

... script process taking 100% CPU.

This patch forces script to use empty-stave detection only when we
need to write EOF. The busy loop has been modified to use nanosleep
and it does not wait forever...

Addresses: http://bugs.debian.org/820843
Signed-off-by: Karel Zak <kzak@redhat.com>
8 years agobuild-sys: release++ (v2.28) v2.28
Karel Zak [Tue, 12 Apr 2016 10:33:03 +0000 (12:33 +0200)] 
build-sys: release++ (v2.28)

Signed-off-by: Karel Zak <kzak@redhat.com>
8 years agodocs: update v2.28-ReleaseNotes
Karel Zak [Tue, 12 Apr 2016 10:31:56 +0000 (12:31 +0200)] 
docs: update v2.28-ReleaseNotes

Signed-off-by: Karel Zak <kzak@redhat.com>
8 years agodocs: update AUTHORS file
Karel Zak [Tue, 12 Apr 2016 10:30:40 +0000 (12:30 +0200)] 
docs: update AUTHORS file

Signed-off-by: Karel Zak <kzak@redhat.com>
8 years agopo: merge changes
Karel Zak [Tue, 12 Apr 2016 10:29:25 +0000 (12:29 +0200)] 
po: merge changes

Signed-off-by: Karel Zak <kzak@redhat.com>
8 years agopo: update uk.po (from translationproject.org)
Yuri Chornoivan [Tue, 12 Apr 2016 10:13:51 +0000 (12:13 +0200)] 
po: update uk.po (from translationproject.org)

8 years agopo: update sv.po (from translationproject.org)
Sebastian Rasmussen [Tue, 12 Apr 2016 10:13:51 +0000 (12:13 +0200)] 
po: update sv.po (from translationproject.org)

8 years agopo: update pt_BR.po (from translationproject.org)
Rafael Fontenelle [Tue, 12 Apr 2016 10:13:51 +0000 (12:13 +0200)] 
po: update pt_BR.po (from translationproject.org)

8 years agopo: update pl.po (from translationproject.org)
Jakub Bogusz [Tue, 12 Apr 2016 10:13:51 +0000 (12:13 +0200)] 
po: update pl.po (from translationproject.org)

8 years agopo: update nl.po (from translationproject.org)
Benno Schulenberg [Tue, 12 Apr 2016 10:13:51 +0000 (12:13 +0200)] 
po: update nl.po (from translationproject.org)

8 years agopo: update ja.po (from translationproject.org)
Takeshi Hamasaki [Tue, 12 Apr 2016 10:13:51 +0000 (12:13 +0200)] 
po: update ja.po (from translationproject.org)

8 years agopo: update es.po (from translationproject.org)
Antonio Ceballos Roa [Tue, 12 Apr 2016 10:13:51 +0000 (12:13 +0200)] 
po: update es.po (from translationproject.org)

8 years agopo: update de.po (from translationproject.org)
Philipp Thomas [Tue, 12 Apr 2016 10:13:50 +0000 (12:13 +0200)] 
po: update de.po (from translationproject.org)

8 years agopo: update cs.po (from translationproject.org)
Petr Písař [Tue, 12 Apr 2016 10:13:50 +0000 (12:13 +0200)] 
po: update cs.po (from translationproject.org)

8 years agobuild-sys: fix cap-ng configure flag handling
Mike Frysinger [Thu, 7 Apr 2016 16:17:43 +0000 (12:17 -0400)] 
build-sys: fix cap-ng configure flag handling

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
8 years agobuild-sys: add --disable-logger and --disable-lslogins
Ruediger Meier [Wed, 6 Apr 2016 10:51:07 +0000 (12:51 +0200)] 
build-sys: add --disable-logger and --disable-lslogins

Now we are able to disable all programs which have systemd/journald
support. This feature is needed by openSUSE packagers who are building
util-linux in 2 stages to avoid build cycles.

Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
8 years agotests: remove deprecated md5sum based fdisk/bsd test
Ruediger Meier [Wed, 6 Apr 2016 07:16:11 +0000 (09:16 +0200)] 
tests: remove deprecated md5sum based fdisk/bsd test

Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
8 years agotests: fix fdisk/bsd for hppa
Ruediger Meier [Wed, 6 Apr 2016 07:16:10 +0000 (09:16 +0200)] 
tests: fix fdisk/bsd for hppa

Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
8 years agotests: add fdisk/bsd hexdump for alpha
Ruediger Meier [Wed, 6 Apr 2016 07:16:09 +0000 (09:16 +0200)] 
tests: add fdisk/bsd hexdump for alpha

Taken from Debian build logs:
https://buildd.debian.org/status/fetch.php?pkg=util-linux&arch=alpha&ver=2.28~rc2-1&stamp=1459443555

Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
8 years agorename: add example to the man page
Kaligule [Tue, 5 Apr 2016 12:35:24 +0000 (14:35 +0200)] 
rename: add example to the man page

Signed-off-by: Karel Zak <kzak@redhat.com>
8 years agolib/strutils: use int for fgetc()
Karel Zak [Mon, 4 Apr 2016 09:01:15 +0000 (11:01 +0200)] 
lib/strutils: use int for fgetc()

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