]> git.ipfire.org Git - thirdparty/util-linux.git/log
thirdparty/util-linux.git
7 years agoMerge branch 'master' of https://github.com/pali/util-linux
Karel Zak [Thu, 16 Nov 2017 13:18:16 +0000 (14:18 +0100)] 
Merge branch 'master' of https://github.com/pali/util-linux

* 'master' of https://github.com/pali/util-linux:
  libblkid: udf: Stop scanning Volume Descriptors after we found Terminating Descriptor
  libblkid: udf: Really try to read only first LVID

7 years agolibfdisk: (sun) enhance searching of free space
Mikhail Vorobyov [Thu, 9 Nov 2017 03:47:16 +0000 (06:47 +0300)] 
libfdisk: (sun) enhance searching of free space

Potential partition start should be aligned to cylinders. So fdisk
wouldn't consider partition's last cylinder remains as eligible space
for new partition start.

7 years agolibfdisk: (sun) move aligning of the first sector before availability check
Mikhail Vorobyov [Thu, 9 Nov 2017 03:37:28 +0000 (06:37 +0300)] 
libfdisk: (sun) move aligning of the first sector before availability check

So it will check a sector which would be actualy used as the first sector
of the partition.

7 years agolibmount: minimize utimensat() write test usage
Karel Zak [Thu, 16 Nov 2017 11:16:09 +0000 (12:16 +0100)] 
libmount: minimize utimensat() write test usage

utimensat() is pretty expensive when mounting parallel filesystems from
the same source. It's possible to ignore all this if mtab is not
writable.

Note that this change is irrelevant for default util-linux builds
where all around mtab is already disabled since v2.30 (commit
89958178f6d6ebe0944d423feaea66be521fff43).

This change is relevant only for users who still use --enable-libmount-support-mtab.

Reported-by: Douglas Jacobsen <dmjacobsen@lbl.gov>
Signed-off-by: Karel Zak <kzak@redhat.com>
7 years agolibblkid: Add support for Micron mpool formatted drives
John Groves [Thu, 16 Nov 2017 05:01:39 +0000 (23:01 -0600)] 
libblkid: Add support for Micron mpool formatted drives

Signed-off-by: Karel Zak <kzak@redhat.com>
7 years agolib: Add simple crc32c() function
John Groves [Thu, 16 Nov 2017 05:01:38 +0000 (23:01 -0600)] 
lib: Add simple crc32c() function

Source: freebsd/sys/libkern/crc32.c
This code is an unmodified fragment from the source.  Will fixup
comments / naming in next commit

Signed-off-by: Karel Zak <kzak@redhat.com>
7 years agomount: add more details about UUIDs and LABELs to the man page
Karel Zak [Thu, 16 Nov 2017 10:39:17 +0000 (11:39 +0100)] 
mount: add more details about UUIDs and LABELs to the man page

Signed-off-by: Karel Zak <kzak@redhat.com>
7 years agolibblkid: udf: Stop scanning Volume Descriptors after we found Terminating Descriptor
Pali Rohár [Wed, 15 Nov 2017 17:12:50 +0000 (18:12 +0100)] 
libblkid: udf: Stop scanning Volume Descriptors after we found Terminating Descriptor

Terminating Descriptor is the last descriptor in Volume Descriptor
Sequence. After it there can be unrecorded or empty sectors which we do not
have to scan.

Signed-off-by: Pali Rohár <pali.rohar@gmail.com>
7 years agolibblkid: udf: Really try to read only first LVID
Pali Rohár [Wed, 15 Nov 2017 17:05:52 +0000 (18:05 +0100)] 
libblkid: udf: Really try to read only first LVID

We do not want to scan whole LVID sequence.

Signed-off-by: Pali Rohár <pali.rohar@gmail.com>
7 years agotests: GPT device resize test
Karel Zak [Tue, 14 Nov 2017 14:40:09 +0000 (15:40 +0100)] 
tests: GPT device resize test

Signed-off-by: Karel Zak <kzak@redhat.com>
7 years agolibfdisk: (gpt) move backup header after device resize
Karel Zak [Tue, 14 Nov 2017 12:51:48 +0000 (13:51 +0100)] 
libfdisk: (gpt) move backup header after device resize

Addresses: https://github.com/karelzak/util-linux/issues/532
Signed-off-by: Karel Zak <kzak@redhat.com>
7 years agolibblkid: udf: Fix parsing LVID location
Pali Rohár [Tue, 14 Nov 2017 09:25:02 +0000 (10:25 +0100)] 
libblkid: udf: Fix parsing LVID location

And add comment about Logical Volume Integrity Sequence that we do not scan it fully.

7 years agolibblkid: udf: Fix reading Logical Volume Integrity Descriptor Implementation Use...
Pali Rohár [Mon, 13 Nov 2017 20:45:34 +0000 (21:45 +0100)] 
libblkid: udf: Fix reading Logical Volume Integrity Descriptor Implementation Use (LVIDIU)

LVIDIU is stored at the end of Logical Volume Integrity Descriptor (LVID),
after two variable length array of partitions. And number of partitions is
stored in LVID, not in Logical Volume Descriptor (LVD).

Length of LVIDIU is also stored in LVID, so add check that LVIDIU has
enough size.

Fixes commit db316767434c2c451ec1732861256d5729143e89.

7 years agocal: simplify leap year rule
Karel Zak [Mon, 13 Nov 2017 16:34:19 +0000 (17:34 +0100)] 
cal: simplify leap year rule

