]> git.ipfire.org Git - thirdparty/util-linux.git/log
thirdparty/util-linux.git
9 years agofdisk: fix and improve -l warnings
Karel Zak [Fri, 7 Nov 2014 09:42:49 +0000 (10:42 +0100)] 
fdisk: fix and improve -l warnings

Signed-off-by: Karel Zak <kzak@redhat.com>
9 years agosfdisk: fix version typos in man page
Karel Zak [Fri, 7 Nov 2014 08:33:57 +0000 (09:33 +0100)] 
sfdisk: fix version typos in man page

Reported-by: JWP <elseifthen@gmx.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
9 years agoswitch_root: improve statfs->f_type portability
Karel Zak [Thu, 6 Nov 2014 11:50:27 +0000 (12:50 +0100)] 
switch_root: improve statfs->f_type portability

__SWORD_TYPE is not available everywhere, for example it's not defined
by musl libc. It also seems that __SWORD_TYPE is not used for f_type
on some architectures (s390x).

Reported-by: Natanael Copa <ncopa@alpinelinux.org>
Signed-off-by: Karel Zak <kzak@redhat.com>
9 years agolib/loopdev: remove test program
Karel Zak [Tue, 4 Nov 2014 14:36:05 +0000 (15:36 +0100)] 
lib/loopdev: remove test program

All is already covered by losetup and mount. The test program has
never been used in our regression tests.

Signed-off-by: Karel Zak <kzak@redhat.com>
9 years agolib/loopdev: replace custom DBG() with include/debug.h
Karel Zak [Tue, 4 Nov 2014 13:08:45 +0000 (14:08 +0100)] 
lib/loopdev: replace custom DBG() with include/debug.h

Signed-off-by: Karel Zak <kzak@redhat.com>
9 years agotests: cleanup libmount debug test
Karel Zak [Mon, 3 Nov 2014 12:54:40 +0000 (13:54 +0100)] 
tests: cleanup libmount debug test

Signed-off-by: Karel Zak <kzak@redhat.com>
9 years agodocs: update info about env debug variables
Karel Zak [Mon, 3 Nov 2014 12:13:54 +0000 (13:13 +0100)] 
docs: update info about env debug variables

Signed-off-by: Karel Zak <kzak@redhat.com>
9 years agolibfdisk: clean up debug, add help debug mask
Karel Zak [Mon, 3 Nov 2014 12:13:32 +0000 (13:13 +0100)] 
libfdisk: clean up debug, add help debug mask

Signed-off-by: Karel Zak <kzak@redhat.com>
9 years agolibsmartcols: clean up debug, add help debug mask
Karel Zak [Mon, 3 Nov 2014 12:13:22 +0000 (13:13 +0100)] 
libsmartcols: clean up debug, add help debug mask

Signed-off-by: Karel Zak <kzak@redhat.com>
9 years agolibmount: clean up debug, add help debug mask
Karel Zak [Mon, 3 Nov 2014 12:13:12 +0000 (13:13 +0100)] 
libmount: clean up debug, add help debug mask

Signed-off-by: Karel Zak <kzak@redhat.com>
9 years agolibblkid: clean up debug, add "help" debug mask
Karel Zak [Mon, 3 Nov 2014 12:12:20 +0000 (13:12 +0100)] 
libblkid: clean up debug, add "help" debug mask

Signed-off-by: Karel Zak <kzak@redhat.com>
9 years agoinclude/debug: improve and cleanup
Karel Zak [Mon, 3 Nov 2014 11:51:17 +0000 (12:51 +0100)] 
include/debug: improve and cleanup

* 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>
9 years agoswapon: improve man page notes about holes
Karel Zak [Mon, 3 Nov 2014 09:11:58 +0000 (10:11 +0100)] 
swapon: improve man page notes about holes

Signed-off-by: Karel Zak <kzak@redhat.com>
9 years agoswapon: remove extra word from usage
Karel Zak [Fri, 31 Oct 2014 09:58:27 +0000 (10:58 +0100)] 
swapon: remove extra word from usage

