]> git.ipfire.org Git - thirdparty/util-linux.git/log
thirdparty/util-linux.git
10 years agolib/colors: fix double free on error path
Andreas Henriksson [Wed, 19 Nov 2014 11:03:35 +0000 (12:03 +0100)] 
lib/colors: fix double free on error path

The error path was a bit unclear on the semantics. The seq argument
would get freed but not the name argument. Then the caller frees
them both when the function returns an error.
This fixes the problem my making the function not touch the arguments
unless we're going to return success. Also improve the description
for this function to make it more obvious what the callers should expect.

Addresses: CID#77487 (on scan.coverity.com for JIghtuse/util-linux)
Signed-off-by: Andreas Henriksson <andreas@fatal.se>
10 years agobuild-sys: move all around clock_gettime() to monotonic.c
Karel Zak [Wed, 19 Nov 2014 10:54:47 +0000 (11:54 +0100)] 
build-sys: move all around clock_gettime() to monotonic.c

Signed-off-by: Karel Zak <kzak@redhat.com>
10 years agobuild-sys: use CLOCKGETTIME_LIBS
Karel Zak [Wed, 19 Nov 2014 10:23:05 +0000 (11:23 +0100)] 
build-sys: use CLOCKGETTIME_LIBS

Signed-off-by: Karel Zak <kzak@redhat.com>
10 years agolibmount: fix utab entry on remount
Karel Zak [Wed, 19 Nov 2014 10:10:55 +0000 (11:10 +0100)] 
libmount: fix utab entry on remount

mount(8) command does not set ROOT= field to utab entry on remount,
for example:

mount -oremount,_netdev /mnt

Reported-by: Chris Leech <cleech@redhat.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
10 years agolibmount: add private mnt_context_get_mtab_for_target()
Karel Zak [Wed, 19 Nov 2014 10:07:40 +0000 (11:07 +0100)] 
libmount: add private mnt_context_get_mtab_for_target()

Signed-off-by: Karel Zak <kzak@redhat.com>
10 years agolibmount: reuse allocated fs in parser
Karel Zak [Wed, 19 Nov 2014 10:07:11 +0000 (11:07 +0100)] 
libmount: reuse allocated fs in parser

Signed-off-by: Karel Zak <kzak@redhat.com>
10 years agolibmount: improve mnt_reset_fs()
Karel Zak [Wed, 19 Nov 2014 10:06:24 +0000 (11:06 +0100)] 
libmount: improve mnt_reset_fs()

Signed-off-by: Karel Zak <kzak@redhat.com>
10 years agomisc: use monotonic time rater than gettimeofday
Karel Zak [Tue, 18 Nov 2014 13:35:21 +0000 (14:35 +0100)] 
misc: use monotonic time rater than gettimeofday

Based on patch Alexander Samilovskih <alexsamilovskih@gmail.com>

Signed-off-by: Karel Zak <kzak@redhat.com>
10 years agouuidd: Fixed a typo in daemon logging message
Nikolay Sivov [Tue, 18 Nov 2014 13:14:47 +0000 (14:14 +0100)] 
uuidd: Fixed a typo in daemon logging message

Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
10 years agodocs: Spelling fixes
Ville Skyttä [Sat, 15 Nov 2014 20:41:43 +0000 (22:41 +0200)] 
docs: Spelling fixes

Signed-off-by: Ville Skyttä <ville.skytta@iki.fi>
Signed-off-by: Karel Zak <kzak@redhat.com>
10 years agobash-completion: Invoke actual commands to be completed, not basenames
Ville Skyttä [Sat, 15 Nov 2014 20:36:04 +0000 (22:36 +0200)] 
bash-completion: Invoke actual commands to be completed, not basenames

Addresses partially: http://bugs.debian.org/769462
Signed-off-by: Ville Skyttä <ville.skytta@iki.fi>
10 years agoldattach: GSM0710 support, add intro modem command
Karel Zak [Tue, 18 Nov 2014 12:48:34 +0000 (13:48 +0100)] 
ldattach: GSM0710 support, add intro modem command

Patch add:
 --intro-command string  : send command to modem
 --pause value           : define delay between intro command and ldattach

Based on patch from Martin Schmid <scm@aps-systems.ch>

Signed-off-by: Karel Zak <kzak@redhat.com>
10 years agomkswap: remove memory leaks [LeakSanitizer] [valgrind]
Sami Kerola [Tue, 11 Nov 2014 21:34:30 +0000 (21:34 +0000)] 
mkswap: remove memory leaks [LeakSanitizer] [valgrind]

