Sami Kerola [Tue, 1 Jul 2014 20:40:04 +0000 (21:40 +0100)]
swapon: share get_swap_prober() with swaplabel to print uuid and label
The swapon(8) listing was almost complete, apart from label and uuid.
This change moves the code from swaplabel(8) to shared scope to be used
for printouts in other swap commands, such as swapon.
Adding this feature to lsblk(8) was a consideration, but lsblk is not
interested of swapfiles, so the swapon seems like a better option to add
this information.
Karel Zak [Tue, 22 Jul 2014 10:12:52 +0000 (12:12 +0200)]
Merge branch 'rename' of git://github.com/kerolasa/lelux-utiliteetit
* 'rename' of git://github.com/kerolasa/lelux-utiliteetit:
tests: add rename(1) return value check
rename: use function pointer to select file or symlink operation
rename: continue despite something failed
tests: add rename(1) checks
tests: use ts_cd everywhere to change direcrory
tests: add function to change directory reliable way
rename: allow renaming in subdirectories
docs: bring eight more man pages closer to standard formatting
Also, for chcpu, the options -c, -d, -e and -g are mutually exclusive,
and for the mode argument the option -p is not optional. For ldattach,
use the standard options separator ", " instead of the unusual " | ".
And add the missing --version to several of the pages. Besides, improve
the wording and the consistency of the spacing.
Sami Kerola [Sun, 22 Jun 2014 09:20:54 +0000 (10:20 +0100)]
tests: add function to change directory reliable way
Without arguments bash cd will move to $HOME. Ensure also that when
directory is assumed to be changed the current directory and intented
destination are the same location.
Reference: http://www.spinics.net/lists/util-linux-ng/msg09509.html Signed-off-by: Sami Kerola <kerolasa@iki.fi>
Sami Kerola [Sun, 25 May 2014 21:17:25 +0000 (22:17 +0100)]
rename: allow renaming in subdirectories
Earlier the rename(1) considered path as possible string to be renamed,
could lead to an issue with none existing destination. See below for
demonstration of this issue. After this change all directory elements
are ignored when the match finding happens.
$ cd $(mktemp -d)
$ mkdir aa ab
$ touch a{a,b}/aa
$ rename -v a x */aa
rename: aa/aa: rename to xa/aa failed: No such file or directory
Karel Zak [Thu, 17 Jul 2014 15:17:46 +0000 (17:17 +0200)]
lsblk: check number of used columns
The current code does not check size of the columns[] array when add
the next on command line specified column. We check the array size for
"-o <columns>" but not for another options.
Old version:
$ for x in $(seq 0 100); do echo "-t"; done | xargs lsblk
xargs: lsblk: terminated by signal 11
new version:
$ for x in $(seq 0 100); do echo "-t"; done | xargs lsblk
lsblk: too many columns specified, the limit is 83 columns.
docs: bring four more man pages closer to standard formatting
In the IPC man pages strictly adhere to the memory, queue, semaphore
order, to reduce disorientation. And for 'ipcmk', the arguments for
-M and -S and -p are not optional. Add --version for 'mountpoint'.
Sami Kerola [Wed, 16 Jul 2014 20:54:57 +0000 (21:54 +0100)]
fallocate: avoid unnecessary computation
Where POSIX_FADV_SEQUENTIAL and HAVE_POSIX_FADVISE are not available it
is waste of resources to have variables that are meaningful only for
posix_fadvise(). Also initialize the variables immediately to correct
values, and since cachesz is never changed mark it read only.
Using angular brackets around each individual argument, indenting a
continuation line, not using a space before =, improving some wordings,
and the argument of --queue is a value (a piece of data), not a signal.
Karel Zak [Mon, 14 Jul 2014 14:03:48 +0000 (16:03 +0200)]
Merge branch 'minor-fixes' of git://github.com/kerolasa/lelux-utiliteetit
* 'minor-fixes' of git://github.com/kerolasa/lelux-utiliteetit:
lscpu: avoid double free
libsmartcols: avoid variable dereference after release
libfdisk: do not do the same thing twice in single if statement
whereis: avoid printing uninitialized string
setpriv: avoid alloca() use xmalloc() instead
dmesg: avoid unnecessary variable assignment
fdisk: avoid code duplication
mkfs.cramfs: use defined failure name rather than magic value
fdformat: match variable and print format types
cfdisk: add braces to ensure operation order
lscpu: avoid use of bzero() in favor of memset()
setterm: remove unnecessary variable
cal: remove unnused structure and definition
textual: fix some typos
The Debian package checking tool lintian thinks that the script is
missing Requires on $remote_fs because it pokes at stuff under /usr
and it's probably right.
Signed-off-by: Andreas Henriksson <andreas@fatal.se>
Sami Kerola [Wed, 9 Jul 2014 20:49:03 +0000 (21:49 +0100)]
kill: use --queue option argument as sigval integer value
The sigqueue(3) takes two values, signal and sigval. Contents of the
signal can be altered with --signal option argument, so the --queue
argument should be reserved to affect sigval_int.
Sami Kerola [Sun, 13 Jul 2014 16:58:36 +0000 (17:58 +0100)]
setpriv: avoid alloca() use xmalloc() instead
The getgroups() can return up to NGROUPS_MAX supplementary groups, that
is (since kernel 2.6.3) 65536 in total. The git_t is 4 bytes, so maximum
request is 256 kilobytes. When a system happen to have memory preasure
alloca() may not be able to allocate enough memory, making debugging
unnecessarily difficult. IMHO 64 pages is significant enough amount of
memory to be properly error checked at a time of allocation.
Reference: http://www.gnu.org/software/libc/manual/html_node/Disadvantages-of-Alloca.html Signed-off-by: Sami Kerola <kerolasa@iki.fi>