Reported-by: Benno Schulenberg <bensberg@justemail.net>
Signed-off-by: Karel Zak <kzak@redhat.com>
9 years agofindmnt: document --uniq option in man page
Bernhard Voelker [Fri, 31 Oct 2014 07:22:00 +0000 (08:22 +0100)] 
findmnt: document --uniq option in man page

* misc-utils/findmnt.8: Add an entry for the -U, --uniq option
added in commit v2.24-132-gbebdda3.

9 years agohexdump: use 'll' format modifier instead of the non-standard 'q'.
Natanael Copa [Wed, 29 Oct 2014 09:04:27 +0000 (09:04 +0000)] 
hexdump: use 'll' format modifier instead of the non-standard 'q'.

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>
9 years agolibmount: improve kernel command line parsing
Mike Frysinger [Wed, 29 Oct 2014 04:19:03 +0000 (00:19 -0400)] 
libmount: improve kernel command line parsing

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>
9 years agotextual: slice up the usage text of swapon for ease of translation
Benno Schulenberg [Mon, 27 Oct 2014 21:18:12 +0000 (22:18 +0100)] 
textual: slice up the usage text of swapon for ease of translation

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>
9 years agodocs: fix some wording and formatting in man page of swapon
Benno Schulenberg [Mon, 27 Oct 2014 21:18:11 +0000 (22:18 +0100)] 
docs: fix some wording and formatting in man page of swapon

Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
9 years agodocs: spelling, wording, and grammar fixes in the man page of whereis
Benno Schulenberg [Mon, 27 Oct 2014 21:18:10 +0000 (22:18 +0100)] 
docs: spelling, wording, and grammar fixes in the man page of whereis

Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
9 years agobash-completion: use swapon label and uuid listing support
Sami Kerola [Sun, 26 Oct 2014 22:07:09 +0000 (22:07 +0000)] 
bash-completion: use swapon label and uuid listing support

Simplifies the script, and makes swapoff to work for files when get
requests by label or uuid.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
9 years agobash-completion: stop being clever when listing block devices
Sami Kerola [Sun, 26 Oct 2014 22:07:08 +0000 (22:07 +0000)] 
bash-completion: stop being clever when listing block devices

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>
9 years agofstrim: initialize path variable
Sami Kerola [Sun, 26 Oct 2014 22:07:07 +0000 (22:07 +0000)] 
fstrim: initialize path variable

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>
9 years agosfdisk: return deterministic value from sfdisk_deinit()
Sami Kerola [Sun, 26 Oct 2014 22:07:06 +0000 (22:07 +0000)] 
sfdisk: return deterministic value from sfdisk_deinit()

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>
9 years agobash-completion: fix runuser install
Mike Frysinger [Fri, 24 Oct 2014 16:26:12 +0000 (12:26 -0400)] 
bash-completion: fix runuser install

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>
9 years agobuild-sys: properly check for -lrt
Karel Zak [Mon, 27 Oct 2014 10:05:06 +0000 (11:05 +0100)] 
build-sys: properly check for -lrt

Signed-off-by: Karel Zak <kzak@redhat.com>
9 years agobuild-sys: old glibc requires -lrt clock_gettime()
Karel Zak [Mon, 27 Oct 2014 09:47:32 +0000 (10:47 +0100)] 
build-sys: old glibc requires -lrt clock_gettime()

Signed-off-by: Karel Zak <kzak@redhat.com>
9 years agoblkdiscard: fix includes
Karel Zak [Mon, 27 Oct 2014 09:00:19 +0000 (10:00 +0100)] 
blkdiscard: fix includes

Signed-off-by: Karel Zak <kzak@redhat.com>
9 years agoblkdiscard: update man page
Karel Zak [Mon, 27 Oct 2014 08:42:51 +0000 (09:42 +0100)] 
blkdiscard: update man page

Signed-off-by: Karel Zak <kzak@redhat.com>
9 years agoblkdiscard: add support for steps and progress
Federico Simoncelli [Fri, 24 Oct 2014 15:13:55 +0000 (15:13 +0000)] 
blkdiscard: add support for steps and progress

