Boris Egorov [Tue, 19 Jan 2016 06:18:21 +0000 (12:18 +0600)]
tests: remove redundant check for NULL [cppcheck]
We set SA_SIGINFO flag, so we should not get NULL.
[tests/helpers/test_sigreceive.c:45] -> [tests/helpers/test_sigreceive.c:47]: (warning) Either the condition 'if(info)' is redundant or there is possible null pointer dereference: info.
Boris Egorov [Tue, 19 Jan 2016 05:45:15 +0000 (11:45 +0600)]
readprofile: add scanf field width limits [cppcheck]
[sys-utils/readprofile.c:301]: (warning) scanf without field width limits can crash with huge input data.
[sys-utils/readprofile.c:322]: (warning) scanf without field width limits can crash with huge input data.
Boris Egorov [Tue, 19 Jan 2016 05:42:26 +0000 (11:42 +0600)]
libblkid,libmount: Do not use void* in calculations [cppcheck]
[libblkid/src/superblocks/zfs.c:179]: (portability) 'label' is of type 'const void *'. When using void pointers in calculations, the behaviour is undefined.
[libblkid/src/superblocks/zfs.c:237]: (portability) 'label' is of type 'void *'. When using void pointers in calculations, the behaviour is undefined.
[libblkid/src/topology/topology.c:221]: (portability) 'chn.data' is of type 'void *'. When using void pointers in calculations, the behaviour is undefined.
[libmount/src/fs.c:153]: (portability) 'old' is of type 'const void *'. When using void pointers in calculations, the behaviour is undefined.
[libmount/src/fs.c:154]: (portability) 'new' is of type 'void *'. When using void pointers in calculations, the behaviour is undefined.
Boris Egorov [Tue, 19 Jan 2016 05:37:57 +0000 (11:37 +0600)]
libblkid: (zfs) add cast to fix UB [cppcheck]
[libblkid/src/superblocks/zfs.c:173]: (error) Shifting 32-bit value by 56 bits is undefined behaviour
[libblkid/src/superblocks/zfs.c:173]: (error) Shifting 32-bit value by 40 bits is undefined behaviour
Karel Zak [Mon, 18 Jan 2016 13:35:33 +0000 (14:35 +0100)]
libblkid: make minix prober more robust
It seems that the current minix probing code is not robust enough and
it returns false positive for Fedora f24 install images. The crazy thing
is that the image pass also all Linux kernel minix_fill_super() checks
and mount(2) fails later when it tries to read filesystem root
directory.
The fsck.minix requires sb->s_log_zone_size to be zero (Linux kernel
does not care about it), let's use the same requirement for libblkid.
Note, it would be possible to check minix root directory inode in
libblkid, but this solution requires minix prober specific seek &
read. We want to avoid extra read operations...
References: https://bugzilla.redhat.com/show_bug.cgi?id=1299255 Signed-off-by: Karel Zak <kzak@redhat.com>
Andrew Wilcox [Tue, 12 Jan 2016 09:35:11 +0000 (10:35 +0100)]
libfdisk: Add GPT type GUID for Itanium Linux root
References: http://www.freedesktop.org/wiki/Specifications/DiscoverablePartitionsSpec/ Signed-off-by: Andrew Wilcox <awilfox@adelielinux.org> Signed-off-by: Karel Zak <kzak@redhat.com>
Boris Egorov [Tue, 5 Jan 2016 16:17:58 +0000 (22:17 +0600)]
lib/tty: Pass default width to get_terminal_width()
Almost any code calling get_terminal_width() checks returned width for
non-positive values and sets it to some default value (say, 80). So,
let's pass this default value directly to the function.
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>