Gregorian rule for leap years has been adopted by reformation in year
1782 (Calendar Act 1750), but all tools (date, SQL servers, etc. etc.)
don't care about it and apply the new rule for all year -- including
years before the reformation.

It's better to be compatible with another tools than try to be perfect :-)

Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=1507271
Signed-off-by: Karel Zak <kzak@redhat.com>
7 years agoMerge branch '170925' of github.com:jwpi/util-linux
Karel Zak [Mon, 13 Nov 2017 15:25:21 +0000 (16:25 +0100)] 
Merge branch '170925' of github.com:jwpi/util-linux

* '170925' of github.com:jwpi/util-linux:
  tests: adjust for ISO timezone colon use
  lib/timeutils: add common ISO timestamp masks
  lib/timeutils: add get_gmtoff()
  lib/timeutils: ISO_8601_BUFSIZ too small
  hwclock: add iso-8601 overflow check

7 years agocolumn: allow to hide unnamed columns
Karel Zak [Mon, 13 Nov 2017 13:17:23 +0000 (14:17 +0100)] 
column: allow to hide unnamed columns

Addresses: https://github.com/karelzak/util-linux/pull/327
Signed-off-by: Karel Zak <kzak@redhat.com>
7 years agocolumn: add --table-noheadings
Karel Zak [Mon, 13 Nov 2017 11:56:21 +0000 (12:56 +0100)] 
column: add --table-noheadings

Signed-off-by: Karel Zak <kzak@redhat.com>
7 years agoMerge branch 'udf' of https://github.com/pali/util-linux
Karel Zak [Mon, 13 Nov 2017 11:32:03 +0000 (12:32 +0100)] 
Merge branch 'udf' of https://github.com/pali/util-linux

* 'udf' of https://github.com/pali/util-linux:
  test: Add UDF hdd image with final block size 4096 created by Linux mkudffs 1.3
  libblkid: udf: Optimize and fix probing when block size > 2048 bytes

7 years agoMerge branch 'master' of https://github.com/pali/util-linux
Karel Zak [Mon, 13 Nov 2017 11:23:23 +0000 (12:23 +0100)] 
Merge branch 'master' of https://github.com/pali/util-linux

* 'master' of https://github.com/pali/util-linux:
  libblkid: vfat: Fix reading labels which starts with byte 0x05

7 years agoblockdev: be more explicit for BLKSSZ in blockdev.8
Karel Zak [Mon, 13 Nov 2017 11:15:17 +0000 (12:15 +0100)] 
blockdev: be more explicit for BLKSSZ in blockdev.8

Addresses: https://github.com/karelzak/util-linux/issues/535
Signed-off-by: Karel Zak <kzak@redhat.com>
7 years agotest: Add UDF hdd image with final block size 4096 created by Linux mkudffs 1.3
Pali Rohár [Sun, 12 Nov 2017 21:05:15 +0000 (22:05 +0100)] 
test: Add UDF hdd image with final block size 4096 created by Linux mkudffs 1.3

$ dd if=/dev/zero of=udf-hdd-mkudffs-1.3-7.img bs=1M count=10
$ mkudffs -l Label512 -b 512 udf-hdd-mkudffs-1.3-7.img
$ mkudffs -l Label4096 -b 4096 udf-hdd-mkudffs-1.3-7.img

Image file was first formatted with block size 512 and then reformatted
with block size 4096. Volume Recognition Sequence was overwritten and every
Volume Structure Descriptor is now 4096 bytes long. Trying to read second
VSD as 2048 bytes long will fail because 4069 bytes long VSD is padded with
zeros. To verify that image file was properly detected, it should have
label "Label4096" and not "Label512".

7 years agolibblkid: udf: Optimize and fix probing when block size > 2048 bytes
Pali Rohár [Sun, 12 Nov 2017 20:55:21 +0000 (21:55 +0100)] 
libblkid: udf: Optimize and fix probing when block size > 2048 bytes

Optimize probing and detecting for UDF. Do not read and try to detect VRS
(Volume Recognition Sequence) on same blocks more times. For specific VSD
(Volume Structure Descriptor) length do it only once.

Fix probing of devices which has block size larger then 2048 bytes. It is
not truth that VSD is always 2048 bytes long. Its size is minimum of the
disk block size and 2048 bytes. See ECMA-167 sections 2/8.4 and 2/9.1.
Therefore when block size is larger then 2048 bytes, VRS needs to be
scanned again.

In commit 501aeb60a4914d8e4b273eb1529d70bc6ffaa077 was removed check for
empty VSD identifier because it caused that UDF image with block size of
the 4096 bytes was not detected. Reason was that VRS was improperly scanned
as VSD was 4096 bytes long, with 2048 bytes zero padding.

Now when processing of devices with block size larger then 2048 bytes is
fixed we can correctly stop scanning VRS at first invalid VSD as specified
in ECMA-167 section 2/8.3.1.

7 years agotests: adjust for ISO timezone colon use
J William Piggott [Sun, 12 Nov 2017 14:08:43 +0000 (09:08 -0500)] 
tests: adjust for ISO timezone colon use

Fix several tests broken by adding a timezone colon in the
timeutils ISO format functions.

Signed-off-by: J William Piggott <elseifthen@gmx.com>
7 years agolib/timeutils: add common ISO timestamp masks
J William Piggott [Sun, 15 Oct 2017 00:37:11 +0000 (20:37 -0400)] 
lib/timeutils: add common ISO timestamp masks

* Start the ISO format flags at bit 0 instead of bit 1.

* Remove unnecessary _8601 from ISO format flag names to
  avoid line wrapping and to ease readability.

