Ruediger Meier [Tue, 15 Dec 2015 13:03:23 +0000 (14:03 +0100)]
tests: use sfdisk --no-reread wherever it's needed
The first BLKRRPART ioctl causes udev events and then second one may
fail, see Discussion
http://comments.gmane.org/gmane.linux.utilities.util-linux-ng/11885
Karel Zak [Tue, 15 Dec 2015 11:25:56 +0000 (12:25 +0100)]
login, mount: fix __SC_GETPW_R_SIZE_MAX usage
sysconf(_SC_GETPW_R_SIZE_MAX) returns initial suggested size for pwd
buffer (see getpwnam_r man page or POSIX). This is not large enough in
some cases.
Yes, this sysconf option is misnamed (should be _SC_GETPW_R_SIZE_MIN).
Ruediger Meier [Thu, 10 Dec 2015 15:56:11 +0000 (16:56 +0100)]
tests: skip nonroot before checking for progs in PATH
The least annoying and most useful order is this one:
1. check for compiled UL commands
2. check for root
3. check for loop support
4. check for external progs
Karel Zak [Thu, 10 Dec 2015 10:18:04 +0000 (11:18 +0100)]
Merge branch 'test-fixes' of https://github.com/rudimeier/util-linux
* 'test-fixes' of https://github.com/rudimeier/util-linux:
tests: use xz instead of bzip2 for blkid images
tests: add some line tests
tests: avoid sed -E
Ruediger Meier [Wed, 9 Dec 2015 12:01:51 +0000 (13:01 +0100)]
blkdiscard: don't report "zero range" at the end
We want to address the case that we have printed the last useful
stats line already within the loop. Avoiding an additional line
"Discarded 0 bytes ..." at the end.
Note there is a behavior change now for the edge cases "-v -l 0" and
"-v -o blksize" where we don't print any stats line anymore. But actually
it's correct, we never make any BLKDISCARD syscall with zero range.
Perhaps we should return error in these cases to help people who always
want to parse stats output on success.
lscpu currently prints information for CPUs configured in the system.
In case of KVM or other virtualized guest operating systems, this
refers to the virtual system, and bears no relation to the physical
topology of the system.
It would be useful if lscpu could also display the physical topology
info when available:
$ ./lscpu
Architecture: ppc64le
Byte Order: Little Endian
CPU(s): 16
On-line CPU(s) list: 0-15
Thread(s) per core: 1
Core(s) per socket: 1
Socket(s): 16
NUMA node(s): 1
Model: IBM pSeries (emulated by qemu)
Hypervisor vendor: KVM
Virtualization type: para
L1d cache: 64K
L1i cache: 32K
NUMA node0 CPU(s): 0-15
Physical sockets: 2 <<< New
Physical chips: 4 <<< New
Physical cores/chip: 4 <<< New
For now, physical topology information is available on platforms that
support the following RTAS (Real time abstraction service) call provided
by librtas:
rtas_get_sysparm(PROCESSOR_MODULE_INFO).
Currently this call is available to the PowerVM (pHYP) guests on PowerPC.
With a patch propoosed to PowerKVM, this RTAS call would also be available
to PowerKVM guests.
Based on input from Nishanth Aravamudan and Karel Zak.
Karel Zak [Mon, 30 Nov 2015 11:53:42 +0000 (12:53 +0100)]
libsmartcols: make sure we have space for ascii art
* more verbose output about columns width counting
* strlen_line() does not care about space between columns and extra
tree ASCII art. Let's assume that all termwith is possible to use
for this extra stuff, it means that maximal buffer size is
biggest_line + termwidth.
Karel Zak [Tue, 24 Nov 2015 16:44:38 +0000 (17:44 +0100)]
agetty: don't ignore netlink on select()
agetty uses NETLINK_ROUTE to be notified about network interface
changes. Unfortunately, the code that monitor the netlink FD does not
increment number of the monitored file descriptors when call
select(2), so the netlink notifications are invisible for agetty.
Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=1278906 Signed-off-by: Karel Zak <kzak@redhat.com>
Sami Kerola [Sat, 31 Oct 2015 17:29:02 +0000 (17:29 +0000)]
lib/blkdev: add open_blkdev_or_file() function
Purpose of this function is to open a path that is potentially pointing to a
block device or file without races. The function also proper open(3) flags
are used to check the device is not busy, and finally warning is been
printed if a block device happens to be misaligned.
Ming Lei [Tue, 17 Nov 2015 14:32:47 +0000 (22:32 +0800)]
losetup: support ioctl cmd of LOOP_SET_DIRECT_IO
From v4.4, linux kernel starts to support direct I/O and
AIO to backing file for loop driver, so allow losetup to
enable the feature by using LOOP_SET_DIRECT_IO ioctl cmd.
Sami Kerola [Sat, 31 Oct 2015 19:21:15 +0000 (19:21 +0000)]
fsck: retire stat(3) when access(3) does better job
The stat(3) and access(3) are in this case almost interchangeable, so choose
the lightweight function with additional advantage checking the file is
executable.
Sami Kerola [Sat, 31 Oct 2015 12:27:36 +0000 (12:27 +0000)]
logger: shadow declaration
misc-utils/logger.c:448:17: warning: declaration of 'msg' shadows a
parameter [-Wshadow]
misc-utils/logger.c:429:74: note: shadowed declaration is here
Karel Zak [Fri, 30 Oct 2015 10:08:32 +0000 (11:08 +0100)]
lib/sysfs: make sysfs_get_devname()/blkid_devno_to_wholedisk() more robust
Now the function uses result buffer for internal stuff (readlink), so
it requires that the buffer is large enough. This is unexpected as
caller assumes that the buffer has to be large enough for devname only.
References: http://www.spinics.net/lists/util-linux-ng/msg12015.html Reported-by: Tom Yan <tom.ty89@gmail.com> Signed-off-by: Karel Zak <kzak@redhat.com>
Karel Zak [Thu, 29 Oct 2015 10:18:21 +0000 (11:18 +0100)]
logger: use --id as local socket credentials
If you have really paranoid syslog (or systemd who listens on /dev/log)
then it replaces in the message PID with a real PID from socket header
credentials:
# echo $PPID
1550
# logger -p info --stderr --id=$PPID "This is message baby!"
<14>Oct 29 11:22:13 kzak[1550]: This is message baby!
# journald -n 1
Oct 29 11:22:13 ws kzak[22100]: This is message baby!
^^^^^
This patch forces kernel to accept another *valid* PID if logger(1)
executed with root permissions; improved version:
# logger -p info --stderr --id=$PPID "This is message baby!"
<14>Oct 29 11:26:00 kzak[1550]: This is message baby!
# journald -n 1
Oct 29 11:26:00 ws kzak[1550]: This is message baby!
Karel Zak [Tue, 27 Oct 2015 12:19:16 +0000 (13:19 +0100)]
logger: use iovec and sendmsg() to send message
The iovec based solutions allow to send multiple strings by one
syscall (for example additional \n messages separator). We can also
use it to send additional socket header metadata (e.g.
SCM_CREDENTIALS) later.