]> git.ipfire.org Git - thirdparty/util-linux.git/log
thirdparty/util-linux.git
4 years agoMerge branch 'libuuid-range' of https://github.com/UQ-RCC/util-linux
Karel Zak [Thu, 27 Feb 2020 13:44:43 +0000 (14:44 +0100)] 
Merge branch 'libuuid-range' of https://github.com/UQ-RCC/util-linux

* 'libuuid-range' of https://github.com/UQ-RCC/util-linux:
  libuuid: add uuid_parse_range()

4 years agosu, runuser: (man) add more info about PATH and PAM
Karel Zak [Thu, 27 Feb 2020 13:37:23 +0000 (14:37 +0100)] 
su, runuser: (man) add more info about PATH and PAM

Addresses: https://github.com/karelzak/util-linux/issues/964
Signed-off-by: Karel Zak <kzak@redhat.com>
4 years agohwclock: fix audit exit status
Karel Zak [Thu, 27 Feb 2020 13:04:55 +0000 (14:04 +0100)] 
hwclock: fix audit exit status

According to audit_log_user_message(3) result 1 is "success" and 0 is
"failed", we use standard EXIT_{SUCCESS,FAILURE} macros with reverse
status.

Addresses: https://github.com/karelzak/util-linux/issues/966
Signed-off-by: Karel Zak <kzak@redhat.com>
4 years agochsh: (man) fix default behavior description
Karel Zak [Thu, 27 Feb 2020 12:54:05 +0000 (13:54 +0100)] 
chsh: (man) fix default behavior description

Addresses: https://github.com/karelzak/util-linux/issues/967
Signed-off-by: Karel Zak <kzak@redhat.com>
4 years agofindmnt: make xalloc use mroe robust
Karel Zak [Thu, 27 Feb 2020 09:02:39 +0000 (10:02 +0100)] 
findmnt: make xalloc use mroe robust

Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=1807003
Signed-off-by: Karel Zak <kzak@redhat.com>
4 years agolsblk: fix -P regression from v2.34
Karel Zak [Tue, 25 Feb 2020 14:31:23 +0000 (15:31 +0100)] 
lsblk: fix -P regression from v2.34

Since v2.34 --list prints devices only once to make the output
user-readable. Unfortunately, it's regression for scripts/applications
where we need to parse lsblk output. So, let's make --pairs and --raw
backwardly compatible with versions before 2.34 and print all hierarchy.

Addresses: https://github.com/ibm-s390-tools/s390-tools/issues/80
Signed-off-by: Karel Zak <kzak@redhat.com>
4 years agolibfdisk: (gpt) partition name default to empty string
Karel Zak [Tue, 25 Feb 2020 11:39:26 +0000 (12:39 +0100)] 
libfdisk: (gpt) partition name default to empty string

Just for backward compatibility, otherwise it's strange ;-)

Signed-off-by: Karel Zak <kzak@redhat.com>
4 years agolibfdisk: add missing comments
Karel Zak [Tue, 25 Feb 2020 11:25:17 +0000 (12:25 +0100)] 
libfdisk: add missing comments

Signed-off-by: Karel Zak <kzak@redhat.com>
4 years agolibfdisk: use ul_encode_to_utf8()
Karel Zak [Tue, 25 Feb 2020 11:21:32 +0000 (12:21 +0100)] 
libfdisk: use ul_encode_to_utf8()

Signed-off-by: Karel Zak <kzak@redhat.com>
4 years agolibblkid: fix compiler warning [-Wsign-compare]
Karel Zak [Tue, 25 Feb 2020 11:06:06 +0000 (12:06 +0100)] 
libblkid: fix compiler warning [-Wsign-compare]

libblkid/src/superblocks/exfat.c: In function ‘probe_exfat’:
./include/c.h:133:17: warning: comparison of distinct pointer types lacks a cast
libblkid/src/superblocks/exfat.c:129:5: note: in expansion of macro ‘min’
./include/c.h:134:8: warning: comparison of integer expressions of different signedness: ‘int’ and ‘long unsigned int’ [-Wsign-compare]

Signed-off-by: Karel Zak <kzak@redhat.com>
4 years agolibblkid: move UTF encoding function to lib/
Karel Zak [Tue, 25 Feb 2020 11:00:27 +0000 (12:00 +0100)] 
libblkid: move UTF encoding function to lib/

Let's consolidate the code, we need to use it in libfdisk too. It
seems better to keep it generic and libblkid independent.

This patch also removes blkid_encode_alloc(), this function is overkill.

Signed-off-by: Karel Zak <kzak@redhat.com>
4 years agolibuuid: add uuid_parse_range()
Zane van Iperen [Tue, 5 Nov 2019 07:21:17 +0000 (17:21 +1000)] 
libuuid: add uuid_parse_range()

For compatibility with C++'s std::string_view, et al.

Signed-off-by: Zane van Iperen <z.vaniperen@uq.edu.au>
4 years agohwclock: make glibc 2.31 compatible
J William Piggott [Sat, 22 Feb 2020 01:03:47 +0000 (20:03 -0500)] 
hwclock: make glibc 2.31 compatible