Signed-off-by: Federico Simoncelli <fsimonce@redhat.com>
9 years agoblkdiscard: fail on sector misalignment
Federico Simoncelli [Fri, 24 Oct 2014 15:13:54 +0000 (15:13 +0000)] 
blkdiscard: fail on sector misalignment

9 years agotests: add blkdiscard offsets test
Federico Simoncelli [Fri, 24 Oct 2014 15:13:53 +0000 (15:13 +0000)] 
tests: add blkdiscard offsets test

Signed-off-by: Federico Simoncelli <fsimonce@redhat.com>
9 years agoinclude/debug: fix typo
Karel Zak [Fri, 24 Oct 2014 09:19:23 +0000 (11:19 +0200)] 
include/debug: fix typo

Signed-off-by: Karel Zak <kzak@redhat.com>
9 years agoblkid: remove extra trailing spaces in output
Karel Zak [Thu, 23 Oct 2014 12:43:31 +0000 (14:43 +0200)] 
blkid: remove extra trailing spaces in output

$  blkid | egrep -i 'sda.*label' | cat -A
/dev/sda2: UUID="8382f307-fb43-489f-ab38-8d4cf37ca88c" SEC_TYPE="ext2" TYPE="ext3" LABEL="test" $
/dev/sda5: UUID="0b46d673-8c23-4709-b92c-3fdf460e1dd4" TYPE="ext3" LABEL="rescue" SEC_TYPE="ext2" $
/dev/sda6: UUID="cb9d814f-d885-435b-8e6d-ac17c0ac5aa1" TYPE="ext3" LABEL="root" $
/dev/sda8: UUID="1e2851bd-cc6f-4d72-bf9f-c6fa754155b1" TYPE="ext3" LABEL="data" SEC_TYPE="ext2" $
/dev/sda9: UUID="d16a2f42-9a50-4489-a788-8624c832a7f3" TYPE="ext3" LABEL="storage" SEC_TYPE="ext2" $
/dev/sda7: TYPE="swap" LABEL="swap" UUID="8393acfa-d4bd-40fc-8eb9-5ccd8d85e103" $

Addresses: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=586179
Signed-off-by: Karel Zak <kzak@redhat.com>
9 years agowhereis: reset search mask more carefully
Karel Zak [Thu, 23 Oct 2014 12:29:45 +0000 (14:29 +0200)] 
whereis: reset search mask more carefully

 # 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>
9 years agowhereis: cleanup debug stuff, fix argv[] usage
Karel Zak [Thu, 23 Oct 2014 11:44:00 +0000 (13:44 +0200)] 
whereis: cleanup debug stuff, fix argv[] usage

* 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>
9 years agofdisk: add section about sizes to the man page
Karel Zak [Thu, 23 Oct 2014 10:03:31 +0000 (12:03 +0200)] 
fdisk: add section about sizes to the man page

Addresses: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=594005
Signed-off-by: Karel Zak <kzak@redhat.com>
9 years agodocs: remove obsolete READMEs for (s)fdisk
Karel Zak [Thu, 23 Oct 2014 09:35:18 +0000 (11:35 +0200)] 
docs: remove obsolete READMEs for (s)fdisk

9 years agoterminal-colors.d: add debug stuff
Karel Zak [Wed, 22 Oct 2014 15:25:19 +0000 (17:25 +0200)] 
terminal-colors.d: add debug stuff

Signed-off-by: Karel Zak <kzak@redhat.com>
9 years agoterminal-colors.d: fix filter by name
Karel Zak [Wed, 22 Oct 2014 14:36:55 +0000 (16:36 +0200)] 
terminal-colors.d: fix filter by name

Addresses: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=766077
Signed-off-by: Karel Zak <kzak@redhat.com>
9 years agodocs: update TODO file
Karel Zak [Wed, 22 Oct 2014 08:34:09 +0000 (10:34 +0200)] 
docs: update TODO file

