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>
Eric Rannaud [Fri, 27 Jun 2014 05:18:48 +0000 (22:18 -0700)]
findmnt: use mnt_cache_set_targets() for non-kernel table
findmnt compares the user-supplied path <target> with each entry in the
parsed table. To do this comparison, libmount attempts to canonicalize
the target path of each table entry, when the entry does not originate
from the kernel (kernel supplied target paths are already
canonicalized). However, if one of these entries is an active mount
point, stat(2) or readlink(2) on the mount target path can hang (e.g.
unreachable NFS server).
If the main table is not a kernel table, we parse /proc/self/mountinfo
into a secondary table and call mnt_cache_set_targets(). This allows
libmount to check that the target path of each entry in the main table
is not an active mount point, so it can avoid canonicalizing it.
Eric Rannaud [Fri, 27 Jun 2014 05:17:18 +0000 (22:17 -0700)]
libmount: mnt_resolve_target: tiptoe around active mount points
Current code in mnt_fs_match_target() and mnt_table_find_target()
already does not canonicalize active mount points (when read from
mountinfo), because they are already canonicalized by the kernel.
Calling realpath(fs->target) on a mount point can hang -- e.g. if the
NFS server is unreachable.
This patch optionally extends this strategy to the general case, that is
when @fs does not directly come from the kernel through mountinfo (for
instance, it may have been parsed from /etc/fstab).
Given @mtab parsed from mountinfo, and if mnt_cache_set_targets(cache,
mtab) is used, then mnt_fs_match_target() and mnt_table_find_target()
check whether @fs->target is a known mount point in the cached
mountinfo, before attempting to canonicalize @fs->target, no matter
where @fs itself comes from. If found in the cached mountinfo,
@fs->target is not canonicalized.
[kzak@redhat.com: - don't allocate libmnt_iter,
- add docs for mnt_cache_set_targets(),
- fallback to mnt_resolve_path() if no cache->mtab specified,
- use streq_except_trailing_slash() to compare paths]
Signed-off-by: Eric Rannaud <e@nanocritical.com> Signed-off-by: Karel Zak <kzak@redhat.com>
Eric Rannaud [Fri, 27 Jun 2014 05:17:17 +0000 (22:17 -0700)]
libmount: mnt_resolve_path: don't canonicalize fs->target for swap
This is how mnt_table_find_target() does it. It makes sense because
@fs->target is "none" for swap and is never a sensible match for a
user-specified target.
setterm: improve formatting and wording of usage text
Mainly: showing that the word color is a placeholder by writing
<color>, showing some numbers as optional, and message levels
and colors as not optional.
setterm: improve wording and formatting of the man page
The main changes are: showing the arguments of boolean options
as optional, improving the alphabetization, and restoring the
--half-bright option that went missing in 2011.
Karel Zak [Tue, 24 Jun 2014 08:32:25 +0000 (10:32 +0200)]
libfdisk: (dos) count fisrt usable LBA to total number of used sectors
The check() function counts number of used sectors, but it counts only
partitions. This is mistake, the area before the first partition is
also "used" place (boot loaders or we have to align the first partition
to disk I/O limits, etc).
Thorsten Wilmer [Tue, 24 Jun 2014 07:38:30 +0000 (09:38 +0200)]
libfdisk: (dos) calculation of total size based on CHS in check function
Many people report a problem with the message if (cylinders <= 1024 &&
start != total) fprintf(stderr, _("Partition %d: previous sectors %d
disagrees with " "total %d\n"), n, start, total);
This message comes from the fact that the previous code caluclates the
total number of sectors in the wrong way.
The formula should be total = (real_c * heads + h) * sectors + real_s;
As a Cylinder consists of some heads * sectors A Head consists of some
sectors and finally sectors are the smallest unit
Karel Zak [Mon, 23 Jun 2014 10:42:33 +0000 (12:42 +0200)]
libmount: special treatment for auto in fstype pattern
Let's support
mount -t ext2,auto /dev/sde /media/stick
Reported-by: Andreas Henriksson <andreas@fatal.se>
Addresses: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=506695 Signed-off-by: Karel Zak <kzak@redhat.com>
peppe [Sun, 22 Jun 2014 12:23:25 +0000 (14:23 +0200)]
hwclock: sometimes one day lasts 23 hours.
If less than 23 hours have passed since the last calibration, hwclock
says "Not adjusting drift factor because it has been less than a day since
the last calibration.", but in fact compares to 23 hours, not 24.
This was originally reported at:
https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=689534
Signed-off-by: Andreas Henriksson <andreas@fatal.se>
James Hunt [Sat, 21 Jun 2014 23:03:04 +0000 (01:03 +0200)]
script: --quiet option is not quiet.
Specifying 'script --quiet ...' still produces the 'Script started'
message in the typescript file. The --quiet option implies that the
script program should not log any of its output to the typescript file.
Originally reported at:
https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=693966
Signed-off-by: Andreas Henriksson <andreas@fatal.se>