]> git.ipfire.org Git - thirdparty/util-linux.git/log
thirdparty/util-linux.git
3 years agobuild-sys: release++ (v2.35.2) stable/v2.35 v2.35.2
Karel Zak [Wed, 20 May 2020 13:44:20 +0000 (15:44 +0200)] 
build-sys: release++ (v2.35.2)

Signed-off-by: Karel Zak <kzak@redhat.com>
3 years agodocs: add v2.35.2-ReleaseNotes
Karel Zak [Wed, 20 May 2020 13:43:03 +0000 (15:43 +0200)] 
docs: add v2.35.2-ReleaseNotes

Signed-off-by: Karel Zak <kzak@redhat.com>
3 years agodocs: update AUTHORS file
Karel Zak [Wed, 20 May 2020 13:41:14 +0000 (15:41 +0200)] 
docs: update AUTHORS file

Signed-off-by: Karel Zak <kzak@redhat.com>
3 years agopo: merge changes
Karel Zak [Wed, 20 May 2020 13:39:02 +0000 (15:39 +0200)] 
po: merge changes

Signed-off-by: Karel Zak <kzak@redhat.com>
3 years agopo: update zh_CN.po (from translationproject.org)
Boyuan Yang [Wed, 20 May 2020 13:31:00 +0000 (15:31 +0200)] 
po: update zh_CN.po (from translationproject.org)

3 years agopo: update hr.po (from translationproject.org)
Božidar Putanec [Wed, 20 May 2020 13:30:59 +0000 (15:30 +0200)] 
po: update hr.po (from translationproject.org)

3 years agolib/strutils: remove redundant include
Karel Zak [Wed, 20 May 2020 13:25:31 +0000 (15:25 +0200)] 
lib/strutils: remove redundant include

Signed-off-by: Karel Zak <kzak@redhat.com>
3 years agodocs: Fix dead references to kernel documentation
Yannick Le Pennec [Sun, 17 May 2020 15:13:22 +0000 (23:13 +0800)] 
docs: Fix dead references to kernel documentation

Most date back to reorganisation of the Documentation/ tree in 2016,
new paths based on v5.7-rc5:

fdisk.8:   Documentation/{,admin-guide/}devices.txt
eject.c:   Documentation/{,userspace-api/}ioctl/cdrom.rst
mount.8:   Documentation/filesystems/adfs.{txt,rst}
rfkill.8:  Documentation/{rfkill.txt,driver-api/rfkill.rst}
tunelp.8:  Documentation/{parport.txt,admin-guide/parport.rst}
zramctl.8: Documentation/{blockdev/zram.txt,admin-guide/blockdev/zram.rst}

Signed-off-by: Yannick Le Pennec <yannick.lepennec@live.fr>
3 years agoipcs.1: ipcs no longer needs read permission on IPC resources
Michael Kerrisk [Sat, 16 May 2020 07:45:11 +0000 (09:45 +0200)] 
ipcs.1: ipcs no longer needs read permission on IPC resources