Signed-off-by: Karel Zak <kzak@redhat.com>
9 years agodocs: update TODO file
Karel Zak [Tue, 21 Oct 2014 12:24:00 +0000 (14:24 +0200)] 
docs: update TODO file

Signed-off-by: Karel Zak <kzak@redhat.com>
9 years agohwclock: Reduce drift factor update period
J William Piggott [Mon, 20 Oct 2014 19:22:24 +0000 (15:22 -0400)] 
hwclock: Reduce drift factor update period

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>
9 years agohwclock: fix superfluous 'if' statement and typo
J William Piggott [Mon, 20 Oct 2014 18:48:07 +0000 (14:48 -0400)] 
hwclock: fix superfluous 'if' statement and typo

Signed-off-by: J William Piggott <elseifthen@gmx.com>
9 years agohwclock: adjust wording of v2.26 notes
J William Piggott [Mon, 20 Oct 2014 18:07:27 +0000 (14:07 -0400)] 
hwclock: adjust wording of v2.26 notes

Signed-off-by: J William Piggott <elseifthen@gmx.com>
9 years agosfdisk: fix compiler warnings about uninitialized variables
Sami Kerola [Wed, 15 Oct 2014 21:19:28 +0000 (22:19 +0100)] 
sfdisk: fix compiler warnings about uninitialized variables

warning: 'str' may be used uninitialized in this function [-Wmaybe-uninitialized]

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
9 years agoul: fix filter() indentation
Sami Kerola [Wed, 15 Oct 2014 21:19:27 +0000 (22:19 +0100)] 
ul: fix filter() indentation

Content of the while() loop missed one indentation step.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
9 years agosetterm: fix dubious one-bit signed bitfield [smatch scan]
Sami Kerola [Wed, 15 Oct 2014 21:19:26 +0000 (22:19 +0100)] 
setterm: fix dubious one-bit signed bitfield [smatch scan]

term-utils/setterm.c:165:24: error: dubious one-bit signed bitfield

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
9 years agoeject: move unreachable code to preprocessor #else block [smatch scan]
Sami Kerola [Wed, 15 Oct 2014 21:19:25 +0000 (22:19 +0100)] 
eject: move unreachable code to preprocessor #else block [smatch scan]

eject.c:466 toggle_tray() info: ignoring unreachable code.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
9 years agohwclock: add notes about default behavior changes
Karel Zak [Mon, 20 Oct 2014 12:01:25 +0000 (14:01 +0200)] 
hwclock: add notes about default behavior changes

Signed-off-by: Karel Zak <kzak@redhat.com>
9 years agohwclock: cleanup man and usage()
Karel Zak [Mon, 20 Oct 2014 11:31:36 +0000 (13:31 +0200)] 
hwclock: cleanup man and usage()

Signed-off-by: Karel Zak <kzak@redhat.com>
9 years agoMerge branch 'master' of https://github.com/jwpi/util-linux into hwclock
Karel Zak [Mon, 20 Oct 2014 09:41:38 +0000 (11:41 +0200)] 
Merge branch 'master' of https://github.com/jwpi/util-linux into hwclock

9 years agoswapon: add -o <list> for compatibility with mount
Karel Zak [Mon, 20 Oct 2014 08:59:08 +0000 (10:59 +0200)] 
swapon: add -o <list> for compatibility with mount

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>
9 years agomount: don't ignore mtab for --bind -o remount
Karel Zak [Fri, 17 Oct 2014 06:52:00 +0000 (08:52 +0200)] 
mount: don't ignore mtab for --bind -o remount

Reported-by: Phillip Susi <psusi@ubuntu.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
9 years agolibfdisk: add more comments
Karel Zak [Thu, 16 Oct 2014 11:15:06 +0000 (13:15 +0200)] 
libfdisk: add more comments

Signed-off-by: Karel Zak <kzak@redhat.com>
9 years agohwclock: Add --update-drift option MAN
J William Piggott [Wed, 15 Oct 2014 20:14:37 +0000 (16:14 -0400)] 
hwclock: Add --update-drift option MAN