* ISO timestamps have date-time-timzone in common, so move
  the TIMEZONE flag to bit 2 causing all timestamp masks
  to have the first three bits set and the last four bits
  as timestamp 'options'.

* Change the 'SPACE' flag to a 'T' flag, because it makes
  the code and comments more concise.

* Add common ISO timestamp masks.

* Implement the ISO timestamp masks in all applicable code
  using the strxxx_iso() functions.

Signed-off-by: J William Piggott <elseifthen@gmx.com>
7 years agolib/timeutils: add get_gmtoff()
J William Piggott [Sun, 8 Oct 2017 20:06:24 +0000 (16:06 -0400)] 
lib/timeutils: add get_gmtoff()

This new function returns the GMT offset relative to its
argument. It is used in this patch to fix two bugs:

1) On platforms that the tm struct excludes tm_gmtoff,
   hwclock assumes a one hour DST offset. This can cause
   an incorrect kernel timezone setting. For example:

 Master branch tested with tm_gmtoff illustrates the correct offset:
$ TZ="Australia/Lord_Howe" hwclock --hctosys --test | grep settimeofday
Calling settimeofday(1507494204.192398, -660)

 Master branch tested without tm_gmtoff has an incorrect offset:
$ TZ="Australia/Lord_Howe" hwclock --hctosys --test | grep settimeofday
Calling settimeofday(1507494249.193852, -690)

 Patched tested without tm_gmtoff has the correct offset:
$ TZ="Australia/Lord_Howe" hwclock --hctosys --test | grep settimeofday
Calling settimeofday(1507494260.194208, -660)

2) ISO 8601 'extended' format requires all time elements
   to use a colon (:).

Current invalid ISO 8601:
$ hwclock
2017-10-08 16:25:17.895462-0400

Patched:
$ hwclock
2017-10-08 16:25:34.141895-04:00

Also required by this change:
login-utils/last.c: increase ISO out_len and in_len by one to
                    accommodate the addition of the timezone colon.

Signed-off-by: J William Piggott <elseifthen@gmx.com>
7 years agolib/timeutils: ISO_8601_BUFSIZ too small
J William Piggott [Tue, 26 Sep 2017 00:56:06 +0000 (20:56 -0400)] 
lib/timeutils: ISO_8601_BUFSIZ too small

Although iso-8601 specifies years as 4 digits, it allows
them to be wider.

The current POSIX year width is limited by 'int tm_year'
at 10 digits plus a negative sign.

That, and the possibility of nanosecond time makes the
widest POSIX iso-8601 time 41 characters. Plus the \0
string terminator yields a buffer size of 42.

Before truncated output:
/sbin/hwclock --utc --noadjfile --predict --date '-2147483765 years'
-2147481748-09-25 20:29:45.0000

Patched:
./hwclock --utc --noadjfile --predict --date '-2147483765 years'
-2147481748-09-25 20:17:21.000000-0456

./hwclock --utc --noadjfile --predict --date '-2147483766 years'
hwclock: invalid date '-2147483766 years'

Comparable to coreutils 'date' command:
date -Ins --date '-2147483765 years'
-2147481748-09-25T19:49:31,578899297-0456

date -Ins --date '-2147483766 years'
date: invalid date '-2147483766 years'

The 'date' output illustrates the full 41 character POSIX iso-8601

Signed-off-by: J William Piggott <elseifthen@gmx.com>
7 years agohwclock: add iso-8601 overflow check
J William Piggott [Mon, 25 Sep 2017 23:30:24 +0000 (19:30 -0400)] 
hwclock: add iso-8601 overflow check

hwclock wasn't testing for strtimeval_iso() truncation:

/sbin/hwclock --utc --noadjfile --predict --date '7982 years'; echo $?
9999-09-25 19:33:01.000000-0400
0

/sbin/hwclock --utc --noadjfile --predict --date '7983 years'; echo $?
10000-09-25 19:33:10.000000-
0

Patched:
./hwclock --utc --noadjfile --predict --date '7982 years'; echo $?
9999-09-25 19:22:15.000000-0400
0

./hwclock --utc --noadjfile --predict --date '7983 years'; echo $?
hwclock: iso-8601 format truncated
1

Signed-off-by: J William Piggott <elseifthen@gmx.com>
7 years agonsenter: revert changes committed by accident
Karel Zak [Fri, 10 Nov 2017 13:02:51 +0000 (14:02 +0100)] 
nsenter: revert changes committed by accident

Signed-off-by: Karel Zak <kzak@redhat.com>
7 years agolibblkid: improve FreeBSD partitions parsing
Karel Zak [Fri, 10 Nov 2017 11:55:11 +0000 (12:55 +0100)] 
libblkid: improve FreeBSD partitions parsing

FreeBSD since version 10 uses relative offsets for nested partitions.
Based on Richard Narron changes in kernel:block/partitions/msdos.c.

Signed-off-by: Karel Zak <kzak@redhat.com>
7 years agolibblkid: vfat: Fix reading labels which starts with byte 0x05
Pali Rohár [Thu, 9 Nov 2017 18:03:34 +0000 (19:03 +0100)] 
libblkid: vfat: Fix reading labels which starts with byte 0x05

When FAT directory entry has leading byte 0x05 it is interpreted as byte
0xE5. This is how FAT stores file name which starts with byte 0xE5 as
leading byte in 0xE5 in FAT directory entry means that file slot is empty.

Fixes: #533
7 years agolibmount: fix access() utab write test
Karel Zak [Wed, 8 Nov 2017 15:47:40 +0000 (16:47 +0100)] 
libmount: fix access() utab write test