With changes starting around util-linux commit 058e81540fbb0d2b78
that switched from using IPC_STAT to parsing /proc/sysvipc/*,
ipcs now shows all IPC objects rather than just the objects for
which the user has read permission. Update the page to reflect this
fact, and also add a NOTES section describing the historical and
fallback behavior where /proc is not available.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
3 years agosfdisk: (man) fix typo
Gaël PORTAY [Fri, 15 May 2020 12:52:06 +0000 (08:52 -0400)] 
sfdisk: (man) fix typo

3 years agoblkzone: deny destructive ioctls on busy blockdev
Johannes Thumshirn [Fri, 15 May 2020 08:41:33 +0000 (17:41 +0900)] 
blkzone: deny destructive ioctls on busy blockdev

If a user submits a zone management ioctl from user-space, like a zone
reset and a file-system (like zonefs or f2fs) is mounted on the zoned
block device, the zone will get reset and the file-system's cached value
of the zone's write-pointer becomes invalid.

Subsequent writes to this zone from the file-system will result in
unaligned writes and the drive will error out.

Open the block device file in exclusive mode for submitting these ioctls.
If a file-system is mounted the kernel will return -EBUSY and we can't
continue issuing the ioctl.

[kzak@redhat.com: - remove unnecessary error message]

Reported-by: Coly Li <colyli@suse.de>
Cc: Damien Le Moal <Damien.LeMoal@wdc.com>
Signed-off-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
3 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>
3 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>
3 years agolsblk: Ignore hidden devices
Ritika Srivastava [Wed, 13 May 2020 22:06:10 +0000 (15:06 -0700)] 
lsblk: Ignore hidden devices

Lsblk throws the following error for nvmeNcXnY devices.

lsblk: nvme1c1n1: unknown device name

This is because nvmeNcXnY devices are hidden and do not have
the file /sys/block/<nvmeNcXnY>/dev.

Following patch was added
https://git.kernel.org/pub/scm/utils/util-linux/util-linux.git/commit/?id=d51f05bfecb299a830897106460bf395be440c0a
Which made lsblk read from /sys/block/<nvmeNcXnY>/device/dev
which do exist for nvmeNcXnY devices.

After the above patch, the unknown error goes away.
However, another error is encountered in the very next step.

nvme1c1n1: failed to initialize sysfs handler

This is because lsblk looks for /sys/dev/block/242:1
(nvmeNcXnY major:minor) pathname which usually exists for other
block devices but not for the nvmeNcXnY devices as they are hidden.

Below patch does not even print this error for hidden devices
and exits silently.

[kzak@redhat.com: - add prefix to make sysfs_devname_is_hidden()
                    usable for  /sys dumps
                  - use the function in initialize_device() more early]

Signed-off-by: Ritika Srivastava <ritika.srivastava@oracle.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
3 years agolibblkid: fix fstatat() use in blkid__scan_dir()
Karel Zak [Tue, 12 May 2020 07:16:49 +0000 (09:16 +0200)] 
libblkid: fix fstatat() use in blkid__scan_dir()

Addresses: https://github.com/karelzak/util-linux/issues/1037
References: http://github.com/karelzak/util-linux/commit/2208b3ccb298be2675cf005b761b1668f8cd576f
Signed-off-by: Karel Zak <kzak@redhat.com>
3 years agodocs: Correct ChangeLog URL to history log.
Anatoly Pugachev [Thu, 7 May 2020 09:17:47 +0000 (12:17 +0300)] 
docs: Correct ChangeLog URL to history log.

Debian is using this to make URL with tagged release, and with the old
URL it does return an empty page.

$ apt info util-linux | grep -i version
Version: 2.35.1-2

$ zcat /usr/share/doc/util-linux/changelog.gz
See version control history.

http://git.kernel.org/?p=utils/util-linux/util-linux.git;a=log;h=2.35.1

^^ empty page

Signed-off-by: Anatoly Pugachev <matorola@gmail.com>
3 years agowipefs: fix man page --no-headings short option
Karel Zak [Wed, 6 May 2020 13:18:52 +0000 (15:18 +0200)] 
wipefs: fix man page --no-headings short option

Addresses: https://github.com/karelzak/util-linux/issues/1029
Signed-off-by: Karel Zak <kzak@redhat.com>
3 years agotests: Fix for misc/fallocate test build failure.
Mark Hindley [Tue, 5 May 2020 19:28:55 +0000 (21:28 +0200)] 
tests: Fix for misc/fallocate test build failure.

This was already a known possible failure case. However, in the migration to a
clearer separation of stdout and stderr in the testsuite, the logfile used to
detect the failure was not updated.

Signed-off-by: Mark Hindley <mark@hindley.org.uk>
3 years agolibfdisk: fix partition calculation for BLKPG_* ioctls
Karel Zak [Wed, 6 May 2020 11:32:46 +0000 (13:32 +0200)] 
libfdisk: fix partition calculation for BLKPG_* ioctls

The include/partx.h interface we use in util-linux uses 512-byte
sectors, but libfdisk uses real sector sizes.

Signed-off-by: Karel Zak <kzak@redhat.com>
3 years agoscriptlive: fix typo
Jakub Wilk [Tue, 5 May 2020 12:17:55 +0000 (14:17 +0200)] 
scriptlive: fix typo

Signed-off-by: Jakub Wilk <jwilk@jwilk.net>
3 years agoscriptlive: fix man page formatting
Jakub Wilk [Tue, 5 May 2020 12:16:52 +0000 (14:16 +0200)] 
scriptlive: fix man page formatting

Signed-off-by: Jakub Wilk <jwilk@jwilk.net>
3 years agodocs: add swap to 1st fstab field
Karel Zak [Mon, 4 May 2020 09:44:03 +0000 (11:44 +0200)] 
docs: add swap to 1st fstab field

Addresses: https://github.com/karelzak/util-linux/issues/1027
Signed-off-by: Karel Zak <kzak@redhat.com>
3 years agolsblk: Fall back to ID_SERIAL
Sven Wiltink [Fri, 1 May 2020 14:35:40 +0000 (16:35 +0200)] 
lsblk: Fall back to ID_SERIAL

In some cases ID_SERIAL_SHORT isn't provided by libudev, but ID_SERIAL
is. An example of this are virtio devices. See the output of udevadm
info:
P: /devices/pci0000:00/0000:00:06.0/virtio2/block/vdb
N: vdb
S: disk/by-id/virtio-08491434ee711d3420e9
S: disk/by-path/pci-0000:00:06.0
S: disk/by-path/virtio-pci-0000:00:06.0
E: DEVLINKS=/dev/disk/by-id/virtio-08491434ee711d3420e9 /dev/disk/by-path/pci-0000:00:06.0 /dev/disk/by-path/virtio-pci-0000:00:06.0
E: DEVNAME=/dev/vdb
E: DEVPATH=/devices/pci0000:00/0000:00:06.0/virtio2/block/vdb
E: DEVTYPE=disk
E: ID_PATH=pci-0000:00:06.0
E: ID_PATH_TAG=pci-0000_00_06_0
E: ID_SERIAL=08491434ee711d3420e9
E: MAJOR=252
E: MINOR=16
E: SUBSYSTEM=block
E: TAGS=:systemd:
E: USEC_INITIALIZED=1403804

[kzak@redhat.com: - add ID_SERIAL also to get_properties_by_file()]

Signed-off-by: Karel Zak <kzak@redhat.com>
3 years agobash-completion: umount explicitly needs gawk
Wolfram Sang [Tue, 28 Apr 2020 07:13:15 +0000 (09:13 +0200)] 
bash-completion: umount explicitly needs gawk

gensub() is a gawk extension, so use it explicitly. Otherwise users will
get an error if their 'awk' defaults to something else.

Fixes: 3ebfc8d37 ("bash-completion: umount support relative path and ~ as home shorthands")
Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
3 years agolibmount: fix mount -a EBUSY for cifs
Roberto Bergantinos Corpas [Mon, 27 Apr 2020 13:46:02 +0000 (15:46 +0200)] 
libmount: fix mount -a EBUSY for cifs

fstab:

 //rhel73/myshare/sub/path  /mnt   cifs

after mount in mountinfo:

 #  grep cifs /proc/self/mountinfo
 47 39 0:40 /sub/path /mnt rw,relatime shared:60 - cifs //rhel73/myshare/sub/path ...
            ^^^^^^^^^
or:

 # grep cifs /proc/self/mountinfo
 47 39 0:40 / /mnt rw,relatime shared:60 - cifs //rhel73/myshare/sub/path ...
            ^

That is so since on kernel cifs code, cifs_get_root (which returns the
entry associated with mnt_root) return s_root if
CIFS_MOUNT_USE_PREFIX_PATH is set, no questions asked.

This situation can occurr often on CIFS mounts, as CIFS servers limit
frequently scope of access to the root path.

[kzak@redhat.com: - add more info to the commit message,
                  - clean up variable names]

Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=1826719
Signed-off-by: Roberto Bergantinos Corpas <rbergant@redhat.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
3 years agolibfdisk: (script) fix partno_from_devname()
Karel Zak [Mon, 27 Apr 2020 09:15:00 +0000 (11:15 +0200)] 
libfdisk: (script) fix partno_from_devname()

Addresses: https://github.com/karelzak/util-linux/issues/1015
Signed-off-by: Karel Zak <kzak@redhat.com>
3 years agosfdisk: only report I/O errors on --move-data
Karel Zak [Wed, 22 Apr 2020 12:57:33 +0000 (14:57 +0200)] 
sfdisk: only report I/O errors on --move-data

Now sfdisk stops everything on I/O error when moving data. It seems
better to report the error to user and continue as it's better to have
one bad sector in the partition than inconsistent all partition.

Addresses: https://github.com/karelzak/util-linux/issues/984
Signed-off-by: Karel Zak <kzak@redhat.com>
3 years agolibmount: do not unnecessarily chmod utab.lock
Tycho Andersen [Thu, 9 Jan 2020 23:52:41 +0000 (16:52 -0700)] 
libmount: do not unnecessarily chmod utab.lock

Before ecfeae90a294 ("libmount: Ensure utab.lock mode 644"), you could do
something like:

irc:/tmp umount --version
umount from util-linux 2.27.1 (libmount 2.27.0: selinux, assert, debug)
irc:/tmp mkdir foo bar
irc:/tmp unshare -Urm
irc:/tmp mount --bind foo bar
irc:/tmp umount bar
irc:/tmp echo $?
0

However, afterwards, you get:

/tmp unshare -Urm
/tmp mount --bind foo bar
/tmp umount bar
umount: /tmp/bar: filesystem was unmounted, but failed to update userspace mount table.

Because of the chmod failing:

fchmod(3, 0644)                         = -1 EPERM (Operation not permitted)

Let's figure out whether the chmod is necessary before doing it, and only
do it if it is necessary. This won't fix cases where the system is already
broken, but at least on healthy systems umount will behave as before.

Signed-off-by: Tycho Andersen <tycho@tycho.ws>
3 years agoeject: fix compiler warning [-Wformat-overflow]
Karel Zak [Wed, 22 Apr 2020 08:32:49 +0000 (10:32 +0200)] 
eject: fix compiler warning [-Wformat-overflow]

Signed-off-by: Karel Zak <kzak@redhat.com>
3 years agopylibmount: cleanup and sync UL_RaiseExc
Karel Zak [Wed, 22 Apr 2020 07:44:47 +0000 (09:44 +0200)] 
pylibmount: cleanup and sync UL_RaiseExc

Addresses: https://github.com/karelzak/util-linux/issues/1013
Signed-off-by: Karel Zak <kzak@redhat.com>
3 years agoblkdiscard: (man) offset and length must be sector aligned
Lukas Czerner [Wed, 15 Apr 2020 07:08:12 +0000 (09:08 +0200)] 
blkdiscard: (man) offset and length must be sector aligned

Update blkdiscard manual page. Length and offset values must be aligned
to the device sector size.

Signed-off-by: Lukas Czerner <lczerner@redhat.com>
Reported-by: Patrick Oppenlander <patrick.oppenlander@gmail.com>
3 years agoFix off by one when checking "/dev/mapper/" path
Disconnect3d [Mon, 13 Apr 2020 14:14:10 +0000 (16:14 +0200)] 
Fix off by one when checking "/dev/mapper/" path

This PR fixes an off by one in `strncmp(dev->bid_name, "/dev/mapper/", 11)` check. The `"/dev/mapper/"` string literal has a length of 12 and without this fix paths like `"/dev/mapperSOMETHING"` would also be accepted.

3 years agoctrlaltdel: display error message indicated by errno
Sami Kerola [Tue, 25 Feb 2020 21:30:19 +0000 (21:30 +0000)] 
ctrlaltdel: display error message indicated by errno

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
3 years agolscpu: Adapt MIPS cpuinfo
Jiaxun Yang [Sat, 28 Mar 2020 04:19:42 +0000 (12:19 +0800)] 
lscpu: Adapt MIPS cpuinfo

MIPS have slightly different layout of cpuinfo.

Signed-off-by: Jiaxun Yang <jiaxun.yang@flygoat.com>
3 years agolibfdisk: remove unwanted assert()
Karel Zak [Tue, 24 Mar 2020 09:52:54 +0000 (10:52 +0100)] 
libfdisk: remove unwanted assert()

Signed-off-by: Karel Zak <kzak@redhat.com>
3 years agodocs: kill.1 add note about shell-internal kill implementations
Sami Kerola [Sun, 22 Mar 2020 09:37:41 +0000 (09:37 +0000)] 
docs: kill.1 add note about shell-internal kill implementations

Requested-by: Ilia Baryshnikov <qwelias@gmail.com>
Reference: https://github.com/karelzak/util-linux/issues/991#issuecomment-602108648
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
3 years agolib/mangle: check for the NULL string argument
Gaël PORTAY [Fri, 20 Mar 2020 20:21:58 +0000 (16:21 -0400)] 
lib/mangle: check for the NULL string argument

This patch prevents to call the function strlen() with a NULL string
argument that leads to a segmentation fault.

Signed-off-by: Gaël PORTAY <gael.portay@collabora.com>
3 years agolibfdisk: (script) fix segmentation fault
Gaël PORTAY [Fri, 20 Mar 2020 20:10:35 +0000 (16:10 -0400)] 
libfdisk: (script) fix segmentation fault

This patch fixes a segmentation fault that occurs if the name value is
empty (i.e. name=).

Signed-off-by: Gaël PORTAY <gael.portay@collabora.com>
3 years agoFix typo in the mount (8) man page
Mark Barbone [Thu, 19 Mar 2020 22:13:46 +0000 (18:13 -0400)] 
Fix typo in the mount (8) man page

3 years agolibmount: smb2 is unsupported alias
Karel Zak [Wed, 11 Mar 2020 17:38:09 +0000 (18:38 +0100)] 
libmount: smb2 is unsupported alias

Kenneth D'souza wrote:
 # grep -w MODULE_ALIAS_FS fs/cifs/cifsfs.c
 MODULE_ALIAS_FS("cifs");
 112/112│MODULE_ALIAS_FS("smb3");

Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=1812118
Signed-off-by: Karel Zak <kzak@redhat.com>
3 years agolibmount: improve smb{2,3} support
Karel Zak [Wed, 11 Mar 2020 09:38:37 +0000 (10:38 +0100)] 
libmount: improve smb{2,3} support

It seems kernel can use smb3 as fstype in mountinfo.

Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=1812118
Signed-off-by: Karel Zak <kzak@redhat.com>
3 years agolscpu: use official name for HiSilicon tsv110
Karel Zak [Wed, 4 Mar 2020 11:54:24 +0000 (12:54 +0100)] 
lscpu: use official name for HiSilicon tsv110

Addresses: https://github.com/karelzak/util-linux/issues/969
Signed-off-by: Karel Zak <kzak@redhat.com>
3 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>
3 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>
3 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>
3 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>
3 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>
3 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>
3 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>
3 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.

3 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.

3 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>
3 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 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 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 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 agobuild-sys: release++ (v2.35.1) v2.35.1
Karel Zak [Fri, 31 Jan 2020 09:22:38 +0000 (10:22 +0100)] 
build-sys: release++ (v2.35.1)

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

Signed-off-by: Karel Zak <kzak@redhat.com>
4 years agodocs: update v2.35.1-ReleaseNotes
Karel Zak [Fri, 31 Jan 2020 09:19:16 +0000 (10:19 +0100)] 
docs: update v2.35.1-ReleaseNotes

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 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 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 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 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 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>
4 years agolibblkid: Fix documentation in libblkid header
John Baublitz [Thu, 9 Jan 2020 16:19:53 +0000 (11:19 -0500)] 
libblkid: Fix documentation in libblkid header

4 years agodocs: fix typos [fossies codespell scan]
Karel Zak [Thu, 9 Jan 2020 09:18:16 +0000 (10:18 +0100)] 
docs: fix typos [fossies codespell scan]

Signed-off-by: Karel Zak <kzak@redhat.com>
4 years agolibmount: do not obscure return code when checking verity options
Luca Boccassi [Tue, 7 Jan 2020 20:29:57 +0000 (20:29 +0000)] 
libmount: do not obscure return code when checking verity options

In some corner cases, the return code was being overwritten without
being checked

4 years agobuild-sys: release++ (v2.35-rc2) v2.35-rc2
Karel Zak [Wed, 8 Jan 2020 09:28:29 +0000 (10:28 +0100)] 
build-sys: release++ (v2.35-rc2)

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

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