Sami Kerola [Sat, 9 Feb 2019 08:47:43 +0000 (08:47 +0000)]
hardlink, wall: fix variable shadowing
misc-utils/hardlink.c:91:65: warning: declaration shadows a variable in the global scope [-Wshadow]
misc-utils/hardlink.c:73:5: note: previous declaration is here
int content_only = 0;
term-utils/wall.c:114:40: warning: declaration shadows a variable in the global scope [-Wshadow]
term-utils/wall.c:129:65: warning: declaration shadows a variable in the global scope [-Wshadow]
/usr/include/bits/getopt_core.h:36:14: note: previous declaration is here
extern char *optarg;
It is not guaranteed that the returned string of readline() actually
contains as many bytes as buf can contain.
If bufsz is larger than the allocated memory by readline, an out of
boundary read occurs and leads to undefined behaviour. Most likely
that will be a crash.
This can be reproduced when readline-support is compiled in and when
you directly enter "quit" and "n" (to not write changes back to disk)
when sfdisk was called with any given device.
Karel Zak [Thu, 14 Feb 2019 09:41:59 +0000 (10:41 +0100)]
wall: remove unnecessary warning
wall(1) may be used in scripts or in pipe. In this case report failed
ttyname() does not make sense, especially if the code does not depend
on on this function.
Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=1608176 Signed-off-by: Karel Zak <kzak@redhat.com>
Karel Zak [Tue, 12 Feb 2019 13:21:54 +0000 (14:21 +0100)]
fdisk: use 2 decimal places for size in disk summary
In the disk summary it seems nice, but I'm not sure about lists (SIZE
columns). It seems more readable to keep the lists with one decimal
place only. New output:
The rest is unchanged:
...
Device Start End Sectors Size Type
/dev/sda1 2048 411647 409600 200M EFI System
/dev/sda2 411648 821247 409600 200M Linux filesystem
/dev/sda3 821248 274087935273266688 130.3G Linux filesystem
/dev/sda4 274087936378945535104857600 50G Linux filesystem
/dev/sda5 37894553646886209489916559 42.9G Linux filesystem
Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=1673452 Signed-off-by: Karel Zak <kzak@redhat.com>
Karel Zak [Wed, 6 Feb 2019 12:55:20 +0000 (13:55 +0100)]
Merge branch 'hardlink' of https://github.com/rudimeier/util-linux into hardlink
* 'hardlink' of https://github.com/rudimeier/util-linux: (25 commits)
hardlink: add first simple tests
hardlink: util-linux usage
hardlink: fix compiler warnings
hardlink: style indentations and license header
hardlink: enable build with and without pcre2
fixes for the fixes
temporal fix before re-patch (updates from Fedora repo)
Update hardlink.1
Fixed version number, added changelog about Todd Lewis' patch
exclude files via pcre
Fixed 32 bit build with gcc7 (RH Bugzilla ID 1422989)
spec file reflects the atomic hardlinking patch; removed cleaning buildroot (redundant); update FSF address at .c source file
Revert "spec file reflects the atomic hardlinking patch; removed cleaning buildroot (redundant); current FSF address at .c source file"
spec file reflects the atomic hardlinking patch; removed cleaning buildroot (redundant); current FSF address at .c source file
Mention -f option in the man page
do not allow to hardlink files across filesystems by default (#786719) (use -f option to override)
fix possible buffer overflows, integer overflows, update man page
fix URL and remove mmap() (#676962, #672917)
- update docs to describe highest verbosity -vv option (#210816) - use dist Resolves: 210816
mostly spec cleanup
...
mount: Do not call mnt_pretty_path() on net file systems.
Calling mnt_pretty_path() on network file systems can cause mangling of
the output:
root# mount | grep nfs
nfs.example.com:/home on /home type nfs4 ...
root# mkdir -p nfs.example.com:/home
root# mount | grep nfs
/root/nfs.example.com:/home on /home type nfs4 ...
Karel Zak [Tue, 5 Feb 2019 11:06:00 +0000 (12:06 +0100)]
col: make flush_line() a little bit robust
The code is horrible. The core of the problem are signed integers
and no check for the limits.
This patch fixes c->c_column = cur_col; where c_column is "short"
and "cur_col" is int. Let's use "int" for all the variables. It's
really not perfect as for bigger lines it can segfault again...
The patch also removes some unnecessary static variables.
Addresses: https://github.com/karelzak/util-linux/issues/749 Signed-off-by: Karel Zak <kzak@redhat.com>
The HiFive Unleashed SBC's bootloader seeks for GPT partitions with
specific UUID for loading the next stage bootloader (ZSBL loads FSBL,
and FSBL loads BBL).
Karel Zak [Mon, 4 Feb 2019 13:16:11 +0000 (14:16 +0100)]
cal: use standout mode on monochrome terminals
The function colors_init() checks for colors, it means it fails
on monochrome terminals, but cal(1) in this case still need to
highlight the current day.
Reported-by: Nuno Silva <nunojsilva@ist.utl.pt> Signed-off-by: Karel Zak <kzak@redhat.com>
Peter Wu [Fri, 1 Feb 2019 14:40:53 +0000 (15:40 +0100)]
mount.8: clarify (no)suid behavior on file capabilities
Clarify that the nosuid option also affects file capabilities and that
it only limits execution of programs. (setgid on directories still
inherit the group regardless of the nosuid option.) The new text is
taken from the mount(2) manual page from the man-pages project.
Addresses: https://github.com/karelzak/util-linux/issues/482 Signed-off-by: Peter Wu <peter@lekensteyn.nl>
Karel Zak [Wed, 23 Jan 2019 10:41:43 +0000 (11:41 +0100)]
logger: concatenate multiple lines of MESSAGE into a single field.
this is deemed a useful special case since journalctl will only show
either the first or last element of the message array if the field
appears multiple times.
Based on patch from: Kjetil Torgrim Homme <kjetil.homme@redpill-linpro.com>
https://github.com/karelzak/util-linux/pull/743
Addresses: https://github.com/karelzak/util-linux/issues/742 Signed-off-by: Karel Zak <kzak@redhat.com>
Karel Zak [Tue, 22 Jan 2019 11:33:19 +0000 (12:33 +0100)]
libblkid: remove dependence on libuuid
Currently we use libuuid to print UUID only. This code is possible to replace
by one snprintf(). It seems better to duplicate this one snprintf than force
all distros to keep libuuid together with libblkid.
Note, this scenario has been already supported on --disable-libuuid.
Reported-by: Josh Triplett <josh@joshtriplett.org> Signed-off-by: Karel Zak <kzak@redhat.com>
Andreas Schwab [Sat, 19 Jan 2019 22:18:16 +0000 (23:18 +0100)]
setarch: don't return address of automatic variable
On architectures without special personalities setarch uses the contents
of a local variable with automatic storage duration after return from
the function, causing it to report a spurious error.
$ setarch m68k
setarch: Kernel cannot set architecture to m68k
Signed-off-by: Andreas Schwab <schwab@linux-m68k.org>
Karel Zak [Tue, 22 Jan 2019 10:50:20 +0000 (11:50 +0100)]
losetup: properly use --sector-size when create a new device
The --partscan functionality depends on sector size. Make sure
sector size is set before we force kernel to scan the device for
partitions. For example:
Karel Zak [Tue, 22 Jan 2019 10:12:42 +0000 (11:12 +0100)]
lib/loopdev: differentiate between setter()s and ioctl calls
Now the internal API uses loopcxt_set_...() to set context variables
as well as to call ioctls. This patch introduces loopcxt_ioctl_...()
to makes things more obvious to readers.
Karel Zak [Tue, 22 Jan 2019 09:13:54 +0000 (10:13 +0100)]
swapon: be more explicit about BTRFS
It seems nocow and nodatasum attributes are required.
See btrfs_swap_activate() in https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=ed46ff3d423780fa5173b38a844bf0fdb210a2a7
Addresses: https://github.com/karelzak/util-linux/issues/633 Signed-off-by: Karel Zak <kzak@redhat.com>
Karel Zak [Mon, 14 Jan 2019 11:04:04 +0000 (12:04 +0100)]
Merge branch 'time-fixes' of https://github.com/kerolasa/util-linux
* 'time-fixes' of https://github.com/kerolasa/util-linux:
fsck.cramfs: use utimes() instead of utime() that is obsolete
hwclock: use monotonic time to measure how long setting time takes
include: add indirect monotonic clock id specifier
timeutils: match today day and this year correctly
Sami Kerola [Mon, 7 Jan 2019 21:34:11 +0000 (21:34 +0000)]
hwclock: use monotonic time to measure how long setting time takes
Earlier gettimeofday() was affected by discontinuous jumps. Measuring how
long time it takes to set time using function that effected by the very
thing being measured makes head spin. Lets make this less confusing with
monotonic clock that ticks on without jumps.
Sami Kerola [Sat, 5 Jan 2019 21:32:23 +0000 (21:32 +0000)]
timeutils: match today day and this year correctly
Assumption all years since 1970 have been exactly 365 days long has it's
problems when leap years happen. Lets use struct tm fields that are
provided by localtime_r(), making year and day to be correctly compared even
when it's late new years eve somewhere else than UTC-0.
Stanislav Brabec [Thu, 10 Jan 2019 00:28:54 +0000 (01:28 +0100)]
su-common.c: prefer ENV_SUPATH over ENV_ROOTPATH
ENV_SUPATH and ENV_ROOTPATH are equivalent and ENV_ROOTPATH takes
precedence in both login and su. It makes no sense. More logical would be
precedence of ENV_SUPATH in su and ENV_ROOTPATH in login.
Stanislav Brabec [Thu, 10 Jan 2019 00:28:53 +0000 (01:28 +0100)]
su-common.c: prefer /etc/default/su over login.defs
su(1) documentation says:
/etc/default/su command specific logindef config file
/etc/login.defs global logindef config file
It indirectly indicates that /etc/default/su should take precedence
over /etc/login.defs.
But the reverse is true. It is not possible to define ENV_PATH in
/etc/login.defs and then make su specific customization in
/etc/default/su. We need to change read order to match the documented
behavior.
Karel Zak [Tue, 8 Jan 2019 11:07:18 +0000 (12:07 +0100)]
libblkid: improve whole-disk detection when read /proc/partitions
blkid(8) in high-level mode checks partitions and unpartitioned
whole-disk devices from the file /proc/partitions.
The current heuristic assumes that partition name ends with a digit.
Unfortunately, this is not correct -- for example md0 or nvme0n1 are
whole-disk devices.
This commit uses sysfs_devno_is_wholedisk() to make sure the device is
a partition (according to kernel or DM). It's probably more expensive,
because this way requires more syscalls (to read stuff from /sys etc.).
The patch also adds more information to the blkid(8) man page.
Addresses: https://github.com/karelzak/util-linux/issues/728 Signed-off-by: Karel Zak <kzak@redhat.com>
Karel Zak [Wed, 2 Jan 2019 13:20:21 +0000 (14:20 +0100)]
Merge branch 'master' of https://github.com/kvanals/util-linux
* 'master' of https://github.com/kvanals/util-linux:
Removed BlueStore VERSION information as it is gibberish
Updated BlueStore expected result
Added BlueStore test image
dmesg: correct "-n, --console-level level" example in manual page
When providing an abbreviation of the level name with the option "-n, --console-level level",
it corresponds to the level (included) up to which messages are displayed on the console.
If a level number is given, this level is excluded.
So in the given example, "-n 1" is equivalent to "-n emerg".
Karel Zak [Wed, 12 Dec 2018 11:14:39 +0000 (12:14 +0100)]
mkswap: use dd(1) in example rather than fallocate(1)
The man page warns against fallocate on some filesystems and recommends
dd(1) as the most portable solution. So, let's use dd(1) also in the
example used in the same man page.
Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=1203378 Signed-off-by: Karel Zak <kzak@redhat.com>
Jeremy Linton [Tue, 11 Dec 2018 18:27:29 +0000 (12:27 -0600)]
lscpu: Add aarch32 detection on aarch64
aarch32 support is an optional feature of ARMv8, as CPUs
which don't support aarch32 become more common, lets make
sure that lscpu can tell a user quickly if they are on a
machine that only supports 64-bit.
Signed-off-by: Jeremy Linton <lintonrjeremy@gmail.com>