The commit c08396c7691e1e6a04b6b45892e7e4612ceed8d7 replaces
open(O_CREATE) with ecaccess(). Unfortunately, another code depends on
the original behavior.

* let's make utab when really necessary rather than in the try_write() test

* __mnt_new_table_from_file() returns NULL if tab-file does not
 exists. This is incorrect for tab_update.c stuff. We need empty table
 in this case.

* we can check /run/mount/ directory for write access if
  eaccess(filename) return ENOENT (because file does not exist)

Signed-off-by: Karel Zak <kzak@redhat.com>
7 years agolibmount: Allow MNT_FORCE and MNT_DETACH at umount
Joshua Watt [Mon, 6 Nov 2017 22:25:36 +0000 (16:25 -0600)] 
libmount: Allow MNT_FORCE and MNT_DETACH at umount

MNT_FORCE and MNT_DETACH are orthogonal in the Linux kernel, so both may
be specified without any problems. Even if there were a problem with
this combination, it should be up to the kernel to take the correct
action or report an error.

Signed-off-by: Joshua Watt <JPEWhacker@gmail.com>
7 years agomd5: declare byteReverse as static
Luca Ceresoli [Tue, 7 Nov 2017 13:39:09 +0000 (14:39 +0100)] 
md5: declare byteReverse as static

byteReverse() is an internal function in md5.c, and is not exposed via
any header file, but it is not declared as static. This is a problem
with the md5.c file since it is copied more or less verbatim in other
programs (fontconfig and pjsip among others), causing a link error
when linking two of them together.

Fixes link failures such as:
  http://autobuild.buildroot.net/results/419ab2c0e034cc68991281c51caa8271b0fadbab/build-end.log

Signed-off-by: Luca Ceresoli <luca@lucaceresoli.net>
7 years agodocs: update TODO
Karel Zak [Wed, 8 Nov 2017 10:40:04 +0000 (11:40 +0100)] 
docs: update TODO

Signed-off-by: Karel Zak <kzak@redhat.com>
7 years agosetsid: new option --fork
Karel Zak [Wed, 8 Nov 2017 10:38:26 +0000 (11:38 +0100)] 
setsid: new option --fork

Let's make semantic more predictable.

Addresses: https://github.com/karelzak/util-linux/issues/518
Signed-off-by: Karel Zak <kzak@redhat.com>
7 years agortcwake: add note about HW and sleep to the man page
Karel Zak [Tue, 7 Nov 2017 13:37:03 +0000 (14:37 +0100)] 
rtcwake: add note about HW and sleep to the man page

Addresses: https://github.com/karelzak/util-linux/issues/527
Signed-off-by: Karel Zak <kzak@redhat.com>
7 years agoagetty: add support for /etc/issue.d
Karel Zak [Tue, 7 Nov 2017 10:32:32 +0000 (11:32 +0100)] 
agetty: add support for /etc/issue.d

The /etc/issue file has been originally designed to inform users
about the system (version, name, etc.).

In last years is growing number of additional tools (containers,
maintenance tools and interfaces, ...) and many admins and downstream
maintainer want to add some tool specific hints to the issue file, but
it mess to share one file between more packages and/or scripts. The
solution is /etc/issue.d directory.

The directory is extension to the standard system /etc/issue. The
/etc/issue file has to exist, otherwise the directory will be ignored.
It means "rm /etc/issue" (or --onissue) is still the way how keep our
system silent independently on 3rd-party installed files in the
/etc/issue.d directory.

The content of the files in the directory are printed after content of
the /etc/issue. The files are printed in version-sort order and .issue
file extension is required (00-foo.issue 01-bar.issue ...).

The change is backwardly compatible.

Signed-off-by: Karel Zak <kzak@redhat.com>
7 years agoagetty: remove unused flag
Karel Zak [Mon, 6 Nov 2017 13:47:29 +0000 (14:47 +0100)] 
agetty: remove unused flag

Signed-off-by: Karel Zak <kzak@redhat.com>
7 years agolibmount: check waitpid() return code
Karel Zak [Mon, 6 Nov 2017 12:22:07 +0000 (13:22 +0100)] 
libmount: check waitpid() return code

Signed-off-by: Karel Zak <kzak@redhat.com>
7 years agolibmount: Use waitpid() when waiting for mount helper child process
Vratislav Podzimek [Mon, 6 Nov 2017 10:28:17 +0000 (11:28 +0100)] 
libmount: Use waitpid() when waiting for mount helper child process

Using wait() in a library may be problematic as it may reap some
totally unrelated child process instead of the just forked
one. That can result in the library call doing weird things and
returning bad return values, but also in a breakage of an
arbitrary other thing in the program using the library.

