Commit Graph

8684 Commits

Author SHA1 Message Date
Federico Simoncelli c472a7e35a blkdiscard: add support for steps and progress
Signed-off-by: Federico Simoncelli <fsimonce@redhat.com>
2014-10-27 09:16:49 +01:00
Federico Simoncelli d7ce9acb33 blkdiscard: fail on sector misalignment 2014-10-27 09:16:47 +01:00
Federico Simoncelli f4822fdfc5 tests: add blkdiscard offsets test
Signed-off-by: Federico Simoncelli <fsimonce@redhat.com>
2014-10-27 09:16:46 +01:00
Karel Zak 819d9a2975 include/debug: fix typo
Signed-off-by: Karel Zak <kzak@redhat.com>
2014-10-24 11:19:23 +02:00
Karel Zak 16714abef2 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>
2014-10-23 14:43:31 +02:00
Karel Zak f4802c9011 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>
2014-10-23 14:29:45 +02:00
Karel Zak 3635f53ca2 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>
2014-10-23 13:44:00 +02:00
Karel Zak fd211531e8 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>
2014-10-23 12:11:50 +02:00
Karel Zak 2ceaf42a2d docs: remove obsolete READMEs for (s)fdisk 2014-10-23 11:35:18 +02:00
Karel Zak b73cc3902b terminal-colors.d: add debug stuff
Signed-off-by: Karel Zak <kzak@redhat.com>
2014-10-22 17:25:19 +02:00
Karel Zak eb728f96aa 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>
2014-10-22 16:36:55 +02:00
Karel Zak 65c3359633 docs: update TODO file
Signed-off-by: Karel Zak <kzak@redhat.com>
2014-10-22 10:34:09 +02:00
Karel Zak 04c107ebeb docs: update TODO file
Signed-off-by: Karel Zak <kzak@redhat.com>
2014-10-21 14:24:00 +02:00
J William Piggott bbb4c273e9 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>
2014-10-20 15:22:24 -04:00
J William Piggott 66af1c0f44 hwclock: fix superfluous 'if' statement and typo
Signed-off-by: J William Piggott <elseifthen@gmx.com>
2014-10-20 14:48:07 -04:00
J William Piggott 5cb71d2bca hwclock: adjust wording of v2.26 notes
Signed-off-by: J William Piggott <elseifthen@gmx.com>
2014-10-20 14:07:27 -04:00
Sami Kerola f0f2be20ed 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>
2014-10-20 14:07:21 +02:00
Sami Kerola d07b223788 ul: fix filter() indentation
Content of the while() loop missed one indentation step.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2014-10-20 14:07:20 +02:00
Sami Kerola d8c1fc7ac4 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>
2014-10-20 14:07:19 +02:00
Sami Kerola 6f7f155c0c 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>
2014-10-20 14:07:18 +02:00
Karel Zak 732ac3a52a hwclock: add notes about default behavior changes
Signed-off-by: Karel Zak <kzak@redhat.com>
2014-10-20 14:01:25 +02:00
Karel Zak fc56c36368 hwclock: cleanup man and usage()
Signed-off-by: Karel Zak <kzak@redhat.com>
2014-10-20 13:31:36 +02:00
Karel Zak e2c1eb9913 Merge branch 'master' of https://github.com/jwpi/util-linux into hwclock 2014-10-20 11:41:38 +02:00
Karel Zak e07fdac476 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>
2014-10-20 10:59:08 +02:00
Karel Zak ba986e815c mount: don't ignore mtab for --bind -o remount
Reported-by: Phillip Susi <psusi@ubuntu.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
2014-10-17 08:53:54 +02:00
Karel Zak 7190b9b2ce libfdisk: add more comments
Signed-off-by: Karel Zak <kzak@redhat.com>
2014-10-16 13:15:06 +02:00
J William Piggott cd950279f1 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>
2014-10-15 16:15:06 -04:00
J William Piggott f276d71a3e 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>
2014-10-15 15:48:17 -04:00
J William Piggott 8db424dcbc 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>
2014-10-15 14:48:07 -04:00
J William Piggott d17a12a368 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>
2014-10-15 14:45:29 -04:00
J William Piggott cb7efbc12d 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>
2014-10-15 14:37:08 -04:00
J William Piggott ede32597f5 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>
2014-10-15 14:32:31 -04:00
J William Piggott 2794995ad9 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>
2014-10-15 14:21:13 -04:00
Karel Zak dfc6db2a35 libfdisk: cleanup parttype API
* add reference counting
 * add functions to set allocated types

Signed-off-by: Karel Zak <kzak@redhat.com>
2014-10-15 14:10:25 +02:00
Karel Zak 0123bd1a87 libfdisk: cleanup partno API
Signed-off-by: Karel Zak <kzak@redhat.com>
2014-10-15 13:06:23 +02:00
Karel Zak ecf40cda76 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>
2014-10-15 12:17:40 +02:00
Karel Zak 6311e17845 tests: check for wipefs and helpers in fdisk tests
Signed-off-by: Karel Zak <kzak@redhat.com>
2014-10-15 12:11:05 +02:00
Karel Zak 06d199e89a tests: update bsd test
Signed-off-by: Karel Zak <kzak@redhat.com>
2014-10-14 19:52:04 +02:00
Karel Zak 150d98ee3f libfdisk: (dos) set partition start/size only when requested 2014-10-14 19:46:17 +02:00
Karel Zak 38e5ef659f tests: update fdisk formatting
Signed-off-by: Karel Zak <kzak@redhat.com>
2014-10-14 18:01:38 +02:00
Karel Zak 13633a81df libfdisk: cleanup context devname usage
Signed-off-by: Karel Zak <kzak@redhat.com>
2014-10-14 17:59:41 +02:00
Karel Zak 0c344037f0 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>
2014-10-14 17:26:27 +02:00
Karel Zak 3df4adac3e 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>
2014-10-14 17:10:11 +02:00
Karel Zak a389baf116 libfdisk: (dos) fix N-1 error for partition size
Signed-off-by: Karel Zak <kzak@redhat.com>
2014-10-14 16:44:54 +02:00
Karel Zak b1c524aeed libfdisk: fix script unit test
Signed-off-by: Karel Zak <kzak@redhat.com>
2014-10-14 14:46:16 +02:00
Karel Zak 0c75b6a470 blkdiscard: fix err->errx()
Signed-off-by: Karel Zak <kzak@redhat.com>
2014-10-14 12:14:05 +02:00
Andreas Henriksson 032228c9af script: may be hangs
Signed-off-by: Karel Zak <kzak@redhat.com>
2014-10-14 12:07:21 +02:00
Raphael S. Carvalho 303884a495 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>
2014-10-14 12:04:14 +02:00
Helmut Grohne e71b0aadaa 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>
2014-10-14 12:04:11 +02:00
Benno Schulenberg 9ed38607d7 textual: grammarize an informative message, and tweak some comments
Also add two clarifying comments for translators.

Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
2014-10-14 12:03:56 +02:00