______________________________________________________
GNU C Library NEWS -- history of user-visible changes.
Version 2.31
Deprecated and removed features, and other changes affecting compatibility:

* The settimeofday function can still be used to set a system-wide time
  zone when the operating system supports it.  This is because the Linux
  kernel reused the API, on some architectures, to describe a system-wide
  time-zone-like offset between the software clock maintained by the kernel,
  and the "RTC" clock that keeps time when the system is shut down.

  However, to reduce the odds of this offset being set by accident,
  settimeofday can no longer be used to set the time and the offset
  simultaneously.  If both of its two arguments are non-null, the call
  will fail (setting errno to EINVAL).

  Callers attempting to set this offset should also be prepared for the call
  to fail and set errno to ENOSYS; this already happens on the Hurd and on
  some Linux architectures.  The Linux kernel maintainers are discussing a
  more principled replacement for the reused API.  After a replacement
  becomes available, we will change settimeofday to fail with ENOSYS on all
  platforms when its 'tzp' argument is not a null pointer.

  settimeofday itself is obsolescent according to POSIX.  Programs that set
  the system time should use clock_settime and/or the adjtime family of
  functions instead.  We may cease to make settimeofday available to newly
  linked binaries after there is a replacement for Linux's time-zone-like
  offset API.
______________________________________________________

hwclock(8) had one settimeofday(2) call where both args were set for
--hctosys when the RTC was ticking UTC. This allowed setting the system
time, timezone, and locking the warp_clock function with a single call.
That operation now takes 3 calls of settimeofday(2).

Although this common operation now takes three calls, the overall logic
for the set_system_clock() function was simplified.

Co-Author: Karel Zak <kzak@redhat.com>
Signed-off-by: J William Piggott <elseifthen@gmx.com>
4 years agoumount: don't try it as non-suid if not found mountinfo entry
Karel Zak [Mon, 24 Feb 2020 12:02:09 +0000 (13:02 +0100)] 
umount: don't try it as non-suid if not found mountinfo entry

Addresses: https://github.com/karelzak/util-linux/issues/961
Signed-off-by: Karel Zak <kzak@redhat.com>
4 years agoMerge branch 'master' of https://github.com/benfrankel/util-linux
Karel Zak [Fri, 21 Feb 2020 08:29:48 +0000 (09:29 +0100)] 
Merge branch 'master' of https://github.com/benfrankel/util-linux

* 'master' of https://github.com/benfrankel/util-linux:
  docs: Improve grammar

4 years agodocs: Improve grammar
Ben Frankel [Fri, 21 Feb 2020 00:46:47 +0000 (16:46 -0800)] 
docs: Improve grammar

4 years agofdisk: update expected test outputs with command outputs
Sami Kerola [Thu, 20 Feb 2020 21:19:37 +0000 (21:19 +0000)] 
fdisk: update expected test outputs with command outputs

Reference; https://github.com/karelzak/util-linux/pull/959
Addresses: 5d271cefad0d7a5b4d2fb4fa0f26c1e341f1354c
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
4 years agovarious: fix more lgtm scan warnings
Sami Kerola [Thu, 20 Feb 2020 20:08:00 +0000 (20:08 +0000)] 
various: fix more lgtm scan warnings

The logger and rtwake time function changes continue the same fixes as
previous commit - use thread safe functions.  The libsmartcols condition
removal is possible because width must be greater than tb->termwidth that is
size_t and cannot be smaller than zero.  And remove couple FIXME's that are
old and unlikely ever to get fixed.

Reference: 3160589d86470ce7d20c81090fb7f211b3822053
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
4 years agofdisk: improve list-types readability
Karel Zak [Thu, 20 Feb 2020 14:27:05 +0000 (15:27 +0100)] 
fdisk: improve list-types readability

Signed-off-by: Karel Zak <kzak@redhat.com>
4 years agosfdisk: (man) add note about type and shortcuts collision
Karel Zak [Thu, 20 Feb 2020 14:26:28 +0000 (15:26 +0100)] 
sfdisk: (man) add note about type and shortcuts collision

Signed-off-by: Karel Zak <kzak@redhat.com>
4 years agoMerge branch 'master' of https://github.com/pali/util-linux
Karel Zak [Tue, 18 Feb 2020 13:06:09 +0000 (14:06 +0100)] 
Merge branch 'master' of https://github.com/pali/util-linux

* 'master' of https://github.com/pali/util-linux:
  exfat: Fix parsing exfat label

4 years agoMerge branch 'various-fixes' of https://github.com/kerolasa/util-linux
Karel Zak [Tue, 18 Feb 2020 13:02:41 +0000 (14:02 +0100)] 
Merge branch 'various-fixes' of https://github.com/kerolasa/util-linux