==18922==ERROR: LeakSanitizer: detected memory leaks

Direct leak of 8 byte(s) in 1 object(s) allocated from:
    #0 0x49d12b in __interceptor_malloc (/home/src/util-linux/.libs/lt-mkswap+0x49d12b)
    #1 0x7faf2a5069c9 in __GI___strdup (/usr/lib/libc.so.6+0x819c9)
    #2 0xffff96e7e33 (<unknown module>)

SUMMARY: AddressSanitizer: 8 byte(s) leaked in 1 allocation(s).

And another one that valgrind found.

==6316== 8 bytes in 1 blocks are definitely lost in loss record 1 of 1
==6316==    at 0x4C29F90: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==6316==    by 0x5E3F9C9: strdup (in /usr/lib/libc-2.20.so)
==6316==    by 0x43A25F: size_to_human_string (strutils.c:495)
==6316==    by 0x42B35C: main (mkswap.c:488)

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
10 years agotests: mark python libmount tests known to fail with AddressSanitizer
Sami Kerola [Sun, 9 Nov 2014 21:54:27 +0000 (21:54 +0000)] 
tests: mark python libmount tests known to fail with AddressSanitizer

The tests fail with an error similar to this.

Traceback (most recent call last):
  File "/home/src/util-linux/libmount/python/test_mount_tab_update.py", line 7, in <module>
    import pylibmount as mnt
ImportError: /home/src/util-linux/.libs/libuuid.so.1: undefined symbol: __asan_option_detect_stack_use_after_return

It might be possible to build ASAN-DSO and set LD_PRELOAD, but this
solution is not officially supported.  See the reference for details.

Reference: https://code.google.com/p/address-sanitizer/wiki/AsanAsDso
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
10 years agotests: skip kill -SEGV test when running AddressSanitizer
Sami Kerola [Sun, 9 Nov 2014 21:22:52 +0000 (21:22 +0000)] 
tests: skip kill -SEGV test when running AddressSanitizer

Sending signal indicating invalid memory reference makes AddressSanitizer
to report false positive test failure.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
10 years agolibmount: fix memory overflow [AddressSanitizer]
Sami Kerola [Sun, 9 Nov 2014 15:26:05 +0000 (15:26 +0000)] 
libmount: fix memory overflow [AddressSanitizer]

==10918==ERROR: AddressSanitizer: stack-buffer-overflow on address 0x7fffd795b680 at pc 0x0000004447c6 bp 0x7fffd795b3e0 sp 0x7fffd795ab78
WRITE of size 129 at 0x7fffd795b680 thread T0
    #0 0x4447c5 in scanf_common(void*, int, bool, char const*, __va_list_tag*) (/home/src/util-linux/.libs/lt-mount+0x4447c5)
    #1 0x445892 in sscanf (/home/src/util-linux/.libs/lt-mount+0x445892)
    #2 0x7fe78709a3d3 in get_filesystems /home/src/util-linux/libmount/src/utils.c:581:7
    #3 0x7fe78709a1ba in mnt_get_filesystems /home/src/util-linux/libmount/src/utils.c:622:7
    #4 0x7fe7870aa78f in do_mount_by_pattern /home/src/util-linux/libmount/src/context_mount.c:833:7
    #5 0x7fe7870a9534 in mnt_context_do_mount /home/src/util-linux/libmount/src/context_mount.c:951:9
    #6 0x7fe7870aab2b in mnt_context_mount /home/src/util-linux/libmount/src/context_mount.c:1051:8
    #7 0x4ba9f5 in main /home/src/util-linux/sys-utils/mount.c:1107:7
    #8 0x7fe785caa03f in __libc_start_main (/usr/lib/libc.so.6+0x2003f)
    #9 0x4b9f9c in _start (/home/src/util-linux/.libs/lt-mount+0x4b9f9c)

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
Signed-off-by: Karel Zak <kzak@redhat.com>
10 years agotests: fix memory leak [AddressSanitizer]
Sami Kerola [Sun, 2 Nov 2014 22:26:48 +0000 (22:26 +0000)] 
tests: fix memory leak [AddressSanitizer]

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
10 years agobuild-sys: make scanf_cv_alloc_modifier to work [LeakSanitizer]
Sami Kerola [Sun, 2 Nov 2014 22:06:15 +0000 (22:06 +0000)] 
build-sys: make scanf_cv_alloc_modifier to work [LeakSanitizer]

The tests failed with following message in config.log

ERROR: LeakSanitizer: detected memory leaks

