Igor Gnatenko [Sun, 24 Jan 2016 22:57:51 +0000 (23:57 +0100)]
add .editorconfig
EditorConfig is very well known config file for text editors/IDE's
with settings for project. This format supported by Vim, GNOME Builder,
Atom, Sublime and many others.
We will provide this configuration to be more friendly for newcomers.
Signed-off-by: Igor Gnatenko <i.gnatenko.brain@gmail.com>
Karel Zak [Fri, 22 Jan 2016 15:51:59 +0000 (16:51 +0100)]
libsmartcols: support multibyte titles, rename wrap to padding
- let's support multibyte table titles
- use lib/mbalign.c to align the title
- rename title_wrap to title_padding (we already use "wrap" on another
places for another things)
Karel Zak [Fri, 22 Jan 2016 12:34:05 +0000 (13:34 +0100)]
Merge branch 'table_title' of https://github.com/ignatenkobrain/util-linux
* 'table_title' of https://github.com/ignatenkobrain/util-linux:
libsmartcols: set everything once in scols_table_set_title()
libsmartcols: put new line after title
libsmartcols: fix title aligning to center
libsmartcols: don't try to align title if it's more that term
libsmartcols: use symbols for title wrap
libsmartcols: implement title of table
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.