Update hwclock man page for the
hwclock: Add --update-drift option patch.

Signed-off-by: J William Piggott <elseifthen@gmx.com>
9 years agohwclock: Add --update-drift option
J William Piggott [Wed, 15 Oct 2014 19:48:17 +0000 (15:48 -0400)] 
hwclock: Add --update-drift option

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>
9 years agohwclock: persistent_clock_is_local MAN
J William Piggott [Thu, 25 Sep 2014 14:31:54 +0000 (10:31 -0400)] 
hwclock: persistent_clock_is_local MAN

Update hwclock man page for the
hwclock: persistent_clock_is_local patch.

Signed-off-by: J William Piggott <elseifthen@gmx.com>
9 years agohwclock: persistent_clock_is_local
J William Piggott [Thu, 25 Sep 2014 11:38:25 +0000 (07:38 -0400)] 
hwclock: persistent_clock_is_local

When hctosys is used at boot time, making it the
first caller of settimeofday, the responsibility
of setting persistent_clock_is_local is thrust
upon it.  Currently hctosys always leaves this
variable uninitialized.  This causes a Hardware
Clock configured to use the local timescale to be
clobbered with the UTC timescale by the kernel's
NTP eleven minute mode.

This patch fixes this hctosys bug, by having it
properly set persistent_clock_is_local according
to the time scale configured for the Hardware
Clock.

It does this via the kernel warp_clock function
but this in inconsequential, because we set the
system time immediately afterward.

Signed-off-by: J William Piggott <elseifthen@gmx.com>
9 years agohwclock: hctosys drift compensation II MAN
J William Piggott [Wed, 15 Oct 2014 18:37:08 +0000 (14:37 -0400)] 
hwclock: hctosys drift compensation II MAN

Update hwclock man page for the
hwclock: hctosys drift compensation II patch.

Signed-off-by: J William Piggott <elseifthen@gmx.com>
9 years agohwclock: hctosys drift compensation II COMMENTS
J William Piggott [Wed, 15 Oct 2014 18:32:31 +0000 (14:32 -0400)] 
hwclock: hctosys drift compensation II COMMENTS

Update source comments and --help output for the
hwclock: hctosys drift compensation II patch.

Signed-off-by: J William Piggott <elseifthen@gmx.com>
9 years agohwclock: hctosys drift compensation II
J William Piggott [Wed, 15 Oct 2014 18:21:13 +0000 (14:21 -0400)] 
hwclock: hctosys drift compensation II

Allowing hctosys to drift compensate facilitates:

More precise setting of the System Clock early in
the boot process when --adjust cannot be used
because the file system is not writeable.

Applies sub second drift corrections immediately,
where as --adjust cannot.

Reduces boot time by not calling hwclock multiple
times, e.g., --hctosys early before fsck when the
file system is read-only, then --adjust later when
the file system is read-write and --hctosys again
for drift correction.

Use of --adjust elsewhere may no longer be
necessary.

Part II

After the original submission of this patch I
realized that now all operations except --systz
require drift corrected Hardware Clock time.
Therefore, it should be done only once early in
the process. Upon implementation of that premise
many improvements were facilitated:

* Adds drift correction to --hctosys.
* Adds setting system time with sub-second precision.
* Adds --get, a drift corrected 'show' operation.
* Improves drift factor calculation precision while
   greatly simplifying its algorithm.
* Fixes --show bug, printing integer sub-seconds, and
   now uses a more intuitive positive value.
* Fixes --predict bug, drift correction must be
   negated to predict future RTC time.
* Reduces the number of function arguments and
   lines of code.

Signed-off-by: J William Piggott <elseifthen@gmx.com>
9 years agolibfdisk: cleanup parttype API
Karel Zak [Wed, 15 Oct 2014 12:10:25 +0000 (14:10 +0200)] 
libfdisk: cleanup parttype API

 * add reference counting
 * add functions to set allocated types