[[kzak@redhat.com: - use waitpid() for umount too
                   - keep the current codding style]

Signed-off-by: Karel Zak <kzak@redhat.com>
7 years agolscpu: Treat read failure on Xen Hypervisor properties as non-fatal
Dirk Mueller [Sat, 4 Nov 2017 03:12:54 +0000 (04:12 +0100)] 
lscpu: Treat read failure on Xen Hypervisor properties as non-fatal

At least on the Sydney Amazon EC2 region this file doesn't show up,
and the fatal exit code causes the rest of the useful information
to not show up.

7 years agosfdisk: create empty label on 'write' command
Karel Zak [Fri, 3 Nov 2017 18:34:49 +0000 (19:34 +0100)] 
sfdisk: create empty label on 'write' command

Addresses: https://github.com/karelzak/util-linux/issues/528
Signed-off-by: Karel Zak <kzak@redhat.com>
7 years agotests: update default lsmem output
Karel Zak [Fri, 3 Nov 2017 18:19:21 +0000 (19:19 +0100)] 
tests: update default lsmem output

The commit 96cbe362c034305e5f12a912b4247b3321420ee7 forces lsmem to
follow output column for split policy.

Signed-off-by: Karel Zak <kzak@redhat.com>
7 years agolslocks: add note about OFDLCK
Karel Zak [Fri, 3 Nov 2017 10:20:41 +0000 (11:20 +0100)] 
lslocks: add note about OFDLCK

Signed-off-by: Karel Zak <kzak@redhat.com>
7 years agolsmem: make --split optional, follow output by default
Karel Zak [Fri, 3 Nov 2017 09:58:33 +0000 (10:58 +0100)] 
lsmem: make --split optional, follow output by default

Let's keep lsmem backwardly compatible (<=v2.30) and create ranges
according to the output columns by default. This default behavior may
be modified by --split command line option.

Signed-off-by: Karel Zak <kzak@redhat.com>
7 years agolibfdisk: Fix uninitialized structure
Roddy Shuler [Fri, 3 Nov 2017 04:22:51 +0000 (21:22 -0700)] 
libfdisk: Fix uninitialized structure

Without this, 'sfdisk -d' with certain filenames would lead to
reading an 's' from the 'type' field in fdisk_reset_labelitem
and cause a crash due to prematurely freeing the 'data.str' field.

Signed-off-by: Roddy Shuler <roddy@endlessm.com>
7 years agotests: add fsck.cramfs bad-header test
Karel Zak [Thu, 2 Nov 2017 13:25:05 +0000 (14:25 +0100)] 
tests: add fsck.cramfs bad-header test

Signed-off-by: Karel Zak <kzak@redhat.com>
7 years agofsck.cramfs: Fix bus error on broken file system.
Tobias Stoeckmann [Mon, 30 Oct 2017 12:49:53 +0000 (13:49 +0100)] 
fsck.cramfs: Fix bus error on broken file system.

The utility fsck.cramfs is prone to a bus error on file systems for
big endian systems with non-standard header sizes. While calculating
the crc32 checksum, it does not properly handle a possible offset
for bootcodes, resulting in out of boundary access of mmap'ed area.

You can trigger the issue with the following commands:

$ mkdir -p cramfs-poc/root/subdir
$ cd cramfs-poc
$ mkfs.cramfs -p -N big root cramfs
$ echo -ne \\00\\x4c | dd of=cramfs bs=1 seek=518 count=2 conv=notrunc
$ fsck.cramfs cramfs

Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
7 years agosfdisk: allow to disable bootable flag on all partitions
Karel Zak [Thu, 2 Nov 2017 12:50:30 +0000 (13:50 +0100)] 
sfdisk: allow to disable bootable flag on all partitions

Let use '-' rather than a partition number to disable the bootable flag
on all partitions:

 sfdisk --activate /dev/sdc -

Signed-off-by: Karel Zak <kzak@redhat.com>
7 years agosfdisk: allow to use --activate for PMBR
Karel Zak [Thu, 2 Nov 2017 12:19:22 +0000 (13:19 +0100)] 
sfdisk: allow to use --activate for PMBR

Signed-off-by: Karel Zak <kzak@redhat.com>
7 years agofdisk: (gpt) make PMBR accessible from main menu
Karel Zak [Thu, 2 Nov 2017 10:09:53 +0000 (11:09 +0100)] 
fdisk: (gpt) make PMBR accessible from main menu

Don't force users to go to expert menu to toggle between GPT and PMBR.

Signed-off-by: Karel Zak <kzak@redhat.com>
7 years agoMerge branch 'bash-completion-fsck-find' of https://github.com/kevinoid/util-linux
Karel Zak [Thu, 2 Nov 2017 09:48:54 +0000 (10:48 +0100)] 
Merge branch 'bash-completion-fsck-find' of https://github.com/kevinoid/util-linux

* 'bash-completion-fsck-find' of https://github.com/kevinoid/util-linux:
  bash-completion: Exclude /dev/fd from fsck find

7 years agolibfdisk: (sun) fix creation of whole disk partition
Mikhail Vorobyov [Thu, 2 Nov 2017 01:04:42 +0000 (04:04 +0300)] 
libfdisk: (sun) fix creation of whole disk partition

sun_add_partition() allowed the 1st sector to be 0 for the 3rd partition
only if that sector was free or if other partitions covered the whole
disk. Now it's always allowed for the 1st sector to be set to 0 for
the 3rd partition.

[kzak@redhat.com: - print info about "wholedisk" before "First sector" dialog for 3rd partition
                  - default to 0 for 3rd partition start sector]

Signed-off-by: Mikhail Vorobyov <m.vorobyov@cs.msu.ru>
Signed-off-by: Karel Zak <kzak@redhat.com>
7 years agodmesg: Add --force-prefix option
Prarit Bhargava [Wed, 1 Nov 2017 14:37:00 +0000 (15:37 +0100)] 
dmesg: Add --force-prefix option

The kernel outputs multi-line messages (kernel messages that contain
the end-of-line character '\n').  These message are currently displayed by
dmesg as

[965199.028940] runnable tasks:
                           task   PID         tree-key  switches  prio
wait-time             sum-exec        sum-sleep
                ----------------------------------------------------------------------------------------------------------

The kernel timestamps each of these lines with [965199.028940] and the
dmesg utility should do the same.

Add the 'force-prefix'/'-p' dmesg option to add decode & timestamp
information to each line of a multi-line message.

Notes: The new print_record() algorithm stores the decode & timestamp
information in buffers.  If the force-prefix option is used, the
message is split into separate lines and each line is prefixed with
the stored decode & timestamp information.  The splitting of the
message into separate lines is done using strtok() which requires
write access to the message buffer (ie, the const message buffer is
now copied into a writeable buffer).

Successfully tested by me by looking at sysrq-t and sysrq-w output.
All known good /tests passed with these changes.

[kzak@redhat.com:

  - use snprintf()
  - cleanup \n usage (don't count line break to the
    message text in the parsers  and always print \n after the text
  - add the option to the man page
  - use --force-prefix for kmsg only, old syslog(2) API splits messages itself
  - strdup() the message text only on force-prefix]

Signed-off-by: Prarit Bhargava <prarit@redhat.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
7 years agolib/mangle: return size of the decoded buffer
Karel Zak [Wed, 1 Nov 2017 14:33:04 +0000 (15:33 +0100)] 
lib/mangle: return size of the decoded buffer

Signed-off-by: Karel Zak <kzak@redhat.com>
7 years agobash-completion: Exclude /dev/fd from fsck find
Kevin Locke [Mon, 30 Oct 2017 19:50:51 +0000 (13:50 -0600)] 
bash-completion: Exclude /dev/fd from fsck find

When the bash-completion for fsck runs `find -L /dev/ -type b` it
descends into /dev/fd after opening '.' as file descriptor 3.  This
causes find to search through /dev/fd/3/ which includes everything below
the current directory, which can take a very long time.

To avoid this, prune /dev/fd in the find expression.

Signed-off-by: Kevin Locke <kevin@kevinlocke.name>
7 years agodmesg: add note about -F format to the man page
Karel Zak [Mon, 30 Oct 2017 14:45:02 +0000 (15:45 +0100)] 
dmesg: add note about -F format to the man page

Signed-off-by: Karel Zak <kzak@redhat.com>
7 years agoRevert "dmesg: fragment concatenation"
Karel Zak [Mon, 30 Oct 2017 14:04:20 +0000 (15:04 +0100)] 
Revert "dmesg: fragment concatenation"

* introduces regressions
* stupid code; parse_kmsg_record() called more than once for each record

This reverts commit 22eb2f0190d8a9850da750641439ccd284ac0bfe.

7 years agoFix typo in carefulputc.h
Nik Nyby [Wed, 25 Oct 2017 04:19:19 +0000 (00:19 -0400)] 
Fix typo in carefulputc.h

Signed-off-by: Nik Nyby <nikolas@gnu.org>
7 years agotests: add LUKS test images
Milan Broz [Tue, 24 Oct 2017 08:21:29 +0000 (10:21 +0200)] 
tests: add LUKS test images

Testing image contains only the first 4k sector, so it is not valid,
but for blkid it should be enough.

Signed-off-by: Milan Broz <gmazyland@gmail.com>
7 years agoblkid: Add support for LUKS2 and new LABEL attributes.
Milan Broz [Mon, 23 Oct 2017 14:26:51 +0000 (16:26 +0200)] 
blkid: Add support for LUKS2 and new LABEL attributes.

This patch adds support for detection of a LUKS2 superblock.

LUKS2 is new version of Linux Unified Key Setup for encrypted
block devices.

LUKS2 contains a binary header and then JSON area for metadata.
Blkid should only parse the binary part, including newly available
optional LABEL and SUBSYSTEM fields.

LABEL is similar to filesystem label. The SUBSYSTEM field is
in principle, just a second label and can be used for specific udev rules
(for example if you have some 3rd party system that activates
volumes automatically, you can mark devices using this attribute).
Both labels are optional.

The magic string and UUID location are intentionally on the same offset
as LUKS v1, so even unpatched blkid now recognizes LUKS2.

Anyway, the code should not parse other versions of the header, so we now
explicitly check for header version and support only version 1 and 2.

Signed-off-by: Milan Broz <gmazyland@gmail.com>
7 years agochmem: cleanup includes
Karel Zak [Mon, 23 Oct 2017 13:49:22 +0000 (15:49 +0200)] 
chmem: cleanup includes

Signed-off-by: Karel Zak <kzak@redhat.com>
7 years agolib/path: make path_set_prefix() independent on cpu_set_t
Karel Zak [Mon, 23 Oct 2017 13:45:01 +0000 (15:45 +0200)] 
lib/path: make path_set_prefix() independent on cpu_set_t

Signed-off-by: Karel Zak <kzak@redhat.com>
7 years agolib/signames: fix redefinition of 'sys_signame' on OSX
Karel Zak [Mon, 23 Oct 2017 13:17:10 +0000 (15:17 +0200)] 
lib/signames: fix redefinition of 'sys_signame' on OSX

Signed-off-by: Karel Zak <kzak@redhat.com>
7 years agounshare: cleanup if-if code
Karel Zak [Mon, 23 Oct 2017 11:19:59 +0000 (13:19 +0200)] 
unshare: cleanup if-if code

Signed-off-by: Karel Zak <kzak@redhat.com>
7 years agolib/signames: remove signame array from header file
Karel Zak [Mon, 23 Oct 2017 11:18:57 +0000 (13:18 +0200)] 
lib/signames: remove signame array from header file

Signed-off-by: Karel Zak <kzak@redhat.com>
7 years agoMerge branch 'kill-child-feature' of https://github.com/nh2/util-linux
Karel Zak [Mon, 23 Oct 2017 10:58:21 +0000 (12:58 +0200)] 
Merge branch 'kill-child-feature' of https://github.com/nh2/util-linux

* 'kill-child-feature' of https://github.com/nh2/util-linux:
  unshare: Allow passing <signame> to --kill-child
  unshare: Add --kill-child option.
  signames: Make input char buffers const
  kill: Extract signal names into signames.h/signames.c

7 years agobuild-sys: move rfkill to /usr/sbin
Karel Zak [Fri, 20 Oct 2017 12:59:16 +0000 (14:59 +0200)] 
build-sys: move rfkill to /usr/sbin

The original implementation uses sbin, let's do it too.

Signed-off-by: Karel Zak <kzak@redhat.com>
7 years agotests: update lsmem
Karel Zak [Fri, 20 Oct 2017 12:33:47 +0000 (14:33 +0200)] 
tests: update lsmem

* add --split

Signed-off-by: Karel Zak <kzak@redhat.com>
7 years agolsmem: add --split
Karel Zak [Fri, 20 Oct 2017 10:31:09 +0000 (12:31 +0200)] 
lsmem: add --split

Now the way how lsmem lists memory ranges is affected by used output
columns.  It makes it very difficult to use in scripts where you want
to use for example only one column

ranges=$(lsmem -oRANGE)

and in this case all is merged to the one (or two) huge ranges and all
attributes are ignored. The --split allows to control this behavior

ranges=$(lsmem -oRANGE --split=STATE,ZONES)

forces lsmem to list ranges by STATE and ZONES differences.

Signed-off-by: Karel Zak <kzak@redhat.com>
7 years agolsmem: add hint about block merges to the man page
Karel Zak [Wed, 18 Oct 2017 11:16:09 +0000 (13:16 +0200)] 
lsmem: add hint about block merges to the man page

Signed-off-by: Karel Zak <kzak@redhat.com>
7 years agolsmem: improve path_read_xxx() usage
Karel Zak [Wed, 18 Oct 2017 10:21:47 +0000 (12:21 +0200)] 
lsmem: improve path_read_xxx() usage

Signed-off-by: Karel Zak <kzak@redhat.com>
7 years agochmem: cleanup usage()
Karel Zak [Wed, 18 Oct 2017 10:02:05 +0000 (12:02 +0200)] 
chmem: cleanup usage()

Just to be compatible with another u-l tools.

Signed-off-by: Karel Zak <kzak@redhat.com>
7 years agolsmem/chmem: add memory zone awareness to bash-completion
Andre Wild [Wed, 27 Sep 2017 17:44:46 +0000 (19:44 +0200)] 
lsmem/chmem: add memory zone awareness to bash-completion

This patch extends the valid --output values with ZONES for the
lsmem bash-completion, and adds the --zone option for the chmem
bash-completion.

Signed-off-by: Andre Wild <wild@linux.vnet.ibm.com>
Signed-off-by: Gerald Schaefer <gerald.schaefer@de.ibm.com>
7 years agotests/lsmem: update lsmem test with ZONES column
Gerald Schaefer [Wed, 27 Sep 2017 17:44:45 +0000 (19:44 +0200)] 
tests/lsmem: update lsmem test with ZONES column

The existing s390 and x86_64 dumps already contain the valid_zones sysfs
attribute, so just add a new "lsmem -o +ZONES" test command and update
the expected results.

Signed-off-by: Gerald Schaefer <gerald.schaefer@de.ibm.com>
7 years agolsmem/chmem: add memory zone awareness
Gerald Schaefer [Wed, 27 Sep 2017 17:44:44 +0000 (19:44 +0200)] 
lsmem/chmem: add memory zone awareness

With this patch, valid memory zones can be shown with lsmem, and chmem can
set memory online/offline in a specific memory zone, if allowed by the
kernel. The valid memory zones are read from the "valid_zones" sysfs
attribute, and setting memory online to a specific zone is done by
echoing "online_kernel" or "online_movable" to the "state" sysfs
attribute, in addition to the previous "online".

This patch also changes the default behavior of chmem, when setting memory
online without specifying a memory zone. If valid, memory will be set
online to the zone Movable. This zone is preferable for memory hotplug, as
it makes memory offline much more likely to succeed.

Signed-off-by: Gerald Schaefer <gerald.schaefer@de.ibm.com>
7 years agolibmount: use eacess() rather than open() to check mtab/utab
Karel Zak [Mon, 9 Oct 2017 10:44:48 +0000 (12:44 +0200)] 
libmount: use eacess() rather than open() to check mtab/utab

The open() syscall is probably the most strong way how to check write
accessibility in all situations, but it's overkill and on some
paranoid systems with enabled audit/selinux. It fills logs with
"Permission denied" entries. Let's use eaccess() if available.

Signed-off-by: Karel Zak <kzak@redhat.com>
7 years agobuild-sys: release++ (v2.31) v2.31
Karel Zak [Thu, 19 Oct 2017 11:08:49 +0000 (13:08 +0200)] 
build-sys: release++ (v2.31)

Signed-off-by: Karel Zak <kzak@redhat.com>
7 years agodocs: update v2.31-ReleaseNotes
Karel Zak [Thu, 19 Oct 2017 11:06:00 +0000 (13:06 +0200)] 
docs: update v2.31-ReleaseNotes

Signed-off-by: Karel Zak <kzak@redhat.com>
7 years agodocs: update AUTHORS file
Karel Zak [Thu, 19 Oct 2017 11:00:06 +0000 (13:00 +0200)] 
docs: update AUTHORS file

Signed-off-by: Karel Zak <kzak@redhat.com>
7 years agopo: merge changes
Karel Zak [Thu, 19 Oct 2017 10:57:57 +0000 (12:57 +0200)] 
po: merge changes

Signed-off-by: Karel Zak <kzak@redhat.com>
7 years agopo: update sv.po (from translationproject.org)
Sebastian Rasmussen [Thu, 19 Oct 2017 10:53:09 +0000 (12:53 +0200)] 
po: update sv.po (from translationproject.org)

7 years agopo: update pt_BR.po (from translationproject.org)
Rafael Fontenelle [Thu, 19 Oct 2017 10:53:09 +0000 (12:53 +0200)] 
po: update pt_BR.po (from translationproject.org)

7 years agopo: update pl.po (from translationproject.org)
Jakub Bogusz [Thu, 19 Oct 2017 10:53:09 +0000 (12:53 +0200)] 
po: update pl.po (from translationproject.org)

7 years agorfkill: fix description name typo
Sami Kerola [Mon, 16 Oct 2017 18:15:44 +0000 (19:15 +0100)] 
rfkill: fix description name typo

Commit 7d2a9960ad made gps to look like a GUID Partition Table.

Reviewed-by: Karel Zak <kzak@redhat.com>
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
7 years agoblkid: improve man page wording
Karel Zak [Mon, 16 Oct 2017 21:26:45 +0000 (23:26 +0200)] 
blkid: improve man page wording

Signed-off-by: Karel Zak <kzak@redhat.com>
7 years agoblkid: more info about ambivalent results to the man page
Karel Zak [Mon, 16 Oct 2017 10:01:41 +0000 (12:01 +0200)] 
blkid: more info about ambivalent results to the man page

Signed-off-by: Karel Zak <kzak@redhat.com>
7 years agoblkid: cleanup man page info about lsblk
Karel Zak [Mon, 16 Oct 2017 09:45:41 +0000 (11:45 +0200)] 
blkid: cleanup man page info about lsblk

Signed-off-by: Karel Zak <kzak@redhat.com>
7 years agozramctl: fix show all non-zero zram devices
James Sanford [Sat, 14 Oct 2017 07:57:20 +0000 (00:57 -0700)] 
zramctl: fix show all non-zero zram devices

Addresses: https://github.com/karelzak/util-linux/issues/521
Signed-off-by: Karel Zak <kzak@redhat.com>
7 years agozramctl: remove unused ZRAM_EMPTY and blank line
James Sanford [Sat, 14 Oct 2017 07:57:05 +0000 (00:57 -0700)] 
zramctl: remove unused ZRAM_EMPTY and blank line

7 years agounshare: Allow passing <signame> to --kill-child
Niklas Hambüchen [Sat, 14 Oct 2017 02:31:57 +0000 (04:31 +0200)] 
unshare: Allow passing <signame> to --kill-child

7 years agounshare: Add --kill-child option.
Niklas Hambüchen [Tue, 19 Sep 2017 18:39:00 +0000 (20:39 +0200)] 
unshare: Add --kill-child option.

This allows to conveniently kill the entire process tree
below the forked program, a common problem when scripting
tasks that need to reliably fully terminate without leaving
reparented subprocesses behind.

The example added to the man page shows the most common use.

Implemented using prctl(PR_SET_PDEATHSIG, ...).

7 years agosignames: Make input char buffers const
Niklas Hambüchen [Sat, 14 Oct 2017 02:45:20 +0000 (04:45 +0200)] 
signames: Make input char buffers const

7 years agokill: Extract signal names into signames.h/signames.c
Niklas Hambüchen [Sat, 14 Oct 2017 02:31:12 +0000 (04:31 +0200)] 
kill: Extract signal names into signames.h/signames.c

7 years agorfkill: fix typo [coverity scan]
Karel Zak [Thu, 12 Oct 2017 12:53:32 +0000 (14:53 +0200)] 
rfkill: fix typo [coverity scan]

Signed-off-by: Karel Zak <kzak@redhat.com>
7 years agolosetup: fix bitwise vs. logical typo [coverity scan]
Karel Zak [Thu, 12 Oct 2017 12:45:11 +0000 (14:45 +0200)] 
losetup: fix bitwise vs. logical typo [coverity scan]

Signed-off-by: Karel Zak <kzak@redhat.com>
7 years agoipcs: fix memory leak [coverity scan]
Karel Zak [Thu, 12 Oct 2017 12:39:54 +0000 (14:39 +0200)] 
ipcs: fix memory leak [coverity scan]

It's not important, but let's keep static analyzes happy.

Signed-off-by: Karel Zak <kzak@redhat.com>
7 years agologger: keep header generators independent on connection
Karel Zak [Thu, 12 Oct 2017 12:21:27 +0000 (14:21 +0200)] 
logger: keep header generators independent on connection

* avoid memory leaks
* don't use incomplete or header after free()

Signed-off-by: Karel Zak <kzak@redhat.com>
7 years agofincore: make sure mmap(NULL, ...) [coverity scan]
Karel Zak [Thu, 12 Oct 2017 10:44:55 +0000 (12:44 +0200)] 
fincore: make sure mmap(NULL, ...) [coverity scan]

Signed-off-by: Karel Zak <kzak@redhat.com>
7 years agolibsmartcols: (sample) cleanup line separator usage
Karel Zak [Thu, 12 Oct 2017 10:01:25 +0000 (12:01 +0200)] 
libsmartcols: (sample) cleanup line separator usage

* add comment to explain when nolinesep flag is necessary
* force to print \n before switch to the next line to support

  ./sample-scols-continuous > file

use case.

Addresses: https://github.com/ignatenkobrain/python-smartcols/issues/18
Signed-off-by: Karel Zak <kzak@redhat.com>