* use ul_debug_ prefix for all routines
* support <NAME>_DEBUG=all also for programs without debug mask names
(so we can avoid 0xffff mask in man pages)
* add function to print debug help
Signed-off-by: Karel Zak <kzak@redhat.com>
The printf(3) man page says about 'q':
("quad". 4.4BSD and Linux libc5 only. Don't use.) This is a synonym for ll.
This fixes hexdump with musl libc.
Signed-off-by: Natanael Copa <ncopa@alpinelinux.org>
The current command line parser will stop at the first occurrence of an
option, however the kernel does the opposite. So if you have:
root=/dev/sda1 root=/dev/sda2
When you look for "root", the kernel will use /dev/sda2, but util-linux
uses /dev/sda1.
Further, if args are passed to custom init programs, the parser will
pick those up as kernel options. So if you have:
root=/dev/sda1 -- /foo bar=yes
The kernel will stop at the "--" and pass the rest to userland. But if
you look for "bar", util-linux will incorrectly return "yes".
Ultimately, there's no way for util-linux to exactly parse the command
line the same way as the kernel -- we don't know exactly which ones the
kernel picks up and which it passes on to userland (either as env vars
or as command line args). The kernel passes all unrecognized options.
These updates are simple best effort.
URL: https://bugs.gentoo.org/526754
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
A new option was added recently; seize this opportunity to cut the
usage text into small and easily managed chunks.
Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
Various commands such as blkid, cfdisk, fdisk, delpart, and so on listed
only partitions and missed for example disks and volume groups. The
right thing to do is to list all block devices in all for all commands
performing operations with them. This might occasionally list unexpected
devices that I think is lesser bad than missing some.
Addresses: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=764488
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
Reading the code this initialization is not necessary, so the change is
mostly about silencing a compiler warning and ensuring the program keeps
on working if there is a future bug that could make uninitialized 'path'
reachable to use.
sys-utils/fstrim.c:247: warning: 'path' may be used uninitialized in this
function
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
disk-utils/sfdisk.c:222:9: warning: variable 'rc' is uninitialized when
used here [-Wuninitialized]
return rc;
disk-utils/sfdisk.c:208:8: note: initialize the variable 'rc' to silence
this warning
int rc;
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
The runuser symlink used to depend on su being enabled, but a refactoring
broke that. So if you build with runuser enabled but not su, you end up
with a broken symlink. Rework the logic so it works in both cases.
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
# whereis -m cal -M /usr/share/man/man1/ -f ls
cal: /usr/share/man/man1/cal.1.gz /usr/share/man/man1p/cal.1p.gz
ls: /usr/bin/ls /usr/share/man/man1/ls.1.gz
the -M also resets the search mask, so for 'ls' it returns also
binaries. That's bug. Expected result is:
# ./whereis -m cal -M /usr/share/man/man1/ -f ls
cal: /usr/share/man/man1/cal.1.gz /usr/share/man/man1p/cal.1p.gz
ls: /usr/share/man/man1/ls.1.gz
the search mask has to be sensitive only to -b -m -s options,
otherwise the semantic is pretty messy.
Signed-off-by: Karel Zak <kzak@redhat.com>
* use debug stuff from include/debug.h and make whereis(1) sensitive
to WHEREIS_DEBUG=0xffff mask
* fix problem with argv[] usage
# whereis -b -m -M /usr/share/man/man1 -B /usr/bin -f gcc
bin: /usr/local/bin
gcc: /usr/bin/gcc /usr/lib/gcc /usr/libexec/gcc /usr/share/man/man1/gcc.1.gz
the code ignores "-B" and /usr/bin is interpreted as search pattern,
expected result is:
# whereis -b -m -M /usr/share/man/man1 -B /usr/bin -f gcc
gcc: /usr/share/man/man1/gcc.1.gz /usr/bin/gcc
Addresses: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=765306
Signed-off-by: Karel Zak <kzak@redhat.com>
To facilitate the calculation of 'cold' vs 'warm' Hardware Clock drift
factor the limit on the update period needs to be less than 8 hours.
4 hours should be enough drift to allow calculations that are not
grossly out of range.
For example, with a workstation that is shutdown every night the cold
drift factor can be significantly different than a drift factor based on
a 24 hour period.
Signed-off-by: J William Piggott <elseifthen@gmx.com>
The new option allows to specify swap options by fstab compatible
string. The concept is the same as for mount(8).
swapon -o pri=1,discard=pages,nofail /dev/sda2
The advantage is that tools (like systmed) that parses fstab can call
swapon without translation from fstab options to swapon(8) command
line options.
Signed-off-by: Karel Zak <kzak@redhat.com>
There are cases where we need to refresh the
timestamps in the adjtime file without updating the
drift factor.
For example, with ntpd and an Eleven Minute Mode
kernel, we need to call systohc at shutdown to
facilitate drift correction. With the current
behavior hwclock will clobber the drift factor to
near zero, because the Hardware Clock and System
Clock are synced by Eleven Minute Mode. What
actually needs to be done is refresh the adjtime
file timestamps and not calculate a new drift
factor.
Because it is a manual process to craft a good
Hardware Clock drift factor, that is, there is no
automated method that will produce a good drift
factor, this patch changes the default drift
calculation behavior to off, and it is turned on
by using the --update-drift option. Once we have a good
drift factor for a given machine we do not want
anything clobbering it, including an administrator
forgetting to turn off recalculation. A system
administrator should make a concious effort in
telling hwclock with the --update-drift option that
(s)he wants to recalculate the drift factor.
Without using the --update-drift option with calibrate
operations only the timestamps are refreshed in
the adjtime file. With the --update-drift option the old
default behavior of refreshing the timestamps and
updating the drift factor is performed.
Signed-off-by: J William Piggott <elseifthen@gmx.com>