Signed-off-by: Karel Zak <kzak@redhat.com>
9 years agolibfdisk: cleanup partno API
Karel Zak [Wed, 15 Oct 2014 11:06:23 +0000 (13:06 +0200)] 
libfdisk: cleanup partno API

Signed-off-by: Karel Zak <kzak@redhat.com>
9 years agolibfdisk: make it possible to use zero for size and start
Karel Zak [Wed, 15 Oct 2014 10:17:40 +0000 (12:17 +0200)] 
libfdisk: make it possible to use zero for size and start

The zero may be valid size and start of the partition. This patch
introduces:

fdisk_partition_has_start()
fdisk_partition_has_size()
fdisk_partition_unset_size()
fdisk_partition_unset_start()

to make it possible to work with zero. The feature is internally
implemented by magic constant ((type) -1) for undefined sizes and
offsets.

Signed-off-by: Karel Zak <kzak@redhat.com>
9 years agotests: check for wipefs and helpers in fdisk tests
Karel Zak [Wed, 15 Oct 2014 10:11:05 +0000 (12:11 +0200)] 
tests: check for wipefs and helpers in fdisk tests

Signed-off-by: Karel Zak <kzak@redhat.com>
9 years agotests: update bsd test
Karel Zak [Tue, 14 Oct 2014 17:52:04 +0000 (19:52 +0200)] 
tests: update bsd test

Signed-off-by: Karel Zak <kzak@redhat.com>
9 years agolibfdisk: (dos) set partition start/size only when requested
Karel Zak [Tue, 14 Oct 2014 17:46:17 +0000 (19:46 +0200)] 
libfdisk: (dos) set partition start/size only when requested

9 years agotests: update fdisk formatting
Karel Zak [Tue, 14 Oct 2014 16:01:38 +0000 (18:01 +0200)] 
tests: update fdisk formatting

Signed-off-by: Karel Zak <kzak@redhat.com>
9 years agolibfdisk: cleanup context devname usage
Karel Zak [Tue, 14 Oct 2014 15:59:41 +0000 (17:59 +0200)] 
libfdisk: cleanup context devname usage

Signed-off-by: Karel Zak <kzak@redhat.com>
9 years agolibfdisk: (gpt) fix N-1 error for partition size
Karel Zak [Tue, 14 Oct 2014 15:26:27 +0000 (17:26 +0200)] 
libfdisk: (gpt) fix N-1 error for partition size

The same bug like on dos.c, the limits for the "last sector" dialog
are already with "-1".

Signed-off-by: Karel Zak <kzak@redhat.com>
9 years agotests: update fdisk formatting
Karel Zak [Tue, 14 Oct 2014 15:10:11 +0000 (17:10 +0200)] 
tests: update fdisk formatting

fdisk --list does no more use extra linebreak (\n) before
and after partition table entries.

Signed-off-by: Karel Zak <kzak@redhat.com>
9 years agolibfdisk: (dos) fix N-1 error for partition size
Karel Zak [Tue, 14 Oct 2014 14:44:54 +0000 (16:44 +0200)] 
libfdisk: (dos) fix N-1 error for partition size

Signed-off-by: Karel Zak <kzak@redhat.com>
9 years agolibfdisk: fix script unit test
Karel Zak [Tue, 14 Oct 2014 12:46:11 +0000 (14:46 +0200)] 
libfdisk: fix script unit test

Signed-off-by: Karel Zak <kzak@redhat.com>
9 years agoblkdiscard: fix err->errx()
Karel Zak [Tue, 14 Oct 2014 10:14:05 +0000 (12:14 +0200)] 
blkdiscard: fix err->errx()

Signed-off-by: Karel Zak <kzak@redhat.com>
9 years agoscript: may be hangs
Andreas Henriksson [Tue, 14 Oct 2014 10:07:21 +0000 (12:07 +0200)] 
script: may be hangs

Signed-off-by: Karel Zak <kzak@redhat.com>
9 years agoblkdiscard: fix underflow when offset is greater than device size
Raphael S. Carvalho [Thu, 9 Oct 2014 00:46:07 +0000 (21:46 -0300)] 
blkdiscard: fix underflow when offset is greater than device size