* 'various-fixes' of https://github.com/kerolasa/util-linux:
  kill: include sys/types.h before checking SYS_pidfd_send_signal
  libfdisk: fix pointer wraparound warning
  hwclock: update yacc file
  script: fix minor warning
  getopt: use examples installation directory in man page
  fstrim: randomize timer start time across 100 minutes
  various: use threadsafe versions of time functions [lgtm scan]
  write: fix potential string overflow

4 years agoMerge branch 'parttype-var' of https://github.com/nl6720/util-linux
Karel Zak [Tue, 18 Feb 2020 09:00:55 +0000 (10:00 +0100)] 
Merge branch 'parttype-var' of https://github.com/nl6720/util-linux

* 'parttype-var' of https://github.com/nl6720/util-linux:
  libfdisk: add Linux /var, /var/tmp and root verity GPT partition types

4 years agolscpu: fix SIGSEGV on archs without drawers & books
Karel Zak [Mon, 17 Feb 2020 12:13:11 +0000 (13:13 +0100)] 
lscpu: fix SIGSEGV on archs without drawers & books

The drawers and books are optional and not supported on all
architectures and in this case drawers/books relevant arrays are not
allocated, so don't access it although user wants it
(e.g.  "lscpu -p -y --output-all").

This patch also cleans up arrays allocation to make it more readable
and robust against edit mistakes.

Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=1801760
Signed-off-by: Karel Zak <kzak@redhat.com>
4 years agokill: include sys/types.h before checking SYS_pidfd_send_signal
Sami Kerola [Sat, 15 Feb 2020 21:12:50 +0000 (21:12 +0000)] 
kill: include sys/types.h before checking SYS_pidfd_send_signal

Including sys/types.h must happen before SYS_pidfd_send_signal is checked,
because that header defines variable in normal conditions.  When sys/types.h
does not have SYS_pidfd_send_signal then fallback is defined in config.h
that is included by default, and has therefore worked fine before and after
this change.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
4 years agolibfdisk: fix pointer wraparound warning
Sami Kerola [Thu, 13 Feb 2020 21:28:37 +0000 (21:28 +0000)] 
libfdisk: fix pointer wraparound warning

libfdisk/src/gpt.c:1713:6: warning: assuming pointer wraparound does not
occur when comparing P +- C1 with P +- C2 [-Wstrict-overflow]

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
4 years agohwclock: update yacc file
Sami Kerola [Thu, 13 Feb 2020 20:57:53 +0000 (20:57 +0000)] 
hwclock: update yacc file

$ bison --update sys-utils/hwclock-parse-date.y
sys-utils/hwclock-parse-date.y:287.1-12: warning: deprecated directive:
‘%pure-parser’, use ‘%define api.pure’ [-Wdeprecated]

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
4 years agoscript: fix minor warning
Sami Kerola [Thu, 13 Feb 2020 20:47:51 +0000 (20:47 +0000)] 
script: fix minor warning

ICO C does not allow extra ‘;’ outside of a function [-Wpedantic]

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
4 years agogetopt: use examples installation directory in man page
Sami Kerola [Wed, 12 Feb 2020 21:05:54 +0000 (21:05 +0000)] 
getopt: use examples installation directory in man page

Addresses: https://bugs.debian.org/913049
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
4 years agofstrim: randomize timer start time across 100 minutes
Sami Kerola [Wed, 12 Feb 2020 20:35:22 +0000 (20:35 +0000)] 
fstrim: randomize timer start time across 100 minutes

It should not matter when exactly fstrim runs, so spread these tasks across
time to help server farms and such to simultanously get busy with io.

Addresses: https://bugs.launchpad.net/bugs/1833593
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
4 years agovarious: use threadsafe versions of time functions [lgtm scan]
Sami Kerola [Sun, 9 Feb 2020 22:14:56 +0000 (22:14 +0000)] 
various: use threadsafe versions of time functions [lgtm scan]

Deprecating calls to not-thread safe asctime(), ctime(), and localtime()
calls is pretty close to pointless change.  Lets do it to reduce lgtm scan
warnings with justification it's nicer to use static analysis tools when
they have very few positives.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
4 years agowrite: fix potential string overflow
Sami Kerola [Sat, 8 Feb 2020 21:12:14 +0000 (21:12 +0000)] 
write: fix potential string overflow

Noticed when compiled with gcc verion 9.2.1 20200130.