Direct leak of 2 byte(s) in 1 object(s) allocated from:
    #0 0x49a40e in realloc (/home/src/util-linux/conftest+0x49a40e)
    #1 0x7fbe48633e69 in __GI__IO_vfscanf (/usr/lib/libc.so.6+0x56e69)
    #2 0x7fbe48649786 in _IO_vsscanf (/usr/lib/libc.so.6+0x6c786)

which knocked out libmount from build, and commands depending on it.

The reason this change makes sense is that AddressSanitizer seems like a
good addition to set of tools that util-linux package can use, when and
if needed.

Reference: https://code.google.com/p/address-sanitizer/wiki/AddressSanitizer
Reviewed-by: Mike Frysinger <vapier@gentoo.org>
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
10 years agolscpu: theoretical buffer overflow
Tobias Stoeckmann [Sun, 26 Oct 2014 17:41:24 +0000 (18:41 +0100)] 
lscpu: theoretical buffer overflow

there is a theoretical buffer overflow possible in the hypervisor
parsing code of lscpu.  It would require a proc entry to return way more
than expected so it's no high priority.  But better be safe than sorry.

At first I thought about switching to fgets but there is another
code file that adds a format specifier.  The diff is less intrusive
that way, too.

Signed-off-by: Karel Zak <kzak@redhat.com>
10 years agolibfdisk: fix partition names on GNU Hurd.
Gabriele Giacone [Tue, 18 Nov 2014 01:13:22 +0000 (02:13 +0100)] 
libfdisk: fix partition names on GNU Hurd.

10 years agolibfdisk: fix get_partition_unused_primary()
Boris Egorov [Fri, 14 Nov 2014 05:27:16 +0000 (11:27 +0600)] 
libfdisk: fix get_partition_unused_primary()

Was:
Mentioned function returns -1 if adding of primary partition is
impossible. Caller treats this value as size_t (res variable) and then
compares it for negative values, totally ignoring errors.

Becomes:
Now function takes address to variable and fills it with partition
number. Caller treats return value as int and use it appropriately.