If offset (range[0]) is greater than device size (blksize), the variable 'end'
will be greater than blksize, and range[1] (length) will be recalculated.
The underflow happens when subtracting range[0] (offset) from blksize, thus
range[1] will be the result of an underflow. The bug leads to unwanted behavior
from the program, where range[1] is likely to be a high number and then will
discard a considerable amount of blocks from the device. The fix consists of
exitting the program with an error message when the condition stated above is
true. Spotted while auditing the code.

Signed-off-by: Raphael S. Carvalho <raphaelsc@cloudius-systems.com>
9 years agobuild-sys: check for libtoolize rather than libtool
Helmut Grohne [Tue, 7 Oct 2014 21:07:19 +0000 (23:07 +0200)] 
build-sys: check for libtoolize rather than libtool

The system libtool program has architecture dependent behaviour. It is
therefore unavailable in cross build environments. The only place it was
used in util-linux is autogen.sh to determine the availability of
libtool. All other places correctly use libtoolize or
$(top_builddir)/libtool.

Signed-off-by: Helmut Grohne <helmut@subdivi.de>
9 years agotextual: grammarize an informative message, and tweak some comments
Benno Schulenberg [Wed, 1 Oct 2014 19:35:17 +0000 (21:35 +0200)] 
textual: grammarize an informative message, and tweak some comments

Also add two clarifying comments for translators.

Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
9 years agolibmount: provide version as int for better compiletime test
Søren Holm [Wed, 1 Oct 2014 14:14:02 +0000 (16:14 +0200)] 
libmount: provide version as int for better compiletime test

Signed-off-by: Søren Holm <sgh@sgh.dk>
9 years agodmesg: improve reltime colors
Karel Zak [Tue, 14 Oct 2014 08:20:19 +0000 (10:20 +0200)] 
dmesg: improve reltime colors

[  +0.004034] sd 113:0:0:0: [sdb] Attached SCSI disk
[Oct10 13:04]  sdb: unknown partition table
[  +0.034011]  sdb: sdb1 sdb2 sdb3 sdb4 < sdb5 sdb6 >

.. the "Oct10 13:04" is possible to colorize by "timebreak"
scheme (default is bold green).

Signed-off-by: Karel Zak <kzak@redhat.com>
9 years agotests: add PMBR sfdisk test
Karel Zak [Mon, 13 Oct 2014 11:30:28 +0000 (13:30 +0200)] 
tests: add PMBR sfdisk test

Signed-off-by: Karel Zak <kzak@redhat.com>
9 years agotests: add sfdisk GPT tests
Karel Zak [Fri, 10 Oct 2014 10:56:45 +0000 (12:56 +0200)] 
tests: add sfdisk GPT tests

Signed-off-by: Karel Zak <kzak@redhat.com>
9 years agolibfdisk: fix script next_token()
Karel Zak [Fri, 10 Oct 2014 10:53:12 +0000 (12:53 +0200)] 
libfdisk: fix script next_token()

Signed-off-by: Karel Zak <kzak@redhat.com>
9 years agosfdisk: leave on error
Karel Zak [Fri, 10 Oct 2014 10:52:24 +0000 (12:52 +0200)] 
sfdisk: leave on error

Signed-off-by: Karel Zak <kzak@redhat.com>
9 years agolibfdisk: make script header parser more pedantic
Karel Zak [Fri, 10 Oct 2014 10:24:10 +0000 (12:24 +0200)] 
libfdisk: make script header parser more pedantic

Signed-off-by: Karel Zak <kzak@redhat.com>
9 years agotests: test cazy sizes for sfdisk
Karel Zak [Thu, 9 Oct 2014 12:08:59 +0000 (14:08 +0200)] 
tests: test cazy sizes for sfdisk

Signed-off-by: Karel Zak <kzak@redhat.com>
9 years agolibfdisk: (dos) reset logical partition stuff after error
Karel Zak [Thu, 9 Oct 2014 12:03:45 +0000 (14:03 +0200)] 
libfdisk: (dos) reset logical partition stuff after error