term-utils/write.c:182:7: warning: ‘strcmp’ argument 1 declared attribute
  ‘nonstring’ [-Wstringop-overflow=]
  182 |   if (strcmp(u->ut_line, ctl->src_tty_name) == 0) {
      |       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/utmpx.h:31,
                 from term-utils/write.c:60:
/usr/include/bits/utmpx.h:59:8: note: argument ‘ut_line’ declared here
   59 |   char ut_line[__UT_LINESIZE]
      |        ^~~~~~~

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
4 years agoexfat: Fix parsing exfat label
Pali Rohár [Wed, 12 Feb 2020 17:08:46 +0000 (18:08 +0100)] 
exfat: Fix parsing exfat label

According to released exfat specification, label is only 22 bytes long.

4 years agolibfdisk: add Linux /var, /var/tmp and root verity GPT partition types
nl6720 [Tue, 11 Feb 2020 10:04:02 +0000 (12:04 +0200)] 
libfdisk: add Linux /var, /var/tmp and root verity GPT partition types

See https://github.com/systemd/systemd/pull/14390 and https://systemd.io/DISCOVERABLE_PARTITIONS/ .

Also replace a stray tab with a space.

4 years agoMerge branch 'master' of https://github.com/pali/util-linux
Karel Zak [Mon, 10 Feb 2020 12:51:23 +0000 (13:51 +0100)] 
Merge branch 'master' of https://github.com/pali/util-linux

* 'master' of https://github.com/pali/util-linux:
  tests: Add UDF hdd image with emoji label created by mkudffs 2.2
  libblkid: Fix UTF-16 support in function blkid_encode_to_utf8()

4 years agotests: add sfdisk --dump test
Karel Zak [Mon, 10 Feb 2020 12:20:04 +0000 (13:20 +0100)] 
tests: add sfdisk --dump test

Signed-off-by: Karel Zak <kzak@redhat.com>
4 years agotests: Add UDF hdd image with emoji label created by mkudffs 2.2
Pali Rohár [Sun, 9 Feb 2020 12:04:39 +0000 (13:04 +0100)] 
tests: Add UDF hdd image with emoji label created by mkudffs 2.2

mkudffs 2.2 can create UDF filesystem which label contains Unicode code
points above U+FFFF which cannot be represented by UCS-2 encoding and
therefore UTF-16 needs to be used (via surrogate pairs). Unicode code
points above U+FFFF are encoded in UTF-8 by four bytes and some example is
emoji "😀".

This is test case to check that libblkid correctly supports UTF-16
decoding. It was created by mkudffs 2.2:

$ dd if=/dev/zero of=udf-hdd-mkudffs-2.2.img bs=1M count=10
$ mkudffs -l 😀 udf-hdd-mkudffs-2.2.img

4 years agolibblkid: Fix UTF-16 support in function blkid_encode_to_utf8()
Pali Rohár [Sun, 9 Feb 2020 12:04:34 +0000 (13:04 +0100)] 
libblkid: Fix UTF-16 support in function blkid_encode_to_utf8()

Function blkid_encode_to_utf8() says that is supports BLKID_ENC_UTF16LE and
BLKID_ENC_UTF16BE encodings, but it is not truth and supports only UCS-2
(and not full UTF-16).

As all places where BLKID_ENC_UTF16LE and BLKID_ENC_UTF16BE is used expects
UTF-16 and not UCS-2, this patch changes implementation of encodings
BLKID_ENC_UTF16LE and BLKID_ENC_UTF16BE to supports full UTF-16, including
surrogate pairs and not only UCS-2.

4 years agolibfdisk: (docs) fix typos
Karel Zak [Wed, 5 Feb 2020 13:50:05 +0000 (14:50 +0100)] 
libfdisk: (docs) fix typos

Signed-off-by: Karel Zak <kzak@redhat.com>
4 years agosfdisk: add --relocate command
Karel Zak [Wed, 5 Feb 2020 13:40:45 +0000 (14:40 +0100)] 
sfdisk: add --relocate command

This command allows to relocate GPT backup header behind last
partition (--relocate gpt-bak-mini) or to standard position
(--relocate gpt-bak-std).

Hint: use "fdisk --list-details" to see "Alternative LBA".

Signed-off-by: Karel Zak <kzak@redhat.com>
4 years agolibfdisk: (gpt) add functionality to move backup header
Karel Zak [Wed, 5 Feb 2020 13:37:41 +0000 (14:37 +0100)] 
libfdisk: (gpt) add functionality to move backup header

- add fdisk_gpt_disable_relocation() to disable move backup header to standard location

- add fdisk_gpt_enable_minimize() to move backup header behind last partition

Note that fdisk_gpt_disable_relocation() has to be used before fdisk_assign_device(),
because automatic relocation is done when libfdisk reads the header from the device.

For example:
lb = fdisk_get_label(cxt, "gpt");

fdisk_gpt_disable_relocation(lb, 1);
fdisk_assign_device(cxt, devname, 0);

For fdisk_gpt_enable_minimize() it's not important as recalculation is
done before write, for example:

fdisk_assign_device(cxt, devname, 0);
fdisk_gpt_enable_minimize(fdisk_get_label(cxt, NULL), 1);

... add partition, etc ...

fdisk_write_disklabel(cxt);

Signed-off-by: Karel Zak <kzak@redhat.com>
4 years agofdisk: add --list-details
Karel Zak [Mon, 3 Feb 2020 15:50:43 +0000 (16:50 +0100)] 
fdisk: add --list-details

Signed-off-by: Karel Zak <kzak@redhat.com>
4 years agolibfdisk: (gpt) add GPT debug mask
Karel Zak [Fri, 31 Jan 2020 10:41:08 +0000 (11:41 +0100)] 
libfdisk: (gpt) add GPT debug mask

Signed-off-by: Karel Zak <kzak@redhat.com>
4 years agolibfdisk: (gpt) cleanup and consolidate write code
Karel Zak [Fri, 31 Jan 2020 10:29:12 +0000 (11:29 +0100)] 
libfdisk: (gpt) cleanup and consolidate write code

- add fsync after write
- use write_all()
- use the same code for all write steps

Signed-off-by: Karel Zak <kzak@redhat.com>
4 years agodocs: improve size arguments description in --help output
Karel Zak [Wed, 5 Feb 2020 10:01:36 +0000 (11:01 +0100)] 
docs: improve size arguments description in --help output

Let's add "Arguments:" section to the --help output and describe
{K,M,G...}iB suffixes there.

Addresses: https://github.com/karelzak/util-linux/pull/917
Co-Author: ed <ed@s5h.net>
Signed-off-by: Karel Zak <kzak@redhat.com>
4 years agoinclude/c: add USAGE_ARGUMENT
Karel Zak [Tue, 4 Feb 2020 10:20:16 +0000 (11:20 +0100)] 
include/c: add USAGE_ARGUMENT

Signed-off-by: Karel Zak <kzak@redhat.com>
4 years agofstrim: do not use Protect setting in systemd service
Karel Zak [Tue, 4 Feb 2020 15:17:42 +0000 (16:17 +0100)] 
fstrim: do not use Protect setting in systemd service

The ProtectHome= and ProtectSystem= settings mounts all stuff for the service in read-only mode.

The fstrim ioctl operates on read-only mountpoint file descriptor, but
on some read-only filesystem the operation can fail, so since
2d22ac64e4 we check for read-only volumes and skip it.

References: Upstream: http://github.com/karelzak/util-linux/commit/2d22ac64e4d6e6732640f38b7232b5bcdc84a877
Addresses: https://github.com/karelzak/util-linux/issues/948
Signed-off-by: Karel Zak <kzak@redhat.com>
4 years agosfdisk: fix ref-counting for the script
Karel Zak [Tue, 4 Feb 2020 14:54:53 +0000 (15:54 +0100)] 
sfdisk: fix ref-counting for the script

Signed-off-by: Karel Zak <kzak@redhat.com>
4 years agolibfdisk: (script) fix memory leak
Karel Zak [Tue, 4 Feb 2020 14:54:10 +0000 (15:54 +0100)] 
libfdisk: (script) fix memory leak

Signed-off-by: Karel Zak <kzak@redhat.com>
4 years agolibfdisk: (script) accept sector-size, ignore unknown headers
Karel Zak [Tue, 4 Feb 2020 14:11:19 +0000 (15:11 +0100)] 
libfdisk: (script) accept sector-size, ignore unknown headers

- add sector-size between supported headers (already in --dump output)

- report unknown headers by -ENOTSUP

- ignore ENOTSUP in sfdisk (but print warning) and in fdisk_script_read_file()

Addresses: https://github.com/karelzak/util-linux/issues/949
Signed-off-by: Karel Zak <kzak@redhat.com>
4 years agochrt: Use sched_setscheduler system call directly
jonnyh64 [Wed, 29 Jan 2020 21:24:16 +0000 (22:24 +0100)] 
chrt: Use sched_setscheduler system call directly

musl libc does not support the sched_setscheduler library function
because the underlying Linux system call does not confirm to Posix;
this patch makes chrt use the system call directly

[kzak@redhat.com:
    - note that musl libc implements sched_setscheduler()
      but returns -ENOSYS all time...
    - add ifdefs to the patch
    - make sure we include syscall.h]

References: http://git.musl-libc.org/cgit/musl/commit/src/sched/sched_setscheduler.c?id=1e21e78bf7a5c24c217446d8760be7b7188711c2
Addresses: https://github.com/karelzak/util-linux/issues/943
Signed-off-by: Karel Zak <kzak@redhat.com>
4 years agolibfdisk: fix __copy_partition()
Karel Zak [Tue, 28 Jan 2020 11:46:39 +0000 (12:46 +0100)] 
libfdisk: fix __copy_partition()

The code called free() for pointers copied from the source partition.

Addresses: https://github.com/systemd/systemd/pull/14677
Signed-off-by: Karel Zak <kzak@redhat.com>
4 years agolib/randutils: use explicit data types for bit ops
Karel Zak [Tue, 28 Jan 2020 11:30:23 +0000 (12:30 +0100)] 
lib/randutils: use explicit data types for bit ops

ASAN is pretty unhappy with getpid() << 16, it seems better to save
into unsigned int and than do the bit-op.

Addresses: https://github.com/karelzak/util-linux/issues/942
Signed-off-by: Karel Zak <kzak@redhat.com>
4 years agolibfdisk: make sure we use NULL after free
Karel Zak [Tue, 28 Jan 2020 11:29:44 +0000 (12:29 +0100)] 
libfdisk: make sure we use NULL after free

Signed-off-by: Karel Zak <kzak@redhat.com>
4 years agolib/strutils: add test for strdup_to_struct_member()
Karel Zak [Tue, 28 Jan 2020 10:34:04 +0000 (11:34 +0100)] 
lib/strutils: add test for strdup_to_struct_member()

Signed-off-by: Karel Zak <kzak@redhat.com>
4 years agolibmount: fix x- options use for non-root users
Karel Zak [Tue, 28 Jan 2020 09:45:07 +0000 (10:45 +0100)] 
libmount: fix x- options use for non-root users

libmount returns EPERM for all X- and x- mount options for non-root
users when evaluate X-mount.mkdir. It's bug, we need to be sensitive
to only X-mount.mkdir and only if the target directory is missing.

Addresses: https://github.com/karelzak/util-linux/issues/941
Signed-off-by: Karel Zak <kzak@redhat.com>
4 years agobuild-sys: add --disable-hwclock-gplv3
Karel Zak [Mon, 27 Jan 2020 15:17:10 +0000 (16:17 +0100)] 
build-sys: add --disable-hwclock-gplv3

The currently used date/time parser (for hwclock --set --date <date>)
is gnulib based code with GPLv3.

This patch allows to avoid this code and replace it with minimalistic
date/time parser.

Addresses: https://github.com/karelzak/util-linux/issues/891
Reported-by: Carlos Santos <unixmania@gmail.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
4 years agoMerge branch 'master' of https://github.com/yurchor/util-linux
Karel Zak [Thu, 23 Jan 2020 14:57:37 +0000 (15:57 +0100)] 
Merge branch 'master' of https://github.com/yurchor/util-linux

* 'master' of https://github.com/yurchor/util-linux:
  po: update uk.po (from translationproject.org)

4 years agoMerge branch 'patch-2' of https://github.com/yurchor/util-linux
Karel Zak [Thu, 23 Jan 2020 14:53:19 +0000 (15:53 +0100)] 
Merge branch 'patch-2' of https://github.com/yurchor/util-linux

* 'patch-2' of https://github.com/yurchor/util-linux:
  Fix minor typo: aliast -> alias

4 years agoMerge branch 'patch-1' of https://github.com/yurchor/util-linux
Karel Zak [Thu, 23 Jan 2020 14:52:44 +0000 (15:52 +0100)] 
Merge branch 'patch-1' of https://github.com/yurchor/util-linux

* 'patch-1' of https://github.com/yurchor/util-linux:
  Fix minor typo: ussuported -> unsupported

4 years agolibfdisk: (gpt) cleanup entries array size calculations
Karel Zak [Thu, 16 Jan 2020 13:28:31 +0000 (14:28 +0100)] 
libfdisk: (gpt) cleanup entries array size calculations

- move all calculations to inline functions
- remove duplicate code
- keep the same names for the same stuff

Signed-off-by: Karel Zak <kzak@redhat.com>
4 years agolibfdisk: fix const char mess
Karel Zak [Thu, 16 Jan 2020 11:56:18 +0000 (12:56 +0100)] 
libfdisk: fix const char mess

Signed-off-by: Karel Zak <kzak@redhat.com>
4 years agosfdisk: add --disk-id to change disk UUID/ID
Karel Zak [Tue, 14 Jan 2020 10:50:46 +0000 (11:50 +0100)] 
sfdisk: add --disk-id to change disk UUID/ID

Addresses: https://github.com/karelzak/util-linux/issues/916
Signed-off-by: Karel Zak <kzak@redhat.com>
4 years agolibfdisk: add fdisk_set_disklabel_id_from_string()
Karel Zak [Tue, 14 Jan 2020 10:43:24 +0000 (11:43 +0100)] 
libfdisk: add fdisk_set_disklabel_id_from_string()

We have fdisk_set_disklabel_id(), but it's old ask-API based function.
It's not comfortable if you want to avoid dialog or template.

Addresses: https://github.com/karelzak/util-linux/issues/916
Signed-off-by: Karel Zak <kzak@redhat.com>
4 years agoblkdiscard: use O_EXCL, add --force
Karel Zak [Thu, 9 Jan 2020 10:03:51 +0000 (11:03 +0100)] 
blkdiscard: use O_EXCL, add --force

Let's make it more robust and safe. O_EXCL is an elegant way how to avoid
unwanted discard on mounted device.

Addresses: https://github.com/karelzak/util-linux/issues/915
Signed-off-by: Karel Zak <kzak@redhat.com>
4 years agoMerge branch 'dmverity_sig' of https://github.com/bluca/util-linux
Karel Zak [Thu, 23 Jan 2020 14:47:15 +0000 (15:47 +0100)] 
Merge branch 'dmverity_sig' of https://github.com/bluca/util-linux

* 'dmverity_sig' of https://github.com/bluca/util-linux:
  libmount: add support for signed verity devices

4 years agoflock: make examples in man page more readable
Karel Zak [Thu, 23 Jan 2020 14:43:23 +0000 (15:43 +0100)] 
flock: make examples in man page more readable

Signed-off-by: Karel Zak <kzak@redhat.com>
4 years agoMerge branch 'Jookia-patch-1' of https://github.com/Jookia/util-linux
Karel Zak [Thu, 23 Jan 2020 14:39:42 +0000 (15:39 +0100)] 
Merge branch 'Jookia-patch-1' of https://github.com/Jookia/util-linux

* 'Jookia-patch-1' of https://github.com/Jookia/util-linux:
  flock: Add new example using shell IO redirection

4 years agosfdisk: remove broken step alignment for --move
Karel Zak [Thu, 23 Jan 2020 14:07:32 +0000 (15:07 +0100)] 
sfdisk: remove broken step alignment for --move

* remove unnecessary and broken step alignment
* improve reported information in move log
* improve final progress bar update

Addresses: https://github.com/karelzak/util-linux/issues/938
Signed-off-by: Karel Zak <kzak@redhat.com>
4 years agosfdisk: make sure we do not overlap on --move
Karel Zak [Thu, 23 Jan 2020 11:44:58 +0000 (12:44 +0100)] 
sfdisk: make sure we do not overlap on --move

The area we need to move does not have to be aligned to optimal I/O
size (step size) -- we need to be sure we do not move data
after/before the area.

Addresses: https://github.com/karelzak/util-linux/issues/938
Signed-off-by: Karel Zak <kzak@redhat.com>
4 years agoflock: Add new example using shell IO redirection
Jookia [Thu, 23 Jan 2020 04:55:35 +0000 (04:55 +0000)] 
flock: Add new example using shell IO redirection

4 years agopo: update uk.po (from translationproject.org)
Yuri Chornoivan [Wed, 22 Jan 2020 18:52:11 +0000 (20:52 +0200)] 
po: update uk.po (from translationproject.org)

4 years agobuild-sys: release++ (v2.35) v2.35
Karel Zak [Tue, 21 Jan 2020 10:15:21 +0000 (11:15 +0100)] 
build-sys: release++ (v2.35)

Signed-off-by: Karel Zak <kzak@redhat.com>
4 years agodocs: update v2.35-ReleaseNotes
Karel Zak [Tue, 21 Jan 2020 10:12:49 +0000 (11:12 +0100)] 
docs: update v2.35-ReleaseNotes

Signed-off-by: Karel Zak <kzak@redhat.com>
4 years agodocs: update AUTHORS file
Karel Zak [Tue, 21 Jan 2020 10:07:27 +0000 (11:07 +0100)] 
docs: update AUTHORS file

Signed-off-by: Karel Zak <kzak@redhat.com>
4 years agopo: merge changes
Karel Zak [Tue, 21 Jan 2020 10:03:19 +0000 (11:03 +0100)] 
po: merge changes

Signed-off-by: Karel Zak <kzak@redhat.com>
4 years agopo: update pt.po (from translationproject.org)
Pedro Albuquerque [Tue, 21 Jan 2020 09:57:45 +0000 (10:57 +0100)] 
po: update pt.po (from translationproject.org)

4 years agopo: update pt_BR.po (from translationproject.org)
Rafael Fontenelle [Tue, 21 Jan 2020 09:57:45 +0000 (10:57 +0100)] 
po: update pt_BR.po (from translationproject.org)

4 years agopo: update pl.po (from translationproject.org)
Jakub Bogusz [Tue, 21 Jan 2020 09:57:45 +0000 (10:57 +0100)] 
po: update pl.po (from translationproject.org)

4 years agopo: update ja.po (from translationproject.org)
Takeshi Hamasaki [Tue, 21 Jan 2020 09:57:45 +0000 (10:57 +0100)] 
po: update ja.po (from translationproject.org)

4 years agopo: update hr.po (from translationproject.org)
Božidar Putanec [Tue, 21 Jan 2020 09:57:45 +0000 (10:57 +0100)] 
po: update hr.po (from translationproject.org)

4 years agopo: update fr.po (from translationproject.org)
Frédéric Marchal [Tue, 21 Jan 2020 09:57:45 +0000 (10:57 +0100)] 
po: update fr.po (from translationproject.org)

4 years agopo: update es.po (from translationproject.org)
Antonio Ceballos Roa [Tue, 21 Jan 2020 09:57:45 +0000 (10:57 +0100)] 
po: update es.po (from translationproject.org)

4 years agopo: update de.po (from translationproject.org)
Mario Blättermann [Tue, 21 Jan 2020 09:57:45 +0000 (10:57 +0100)] 
po: update de.po (from translationproject.org)

4 years agopo: update cs.po (from translationproject.org)
Petr Písař [Tue, 21 Jan 2020 09:57:45 +0000 (10:57 +0100)] 
po: update cs.po (from translationproject.org)

4 years agoscriptreplay: restrict header name size
Karel Zak [Mon, 20 Jan 2020 12:04:59 +0000 (13:04 +0100)] 
scriptreplay: restrict header name size

Signed-off-by: Karel Zak <kzak@redhat.com>
4 years agolibmount: (monitor) remove dead code [coverity scan]
Karel Zak [Wed, 15 Jan 2020 13:08:06 +0000 (14:08 +0100)] 
libmount: (monitor) remove dead code [coverity scan]

Signed-off-by: Karel Zak <kzak@redhat.com>
4 years agolibmount: use vsnprintf() in more robust way [coverity scan]
Karel Zak [Wed, 15 Jan 2020 12:59:42 +0000 (13:59 +0100)] 
libmount: use vsnprintf() in more robust way [coverity scan]

Signed-off-by: Karel Zak <kzak@redhat.com>
4 years agolslogins: assume unterminated strings in wtmp/btmp [coverity scan]
Karel Zak [Wed, 15 Jan 2020 12:18:15 +0000 (13:18 +0100)] 
lslogins: assume unterminated strings in wtmp/btmp [coverity scan]

Let's use mem2strcpy() to be robust.

Signed-off-by: Karel Zak <kzak@redhat.com>
4 years agoscript: follow --logging-format on -t
Karel Zak [Wed, 15 Jan 2020 12:01:06 +0000 (13:01 +0100)] 
script: follow --logging-format on -t

Let's use new logic for timing file format also for old -t command
line option.

Signed-off-by: Karel Zak <kzak@redhat.com>
4 years agostrutils: fix double free in strrealloc() [coverity scan]
Karel Zak [Wed, 15 Jan 2020 11:58:29 +0000 (12:58 +0100)] 
strutils: fix double free in strrealloc() [coverity scan]

* fix double free
* keep strrealloc() semantic compatible with classic realloc() (do not
  free original pointer on failed memory allocation).
* remove unnecessary goto

Signed-off-by: Karel Zak <kzak@redhat.com>
4 years agosfdisk: remove never read value [clang scan]
Karel Zak [Wed, 15 Jan 2020 11:38:19 +0000 (12:38 +0100)] 
sfdisk: remove never read value [clang scan]

Signed-off-by: Karel Zak <kzak@redhat.com>
4 years agosfdisk: check fdisk_script_set_header() return code [coverity scan]
Karel Zak [Wed, 15 Jan 2020 11:35:38 +0000 (12:35 +0100)] 
sfdisk: check fdisk_script_set_header() return code [coverity scan]

Signed-off-by: Karel Zak <kzak@redhat.com>
4 years agocfdisk: check mnt_table_parse_fstab() return code [coverity scan]
Karel Zak [Wed, 15 Jan 2020 10:56:00 +0000 (11:56 +0100)] 
cfdisk: check mnt_table_parse_fstab() return code [coverity scan]

Signed-off-by: Karel Zak <kzak@redhat.com>
4 years agolibmount: add support for signed verity devices
Luca Boccassi [Wed, 4 Dec 2019 15:06:55 +0000 (15:06 +0000)] 
libmount: add support for signed verity devices

A new API was added to libcryptsetup to make use of the kernel's new
CONFIG_DM_VERITY_VERIFY_ROOTHASH_SIG feature, which allows to sign
root hashes. Add a verity.roothashsig option to use it.
Device reuse will be allowed only if signatures are used by all, or
by none.

4 years agolibblkid: (zfs) don't probe whole-disk areas covered by partitions
Karel Zak [Mon, 13 Jan 2020 12:00:14 +0000 (13:00 +0100)] 
libblkid: (zfs) don't probe whole-disk areas covered by partitions

Addresses: https://github.com/karelzak/util-linux/issues/918
Signed-off-by: Karel Zak <kzak@redhat.com>
4 years agoRevert "libblkid: improve handling of ISO files with partition tables"
Karel Zak [Mon, 13 Jan 2020 10:53:11 +0000 (11:53 +0100)] 
Revert "libblkid: improve handling of ISO files with partition tables"

This reverts commit 7ef86a08914427d6486734614d7d3bbed1f108fe.

4 years agoRevert "libblkid: improve identification of ISO9660 partition"
Karel Zak [Mon, 13 Jan 2020 10:48:37 +0000 (11:48 +0100)] 
Revert "libblkid: improve identification of ISO9660 partition"

This reverts commit fc84bc0a463480ffb17a39b5375463b7f07d14ce.

4 years agolib: add _PATH_TMP fallback
Karel Zak [Mon, 13 Jan 2020 09:45:35 +0000 (10:45 +0100)] 
lib: add _PATH_TMP fallback

- cleanup header of the file
- fix fileutils.c warnings
- add _PATH_TMP fallback

Addresses: https://github.com/karelzak/util-linux/issues/931
Signed-off-by: Karel Zak <kzak@redhat.com>
4 years agoinclude: add some missing licence stuff to header files
Karel Zak [Mon, 13 Jan 2020 09:39:52 +0000 (10:39 +0100)] 
include: add some missing licence stuff to header files

It's mostly wrappers for compatibility and another trivial stuff etc.
Let's keep it as public domain to make it more portable to LGPL, GPL
and BSD code.

Signed-off-by: Karel Zak <kzak@redhat.com>
CC: Sami Kerola <kerolasa@iki.fi>
CC: Ruediger Meier <ruediger.meier@ga-group.nl>