[kzak@redhat.com: - don't mix return code and partno at all]

Signed-off-by: Boris Egorov <egorov@linux.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
10 years agofdisk: missing break in switch
Boris Egorov [Wed, 12 Nov 2014 15:49:01 +0000 (21:49 +0600)] 
fdisk: missing break in switch

Signed-off-by: Boris Egorov <egorov@linux.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
10 years agolibblkid: (nilfs) fix typo
Boris Egorov [Wed, 12 Nov 2014 15:49:01 +0000 (21:49 +0600)] 
libblkid: (nilfs) fix typo

Signed-off-by: Boris Egorov <egorov@linux.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
10 years agohwclock: improve wording and formatting of man page
Benno Schulenberg [Sun, 9 Nov 2014 19:29:26 +0000 (20:29 +0100)] 
hwclock: improve wording and formatting of man page

Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
10 years agolibfdisk: (dos) be sure that sorted EBR list is terminated
Karel Zak [Thu, 13 Nov 2014 13:37:05 +0000 (14:37 +0100)] 
libfdisk: (dos) be sure that sorted EBR list is terminated

Signed-off-by: Karel Zak <kzak@redhat.com>
10 years agolibfdisk: fix table_add_freespace(), add debug messages
Karel Zak [Thu, 13 Nov 2014 13:17:47 +0000 (14:17 +0100)] 
libfdisk: fix table_add_freespace(), add debug messages

Signed-off-by: Karel Zak <kzak@redhat.com>
10 years agocfdisk: cleanup menuitem draw functions
Karel Zak [Thu, 13 Nov 2014 11:52:03 +0000 (12:52 +0100)] 
cfdisk: cleanup menuitem draw functions

Signed-off-by: Karel Zak <kzak@redhat.com>
10 years agocfdisk: remove [Load] from menu
Karel Zak [Thu, 13 Nov 2014 10:19:58 +0000 (11:19 +0100)] 
cfdisk: remove [Load] from menu

This functionality will be rarely used, so it does not make sense to
waste screen space with this menu item. It's enough to provide this
functionality in "Select label type" dialog (cfdisk --zero and then
'L' command).

Signed-off-by: Karel Zak <kzak@redhat.com>
10 years agocfdisk: add support for sfdisk scripts
Karel Zak [Wed, 12 Nov 2014 15:12:39 +0000 (16:12 +0100)] 
cfdisk: add support for sfdisk scripts

Signed-off-by: Karel Zak <kzak@redhat.com>
10 years agofdisk: add support for sfdisk scripts
Karel Zak [Wed, 12 Nov 2014 10:15:06 +0000 (11:15 +0100)] 
fdisk: add support for sfdisk scripts

New commands 'I' and 'O' allows to read and write sfdisk compatible
scripts by fdisk. It means that you can save your work (partition
table) and later use it (in fdisk, sfdisk or cfdisk) to create a new
partition table.

Signed-off-by: Karel Zak <kzak@redhat.com>
10 years agolibfdisk: fix script parser, add debug messages
Karel Zak [Wed, 12 Nov 2014 09:34:13 +0000 (10:34 +0100)] 
libfdisk: fix script parser, add debug messages

Signed-off-by: Karel Zak <kzak@redhat.com>
10 years agolibfdisk: (gpt) don't offer first sector before the first partion
Karel Zak [Mon, 10 Nov 2014 13:01:09 +0000 (14:01 +0100)] 
libfdisk: (gpt) don't offer first sector before the first partion

The GPT first usable LBA is usually aligned to grain (1MiB), but for small
(<=4MiB) devices we strictly follow sector sizes.

In this case there is a small space in front of the aligned begin of
the first partition. This useless space should not be offered for the
next partitions.

Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 32768 bytes
Disklabel type: gpt
Disk identifier: 041E2D54-AD0C-4C7E-A50D-363D23058D47

Device    Start          End Size Type
/dev/sdb1    40         2087   1M Linux filesystem

Command (m for help): n
Partition number (2-128, default 2):
First sector (34-8158, default 2088):
                      ^^

first usable LBA is 34, but first aligned (recommended) LBA is 40, we
use it for the first partition. All this is correct, but the space
before the first partition should be ignored. Fixed version:

        Command (m for help): n
Partition number (2-128, default 2):
First sector (2088-8158, default 2088):
                      ^^^^

Note this problem does not exist for "normal" (large) devices where
first usable LBA is aligned to grain.

Reported-by: Boaz Harrosh <boaz@plexistor.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
10 years agolibfdisk: (gpt) make mode more readable
Karel Zak [Mon, 10 Nov 2014 11:22:55 +0000 (12:22 +0100)] 
libfdisk: (gpt) make mode more readable

* use check_ prefix for checking functions
* use plural in function names where we work with more partitions than one
* always use "ents" when when we work with gpt entries array

Signed-off-by: Karel Zak <kzak@redhat.com>
10 years agolibfdisk: fdisk_read_firstsector should seek to offset 0
Samuel Thibault [Sun, 9 Nov 2014 02:19:01 +0000 (03:19 +0100)] 
libfdisk: fdisk_read_firstsector should seek to offset 0

The current offset of cxt->dev_fd may not be still 0, notably when
blkdev_get_size has to resort to using blkdev_find_size

Signed-off-by: Samuel Thibault <samuel.thibault@ens-lyon.org
10 years agotests: simplify and update swaplabel test
Karel Zak [Mon, 10 Nov 2014 10:46:46 +0000 (11:46 +0100)] 
tests: simplify and update swaplabel test

Signed-off-by: Karel Zak <kzak@redhat.com>
10 years agoinclude/statfs_magic: use macro rather than type for f_type
Karel Zak [Mon, 10 Nov 2014 10:29:42 +0000 (11:29 +0100)] 
include/statfs_magic: use macro rather than type for f_type

Signed-off-by: Karel Zak <kzak@redhat.com>
10 years agomkswap: make final report more human readable
Karel Zak [Fri, 7 Nov 2014 13:03:35 +0000 (14:03 +0100)] 
mkswap: make final report more human readable

Signed-off-by: Karel Zak <kzak@redhat.com>
10 years agomkswap: device write code refactoring
Karel Zak [Fri, 7 Nov 2014 12:55:37 +0000 (13:55 +0100)] 
mkswap: device write code refactoring

Signed-off-by: Karel Zak <kzak@redhat.com>
10 years agomkswap: device open code refactoring
Karel Zak [Fri, 7 Nov 2014 12:46:42 +0000 (13:46 +0100)] 
mkswap: device open code refactoring

Signed-off-by: Karel Zak <kzak@redhat.com>
10 years agomkswap: always use header from control struct
Karel Zak [Fri, 7 Nov 2014 12:35:50 +0000 (13:35 +0100)] 
mkswap: always use header from control struct

Signed-off-by: Karel Zak <kzak@redhat.com>
10 years agomkswap: coding style improvements
Karel Zak [Fri, 7 Nov 2014 12:25:11 +0000 (13:25 +0100)] 
mkswap: coding style improvements

Signed-off-by: Karel Zak <kzak@redhat.com>
10 years agoswapon: reword some usage strings
Benno Schulenberg [Mon, 3 Nov 2014 21:17:17 +0000 (22:17 +0100)] 
swapon: reword some usage strings

Also remove some inconsistent periods and properly punctuate
the closing sentence.

Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
10 years agodocs: fix some wording, grammar and formatting in man page of swapon
Benno Schulenberg [Mon, 3 Nov 2014 21:17:16 +0000 (22:17 +0100)] 
docs: fix some wording, grammar and formatting in man page of swapon

Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
10 years agomkswap: various minor improvement
Sami Kerola [Sun, 2 Nov 2014 20:26:31 +0000 (20:26 +0000)] 
mkswap: various minor improvement

Use correct data type in page_bad(), and add information to error message
how many bad pages were seen.

In check_blocks() move initialization to variable introduction, fix typo,
and avoid memset() when array initializer can do the job.

In main() use correct initializer for pointer.  Move swap file specific
actions to same location, and add warning when request too --check is
dismissed by command.  At the end remove momory leak.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
10 years agomkswap: set variable only when it's value is known
Sami Kerola [Sun, 2 Nov 2014 20:26:30 +0000 (20:26 +0000)] 
mkswap: set variable only when it's value is known

Avoid updating ctl->pagesize twice when user does specify page size.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
10 years agomkswap: make remaining functions to take control structure as argument
Sami Kerola [Sun, 2 Nov 2014 20:26:29 +0000 (20:26 +0000)] 
mkswap: make remaining functions to take control structure as argument

The wipe_device() and new_prober().

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
10 years agomkswap: add struct mkswap_control to remove global variables
Sami Kerola [Sun, 2 Nov 2014 20:26:28 +0000 (20:26 +0000)] 
mkswap: add struct mkswap_control to remove global variables

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
10 years agomkswap: use err() rather than perror() && exit()
Sami Kerola [Sun, 2 Nov 2014 20:26:27 +0000 (20:26 +0000)] 
mkswap: use err() rather than perror() && exit()

The messsages in err() are verified from po/util-linux.pot to be already
part of translations.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
10 years agomkswap: remove unnecessary size check
Sami Kerola [Sun, 2 Nov 2014 20:26:26 +0000 (20:26 +0000)] 
mkswap: remove unnecessary size check

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
10 years agomkswap: remove system architecture specific max swap size checks
Sami Kerola [Sun, 2 Nov 2014 20:26:25 +0000 (20:26 +0000)] 
mkswap: remove system architecture specific max swap size checks

Since kernel version 2.3.4 (June 1999) all architectures has used
uint32_t as maximum number or pages in a swap device or file, there is no
longer need to support systems earlier than that.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
10 years agotests: update fdisk tests
Karel Zak [Fri, 7 Nov 2014 11:29:17 +0000 (12:29 +0100)] 
tests: update fdisk tests

Signed-off-by: Karel Zak <kzak@redhat.com>
10 years agoswapoff: swapoff swap files by LABEL and UUID
Karel Zak [Fri, 7 Nov 2014 11:08:11 +0000 (12:08 +0100)] 
swapoff: swapoff swap files by LABEL and UUID

 # swapon --show=NAME,UUID
 NAME                   UUID
 /dev/sda3              8d52fca3-bf48-41d6-b826-2315e518a305
 /home/fs-images/2g.img 6fa72b96-b802-441f-a31c-091d65c0212c

 # swapoff UUID=6fa72b96-b802-441f-a31c-091d65c0212c
 swapoff: cannot find the device for UUID=6fa72b96-b802-441f-a31c-091d65c0212c

Reported-by: Sami Kerola <kerolasa@iki.fi>
Signed-off-by: Karel Zak <kzak@redhat.com>
10 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>
10 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>
10 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>
10 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>
10 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>
10 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>
10 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>
10 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>
10 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>
10 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>
10 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>
10 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>
10 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>
10 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>
10 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.

10 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>
10 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>
10 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>
10 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>
10 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>
10 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>
10 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>
10 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>
10 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>
10 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>
10 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>
10 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>
10 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>
10 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>
10 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>
10 years agoblkdiscard: fail on sector misalignment
Federico Simoncelli [Fri, 24 Oct 2014 15:13:54 +0000 (15:13 +0000)] 
blkdiscard: fail on sector misalignment

10 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>
10 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>
10 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>
10 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>
10 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>
10 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>
10 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

10 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>
10 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>
10 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>
10 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>
10 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>
10 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>
10 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>
10 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>
10 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>
10 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>