Signed-off-by: Karel Zak <kzak@redhat.com>
9 years agotests: update sfdisk tests
Karel Zak [Thu, 9 Oct 2014 11:21:04 +0000 (13:21 +0200)] 
tests: update sfdisk tests

Signed-off-by: Karel Zak <kzak@redhat.com>
9 years agolibfdisk: cleanup script dump
Karel Zak [Thu, 9 Oct 2014 11:03:52 +0000 (13:03 +0200)] 
libfdisk: cleanup script dump

Signed-off-by: Karel Zak <kzak@redhat.com>
9 years agosfdisk: ask on EOF
Karel Zak [Thu, 9 Oct 2014 10:23:59 +0000 (12:23 +0200)] 
sfdisk: ask on EOF

Signed-off-by: Karel Zak <kzak@redhat.com>
9 years agolibfdisk: (dos) follow explicit sizes
Karel Zak [Thu, 9 Oct 2014 10:10:36 +0000 (12:10 +0200)] 
libfdisk: (dos) follow explicit sizes

* this patch add to dos driver support for fdisk_partition->size_explicit
  to avoid unexpected last sector alignment for sizes explicitly specified
  in sectors

* add support for small "first LBA", the current default is to use
  1MiB offset for the first partition and for each EBR. This is not
  backwardly compatible and it makes impossible to apply sfdisk
  scripts/dumps from old systems, because original offset can be
  smaller than 2048 sectors (old sfdisk default is 1 sector).

  The solution is on the fly to detect this situation and change
  fdisk_context->first_lba to 1 sector. Nasty.

Signed-off-by: Karel Zak <kzak@redhat.com>
9 years agolibfdisk: (gpt) follow explicit size, fiz size+1 buf
Karel Zak [Thu, 9 Oct 2014 10:10:09 +0000 (12:10 +0200)] 
libfdisk: (gpt) follow explicit size, fiz size+1 buf

Signed-off-by: Karel Zak <kzak@redhat.com>
9 years agolibfdisk: follow explicitly specified partition size
Karel Zak [Thu, 9 Oct 2014 10:09:07 +0000 (12:09 +0200)] 
libfdisk: follow explicitly specified partition size

Signed-off-by: Karel Zak <kzak@redhat.com>
9 years agolibfdisk: add functions to play nasty games with first/last LBA
Karel Zak [Thu, 9 Oct 2014 10:06:52 +0000 (12:06 +0200)] 
libfdisk: add functions to play nasty games with first/last LBA

Signed-off-by: Karel Zak <kzak@redhat.com>
9 years agofdisk: reset cached output fields when change disk label
Karel Zak [Thu, 9 Oct 2014 10:03:32 +0000 (12:03 +0200)] 
fdisk: reset cached output fields when change disk label

Signed-off-by: Karel Zak <kzak@redhat.com>
9 years agolibfdisk: allow to specify partition size by explicit number of sectors
Karel Zak [Thu, 9 Oct 2014 10:02:17 +0000 (12:02 +0200)] 
libfdisk: allow to specify partition size by explicit number of sectors

Signed-off-by: Karel Zak <kzak@redhat.com>
9 years agolibfdisk: use skip_blank() in scripts
Karel Zak [Wed, 8 Oct 2014 11:11:59 +0000 (13:11 +0200)] 
libfdisk: use skip_blank() in scripts

Signed-off-by: Karel Zak <kzak@redhat.com>
9 years agosfdisk: cleanup isatty() usage
Karel Zak [Wed, 8 Oct 2014 11:00:56 +0000 (13:00 +0200)] 
sfdisk: cleanup isatty() usage

Signed-off-by: Karel Zak <kzak@redhat.com>
9 years agolibfdisk: (dos) don't inform about logical partition
Karel Zak [Wed, 8 Oct 2014 11:00:19 +0000 (13:00 +0200)] 
libfdisk: (dos) don't inform about logical partition

Signed-off-by: Karel Zak <kzak@redhat.com>