]> git.ipfire.org Git - thirdparty/util-linux.git/log
thirdparty/util-linux.git
12 years agofsck.cramfs: compile with -DINCLUDE_FS_TESTS for make check
Karel Zak [Mon, 22 Oct 2012 08:10:55 +0000 (10:10 +0200)] 
fsck.cramfs: compile with -DINCLUDE_FS_TESTS for make check

 make check
 sudo su -
 cd tests
 ./run.sh cramfs

Signed-off-by: Karel Zak <kzak@redhat.com>
12 years agodocs: add line breaks to whereis.1
Sami Kerola [Wed, 10 Oct 2012 18:14:43 +0000 (19:14 +0100)] 
docs: add line breaks to whereis.1

Fix to tools script checkmans.sh warning.

testing: /home/src/util-linux/misc-utils/whereis.1
:120: warning [p 1, 10.8i, div `an-div', 0.0i]: can't break line

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
12 years agoinclude/c: remove MAXHOSTNAMELEN macro
Karel Zak [Fri, 19 Oct 2012 14:58:11 +0000 (16:58 +0200)] 
include/c: remove MAXHOSTNAMELEN macro

Signed-off-by: Karel Zak <kzak@redhat.com>
12 years agolast: stop usig MAXHOSTNAMELEN
Karel Zak [Fri, 19 Oct 2012 14:56:57 +0000 (16:56 +0200)] 
last: stop usig MAXHOSTNAMELEN

Signed-off-by: Karel Zak <kzak@redhat.com>
12 years agowrite: stop using MAXHOSTNAMELEN
Karel Zak [Fri, 19 Oct 2012 14:27:58 +0000 (16:27 +0200)] 
write: stop using MAXHOSTNAMELEN

Signed-off-by: Karel Zak <kzak@redhat.com>
12 years agoagetty: stop using MAXHOSTNAMELEN
Karel Zak [Fri, 19 Oct 2012 14:27:46 +0000 (16:27 +0200)] 
agetty: stop using MAXHOSTNAMELEN

Signed-off-by: Karel Zak <kzak@redhat.com>
12 years agologin: stop using MAXHOSTNAMELEN
Karel Zak [Fri, 19 Oct 2012 14:27:29 +0000 (16:27 +0200)] 
login: stop using MAXHOSTNAMELEN

Signed-off-by: Karel Zak <kzak@redhat.com>
12 years agoinclude/xalloc: add xgethostname()
Karel Zak [Fri, 19 Oct 2012 14:23:54 +0000 (16:23 +0200)] 
include/xalloc: add xgethostname()

The new function allocates memory by xalloc() for hostname and
fill in the buffer by gethostname().

Signed-off-by: Karel Zak <kzak@redhat.com>
12 years agoinclude/env: unify indentation
Sami Kerola [Wed, 17 Oct 2012 19:26:14 +0000 (20:26 +0100)] 
include/env: unify indentation

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
Signed-off-by: Karel Zak <kzak@redhat.com>
12 years agoinclude/c: add get_hostname_max() inline function
Sami Kerola [Wed, 17 Oct 2012 19:16:06 +0000 (20:16 +0100)] 
include/c: add get_hostname_max() inline function

Using sysconf(_SC_HOST_NAME_MAX) does not work everywhere.  At such even
header values for hostname length should be preferred, and if nothing
else works guess the maxium being 64 bytes.

Based-on-code-by: Karel Zak <kzak@redhat.com>
CC: Mike Frysinger <vapier@gentoo.org>
References: http://www.spinics.net/lists/util-linux-ng/msg07050.html
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
Signed-off-by: Karel Zak <kzak@redhat.com>
12 years agofdisk: gpt: use swap_efi_guid for new partitions
Davidlohr Bueso [Sun, 7 Oct 2012 14:34:08 +0000 (16:34 +0200)] 
fdisk: gpt: use swap_efi_guid for new partitions

Signed-off-by: Davidlohr Bueso <dave@gnu.org>
12 years agofdisk: fix segfault when printing gpt raw data
Davidlohr Bueso [Sun, 7 Oct 2012 14:34:01 +0000 (16:34 +0200)] 
fdisk: fix segfault when printing gpt raw data

Signed-off-by: Davidlohr Bueso <dave@gnu.org>
12 years agofdisk: api: improve some comments
Davidlohr Bueso [Sun, 7 Oct 2012 14:33:45 +0000 (16:33 +0200)] 
fdisk: api: improve some comments

Signed-off-by: Davidlohr Bueso <dave@gnu.org>
12 years agofdisk: api: propagate partition deletion to users
Davidlohr Bueso [Sun, 7 Oct 2012 14:33:37 +0000 (16:33 +0200)] 
fdisk: api: propagate partition deletion to users

The generic fdisk_delete_partition() function returns 0 when a partition
is correctly deleted, otherwise it's corresponding error (negative values).
This, however, does not include problems that can occur in actual label
specific contexts, so we need to propagate the corresponding return code,
back to the user visible api.

Signed-off-by: Davidlohr Bueso <dave@gnu.org>
12 years agodocs: update deprecated file
Karel Zak [Thu, 18 Oct 2012 08:48:01 +0000 (10:48 +0200)] 
docs: update deprecated file

The goal is to consolidate the very basic linux commands and minimize
dependence on another packages (e.g. shadow-utils). It seems better to
keep newgrp, vipw and vigr as non-deprecated for now. Maybe we will
found a way how to improve the code. We will see... :-)

Signed-off-by: Karel Zak <kzak@redhat.com>
12 years agolib/loopdev: check for /sys
Karel Zak [Wed, 17 Oct 2012 09:43:39 +0000 (11:43 +0200)] 
lib/loopdev: check for /sys

The current loopdev code prefers /sys to get information about
loop devices. The old methods like scan /dev are fallback solution
only. Unfortunately, the code does not check if /sys is mounted.

Addresses: http://blog.flameeyes.eu/2012/10/sophistication-can-be-bad
Signed-off-by: Karel Zak <kzak@redhat.com>
12 years agolib/loopdev: improve debug messages
Karel Zak [Wed, 17 Oct 2012 09:42:21 +0000 (11:42 +0200)] 
lib/loopdev: improve debug messages

Signed-off-by: Karel Zak <kzak@redhat.com>
12 years agodmesg: Add a --color option to colorize error and panic messages
Ondrej Oprala [Tue, 9 Oct 2012 10:32:55 +0000 (12:32 +0200)] 
dmesg: Add a --color option to colorize error and panic messages

[kzak@redhat.com: - update man page
                  - colorize critical messages too]

Signed-off-by: Karel Zak <kzak@redhat.com>
Signed-off-by: Ondrej Oprala <ooprala@redhat.com>
12 years agolib/color: add module for work with terminal colors
Ondrej Oprala [Tue, 16 Oct 2012 14:39:00 +0000 (16:39 +0200)] 
lib/color: add module for work with terminal colors

[kzak@redhat.com: - split from dmesg patch
                  - add more colors]

Signed-off-by: Ondrej Oprala <ooprala@redhat.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
12 years agomount: add long options for -L and -U to man page
Bill Pemberton [Wed, 10 Oct 2012 20:54:02 +0000 (16:54 -0400)] 
mount: add long options for -L and -U to man page

The -L and -U flags both have long options too (--label and --uuid).
The usage() function will show them but the man page didn't list them.

Signed-off-by: Bill Pemberton <wfp5p@virginia.edu>
12 years agomount: add -c abbreviation for --no-canonicalize to man page
Bill Pemberton [Wed, 10 Oct 2012 20:54:01 +0000 (16:54 -0400)] 
mount: add -c abbreviation for --no-canonicalize to man page

The --no-canonicalize option can also be set using -c.  The --help for
mount shows this option but the man page did not.  Add -c to the man
page.

Signed-off-by: Bill Pemberton <wfp5p@virginia.edu>
12 years agodocs: remove hwclock --compare from TODO
Bill Pemberton [Wed, 10 Oct 2012 20:54:00 +0000 (16:54 -0400)] 
docs: remove hwclock --compare from TODO

commit 83765871ef0d6c554c46027577648b77c7351a78 added the --compare
option to hwclock so it can be removed from the TODO.

Signed-off-by: Bill Pemberton <wfp5p@virginia.edu>
12 years agohwclock: add the --compare option to the man page
Bill Pemberton [Wed, 10 Oct 2012 20:53:59 +0000 (16:53 -0400)] 
hwclock: add the --compare option to the man page

The compare option for hwclock was not listed in the man page.  This
adds a simple decription of it.

Signed-off-by: Bill Pemberton <wfp5p@virginia.edu>
12 years agodocs: add su(1) btmp logging
Karel Zak [Tue, 16 Oct 2012 09:27:35 +0000 (11:27 +0200)] 
docs: add su(1) btmp logging

Signed-off-by: Karel Zak <kzak@redhat.com>
12 years agotests: add mising "export" keyword
Karel Zak [Mon, 15 Oct 2012 15:28:02 +0000 (17:28 +0200)] 
tests: add mising "export" keyword

Signed-off-by: Karel Zak <kzak@redhat.com>
12 years agotests: skip ipcs limits overflow when bc is not available
Gilles Espinasse [Sun, 14 Oct 2012 15:19:10 +0000 (17:19 +0200)] 
tests: skip ipcs limits overflow when bc is not available

Found only this one while trying as-root tests

Signed-off-by: Gilles Espinasse <g.esp@free.fr>
12 years agotests: fix ipcs basic limit when bc is not available
Gilles Espinasse [Sun, 14 Oct 2012 13:52:55 +0000 (15:52 +0200)] 
tests: fix ipcs basic limit when bc is not available

Skip basic limit test if bc is not available.
That happen to be the case when building from sources, following LFS book

Signed-off-by: Gilles Espinasse <g.esp@free.fr>
12 years agolibmount: fixed comment about param
Raul Gutierrez Segales [Sat, 13 Oct 2012 15:59:31 +0000 (08:59 -0700)] 
libmount: fixed comment about param

Signed-off-by: Raul Gutierrez Segales <rgs@itevenworks.net>
12 years agolibblkid: fix compiler warning [-Wstrict-aliasing]
Karel Zak [Mon, 15 Oct 2012 15:01:30 +0000 (17:01 +0200)] 
libblkid: fix compiler warning [-Wstrict-aliasing]

libblkid/src/superblocks/befs.c: In function 'get_uuid':
libblkid/src/superblocks/befs.c:353:6: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]

Signed-off-by: Karel Zak <kzak@redhat.com>
12 years agoswapon: remove loop declaration [smatch scan]
Sami Kerola [Mon, 8 Oct 2012 07:08:20 +0000 (08:08 +0100)] 
swapon: remove loop declaration [smatch scan]

sys-utils/swapon.c:677:2: error: 'for' loop initial declarations are
only allowed in C99 mode

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
12 years agomore: remove few memory leaks
Sami Kerola [Mon, 8 Oct 2012 07:08:19 +0000 (08:08 +0100)] 
more: remove few memory leaks

The remaining memory leaks are related to ncurses internals, or the one
open file descriptor when user users 'q' to exit.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
12 years agomore: align void in functions with prototypes, and remove void casts
Sami Kerola [Mon, 8 Oct 2012 07:08:18 +0000 (08:08 +0100)] 
more: align void in functions with prototypes, and remove void casts

If there is void in argument list at function prototype it is reasonable
to expect to see it also where the function is wrote.  This change also
removes unnecessary return value void casting.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
12 years agomore: fix coding style
Sami Kerola [Mon, 8 Oct 2012 07:08:17 +0000 (08:08 +0100)] 
more: fix coding style

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
12 years agopg: fix coding style
Sami Kerola [Mon, 8 Oct 2012 07:08:16 +0000 (08:08 +0100)] 
pg: fix coding style

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
12 years agopg: do not turn off warnigns artificially
Sami Kerola [Mon, 8 Oct 2012 07:08:15 +0000 (08:08 +0100)] 
pg: do not turn off warnigns artificially

Compiler warnings often mean something, fiddling with them is not good
practise.  Besides the 'proglem' removed macro tried to 'fix' does not
even occur when compiling with modern gcc.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
12 years agopg: use unistd.h STDOUT_FILENO
Sami Kerola [Mon, 8 Oct 2012 07:08:14 +0000 (08:08 +0100)] 
pg: use unistd.h STDOUT_FILENO

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
12 years agopg: add noreturn function attributes
Sami Kerola [Mon, 8 Oct 2012 07:08:13 +0000 (08:08 +0100)] 
pg: add noreturn function attributes

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
12 years agoddate: remove from util-linux
Sami Kerola [Mon, 8 Oct 2012 07:08:07 +0000 (08:08 +0100)] 
ddate: remove from util-linux

See RedHat bug for reasons why the ddate is cleaned up.  The reference is
where to get the command in future.

Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=823156
References: https://github.com/bo0ts/ddate
Acked-by: Petr Uzel <petr.uzel@suse.cz>
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
Signed-off-by: Karel Zak <kzak@redhat.com>
12 years agopg: add const qualifiers where suitable
Sami Kerola [Mon, 8 Oct 2012 07:08:12 +0000 (08:08 +0100)] 
pg: add const qualifiers where suitable

Includes a fix also to one assignment warning (see below).

text-utils/pg.c:1477:24: warning: assignment discards 'const' qualifier \
from pointer target type [enabled by default]

[kzak@redhat.com: - use const char rather than xstrdup() for static /bin/sh string]

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
Signed-off-by: Karel Zak <kzak@redhat.com>
12 years agopg: use libc error printing facilities
Sami Kerola [Mon, 8 Oct 2012 07:08:11 +0000 (08:08 +0100)] 
pg: use libc error printing facilities

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
12 years agopg: refactor argument handing
Sami Kerola [Mon, 8 Oct 2012 07:08:10 +0000 (08:08 +0100)] 
pg: refactor argument handing

Add function parse_arguments(), which has the same code block that was in
over long, and too deeply intended, main().

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
12 years agodocs: fix column.1 groff syntax error
Sami Kerola [Mon, 8 Oct 2012 07:08:09 +0000 (08:08 +0100)] 
docs: fix column.1 groff syntax error

Quote backslash which user is expected to see.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
12 years agocolumn: add --output-separator option
Sami Kerola [Mon, 8 Oct 2012 07:08:08 +0000 (08:08 +0100)] 
column: add --output-separator option

The --output-separator option will allow user to define table column
separator.  This will allow for example to write back same delimeter as
which was used as input separator, for example

column -t -s : -o : /etc/passwd

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
12 years agomkfs.minix: check numeric user inputs
Sami Kerola [Wed, 3 Oct 2012 22:14:26 +0000 (23:14 +0100)] 
mkfs.minix: check numeric user inputs

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
Signed-off-by: Karel Zak <kzak@redhat.com>
12 years agopg: check numeric user inputs
Sami Kerola [Tue, 2 Oct 2012 20:15:18 +0000 (21:15 +0100)] 
pg: check numeric user inputs

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
Signed-off-by: Karel Zak <kzak@redhat.com>
12 years agoswapon: clarify swapon.8 priority option
Sami Kerola [Tue, 2 Oct 2012 20:15:17 +0000 (21:15 +0100)] 
swapon: clarify swapon.8 priority option

Value -1 is valid argument for -p, even though it might not make much
sense as the -1 is in use when priority is not specified at all.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
12 years agoswapon: check numeric user inputs
Sami Kerola [Tue, 2 Oct 2012 20:15:16 +0000 (21:15 +0100)] 
swapon: check numeric user inputs

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
Signed-off-by: Karel Zak <kzak@redhat.com>
12 years agodocs: align blkdiscard.8 with how-to-man-page.txt
Sami Kerola [Tue, 2 Oct 2012 18:43:59 +0000 (19:43 +0100)] 
docs: align blkdiscard.8 with how-to-man-page.txt

* Add spaces after dots (English spacing).
* Remove use of inline emphasis where possible.
* Use mail and url macros.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
12 years agowipefs: use O_EXCL
Karel Zak [Mon, 15 Oct 2012 10:38:09 +0000 (12:38 +0200)] 
wipefs: use O_EXCL

Address: https://bugzilla.redhat.com/show_bug.cgi?id=865961
Signed-off-by: Karel Zak <kzak@redhat.com>
12 years agolibmount: don't use umount optimization for -l or -f
Karel Zak [Mon, 15 Oct 2012 09:10:50 +0000 (11:10 +0200)] 
libmount: don't use umount optimization for -l or -f

The options -l (lazy) and -f (force) means that the mountpoint may be
unreadable (for example because NFS server is unreadable). So we
should not try to be smart in this case and we should try to minimize
number of situations when stat() or readlink() is used for the
mountpoint.

Signed-off-by: Karel Zak <kzak@redhat.com>
12 years agobuild-sys: clean update-potfiles script
Karel Zak [Wed, 10 Oct 2012 11:06:01 +0000 (13:06 +0200)] 
build-sys: clean update-potfiles script

 - use only sed(1)
 - remove config.h from the result
 - remove samples/, tests/, util-linu-*/ ("make ditcheck" product)
   directories from the result

Signed-off-by: Karel Zak <kzak@redhat.com>
12 years agobuild-sys: remove --enable-gtk-doc from make check
Karel Zak [Wed, 10 Oct 2012 11:05:20 +0000 (13:05 +0200)] 
build-sys: remove --enable-gtk-doc from make check

Signed-off-by: Karel Zak <kzak@redhat.com>
12 years agosfdisk: fix aliasing warnings
Mike Frysinger [Wed, 10 Oct 2012 04:29:54 +0000 (00:29 -0400)] 
sfdisk: fix aliasing warnings

Compiles down to the same code.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
12 years agomd5: fix strict aliasing warnings
Mike Frysinger [Wed, 10 Oct 2012 04:22:38 +0000 (00:22 -0400)] 
md5: fix strict aliasing warnings

This is the same fix as was merged in gcc/binutils where this code
appears to originate from.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
12 years agotests: fix mount move test to work with shared mount
Milan Broz [Fri, 5 Oct 2012 16:37:40 +0000 (18:37 +0200)] 
tests: fix mount move test to work with shared mount

If parent mount for test directory is mounted with shared flag,
move mount test fails because kernel rejects mount move operation.

Use another directory level and explicitly make parent mount private.

(All "modern" systems using system have mounts shared for some reason.)

Signed-off-by: Milan Broz <mbroz@redhat.com>
12 years agotests: ignore test if kernel doesn't support minix fs
Milan Broz [Fri, 5 Oct 2012 16:37:39 +0000 (18:37 +0200)] 
tests: ignore test if kernel doesn't support minix fs

Minix mount test returs failure if kernel have no minix support,
 minix: mkfs ... FAILED (minix/mkfs)
ignore test result instead in this case.

Signed-off-by: Milan Broz <mbroz@redhat.com>
12 years agotests: fix timezone for cramfs
Milan Broz [Fri, 5 Oct 2012 16:37:38 +0000 (18:37 +0200)] 
tests: fix timezone for cramfs

cramfs test need explicitly set timezone otherwise
ls diff fails with
   cramfs: mkfs checksums ... FAILED (cramfs/mkfs)

Signed-off-by: Milan Broz <mbroz@redhat.com>
12 years agofix bold style of man page references
Mike Frysinger [Fri, 5 Oct 2012 01:34:34 +0000 (21:34 -0400)] 
fix bold style of man page references

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
12 years agofdisk: add AArch64 support
Marcin Juszkiewicz [Wed, 3 Oct 2012 09:31:19 +0000 (10:31 +0100)] 
fdisk: add AArch64 support

Attached patch fixed build problem when util-linux is built for AArch64
architecture.

12 years agomount: add verbose messages
Karel Zak [Tue, 9 Oct 2012 09:56:35 +0000 (11:56 +0200)] 
mount: add verbose messages

Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=864227
Signed-off-by: Karel Zak <kzak@redhat.com>
12 years agolibmount: fix umount file.img
Karel Zak [Fri, 5 Oct 2012 18:35:34 +0000 (20:35 +0200)] 
libmount: fix umount file.img

The umount optimization (commit 9cc03553f7b8494c7193024eec6e13b903eb2eec)
has to be disabled if the umount argument is not a directory.

Reported-by: Milan Broz <mbroz@redhat.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
12 years agologin: reuse DEAD_PROCESS utmp entries
Karel Zak [Fri, 5 Oct 2012 10:07:10 +0000 (12:07 +0200)] 
login: reuse DEAD_PROCESS utmp entries

Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=858009
Signed-off-by: Karel Zak <kzak@redhat.com>
12 years agohwclock: fix in usage()
Karel Zak [Wed, 3 Oct 2012 09:41:52 +0000 (11:41 +0200)] 
hwclock: fix in usage()

Signed-off-by: Karel Zak <kzak@redhat.com>
12 years agodmesg: fix console-level off-by-one
Bjørn Mork [Mon, 1 Oct 2012 23:54:49 +0000 (01:54 +0200)] 
dmesg: fix console-level off-by-one

  commit f06ec64f dmesg; support level names (e.g. --console-level=alert)

introduced an off-by-one error.  The kernel will print messages with
a *higher* level than the console-level. The bug made it impossible to
set the level for debugging, like it is documented in e.g
Documentation/networking/netconsole.txt :

 nemi:/tmp# dmesg -n 8
 dmesg: unknown level '8'

And attempting to set the "emerg" level would result in an invalid 0 value:

 nemi:/tmp# dmesg -n emerg
 dmesg: klogctl failed: Invalid argument

Restoring the old behaviour for numeric levels, and mapping the level
names so that "dmesg -n debug" behaves as expected: logging everything
at level "debug" and higher.

[kzak@redhat.com: - add comment to parse_level()]

Signed-off-by: Bjørn Mork <bjorn@mork.no>
Signed-off-by: Karel Zak <kzak@redhat.com>
12 years agocolumn: describe change of separator behavior in man page bugs section
Sami Kerola [Sat, 29 Sep 2012 09:21:59 +0000 (10:21 +0100)] 
column: describe change of separator behavior in man page bugs section

Add to manual page how to achieve old behavior, just in case someone
relies on buggy behavior of the command.

[kzak@redhat.com: - remove unnecessary info from the man page :-)]

Reported-by: Padraig Brady <P@draigBrady.com>
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
Signed-off-by: Karel Zak <kzak@redhat.com>
12 years agosu: fixed a typo in pam error message
Vitezslav Cizek [Mon, 1 Oct 2012 12:48:16 +0000 (14:48 +0200)] 
su: fixed a typo in pam error message

Signed-off-by: Vitezslav Cizek <vcizek@suse.cz>
12 years agocolumn: clarify the --separator option
Pádraig Brady [Wed, 26 Sep 2012 21:20:07 +0000 (22:20 +0100)] 
column: clarify the --separator option

Indicate that the string is a set,
which also clarifies that it's only
significant when parsing the input.

12 years agocolumn: make defined separator to be non-greedy
Sami Kerola [Wed, 26 Sep 2012 20:45:36 +0000 (21:45 +0100)] 
column: make defined separator to be non-greedy

This patch changes interpretation of subsequent delimeter interpretation.
Earlier version merged columns that had null string as content together,
which lead to output as visualized below.

$ printf "a:b:c\n1::3\n" | column  -t -s ':'
a  b  c
1  3

The number 3 has wrong column, which this patch takes care of, and alters
the output following way.

$ printf "a:b:c\n1::3\n" | column  -t -s ':'
a  b  c
1     3

This patch does not alter the default case, e.g., subsequent white spaces
are understood as separator of the same field, and the beginning of line
white spaces are being ignored together.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
12 years agomount: fix a few typos
Mike Frysinger [Tue, 25 Sep 2012 22:39:00 +0000 (18:39 -0400)] 
mount: fix a few typos

Nothing of note here.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
12 years agotextual: typo fixes
Gilles Espinasse [Sat, 22 Sep 2012 07:59:19 +0000 (09:59 +0200)] 
textual: typo fixes

Signed-off-by: Gilles Espinasse <g.esp@free.fr>
12 years agolsblk: fix reporting of 'part' type
Peter Rajnoha [Fri, 21 Sep 2012 12:23:32 +0000 (14:23 +0200)] 
lsblk: fix reporting of 'part' type

Partitions are incorrectly marked with 'disk' type on
lsblk output while it should be marked as 'part' type.

Before:
$ lsblk /dev/sda
NAME   MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT
sda      8:0    0  128M  0 disk
`-sda1   8:1    0   64M  0 disk

With this patch applied:
$ lsblk /dev/sda
NAME   MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT
sda      8:0    0  128M  0 disk
`-sda1   8:1    0   64M  0 part

Signed-off-by: Peter Rajnoha <prajnoha@redhat.com>
12 years agosu: don't modify PATH if -l not specified
Karel Zak [Tue, 2 Oct 2012 08:14:05 +0000 (10:14 +0200)] 
su: don't modify PATH if -l not specified

This patch reverts a6fdd3f8125be23930d955c2bc6b7a46cdaf8a12.

su(1) modifies PATH if:
  - option -l specified
  - ALWAYS_SET_PATH login.defs variable set

Reported-by: Thomas Bächler <thomas@archlinux.org>
Signed-off-by: Karel Zak <kzak@redhat.com>
12 years agoipcrm: avoid 'uninitialized' warning
Bernhard Voelker [Wed, 5 Sep 2012 13:12:01 +0000 (15:12 +0200)] 
ipcrm: avoid 'uninitialized' warning

GCC 4.1.2 on SLES 10.4:
sys-utils/ipcrm.c: In function ‘main’:
sys-utils/ipcrm.c:297: warning: ‘what_all’ may be used uninitialized in this function

* sys-utils/ipcrm.c: Initialize what_all to ALL.

Signed-off-by: Bernhard Voelker <mail@bernhard-voelker.de>
12 years agoblkdiscard: add new command
Lukas Czerner [Wed, 12 Sep 2012 21:49:15 +0000 (17:49 -0400)] 
blkdiscard: add new command

blkdiscard is used to discard device sectors. This is useful for
solid-state drivers (SSDs) and thinly-provisioned storage. Unlike
fstrim this command is used directly on the block device.

blkkdiscard uses BLKDISCARD ioctl or BLKSECDISCARD ioctl for the secure
discard.

All data in the discarded region on the device will be lost!

Signed-off-by: Lukas Czerner <lczerner@redhat.com>
12 years agoRevert "blkdiscard: new command"
Karel Zak [Thu, 27 Sep 2012 23:10:08 +0000 (01:10 +0200)] 
Revert "blkdiscard: new command"

This was only attempt as alternative implementation, unfortunately
pushed publicly... sorry.

This reverts commit c84ed54cefdcaa07f3d1f40a65434c9d4277da08.

12 years agofdisk: add GPT support
Davidlohr Bueso [Thu, 27 Sep 2012 07:50:27 +0000 (09:50 +0200)] 
fdisk: add GPT support

This patch allows fdisk to handle GUID partition tables, based on the latest UEFI specifications
version 2.3.1, from June 27th, 2012. The following operations are supported:

  - Probing (detects both protective and hybrid MBRs)
  - Writing to disk
  - Listing used partitions
  - Adding partitions
  - Deleting partitions
  - Data integrity verifications (for both headers and partitions).

A few considerations:
  - Currently we do not fix invalid primary headers -- we just abort!
  - Header checksums are updated upon every change (ie: add/delete partitions), this allows us
    to mathematically verify the changes on-the-fly, and not only when writing to disk, like
    most other related tools do.
  - We are extremly picky when writing to disk, any error aborts the opeartion.
  - When creating a new partition, the following GUIDs are available:
     http://en.wikipedia.org/wiki/GUID_Partition_Table#Partition_type_GUIDs

For test cases, the gpt.img from libblkid tests, scsi_debug and my own hard drive (/dev/sda) were used.
For the image, all operations were tested successfully, and for /dev/sda all except write, which
was not tested - hey, I'm not suicidal!

[kzak@redhat.com: - add get/set partition type functions
                  - use unified on strings based table for partition types
                  - add partition type to table list function]

Tested-and-reviewed-by: Petr Uzel <petr.uzel@suse.cz>
Signed-off-by: Davidlohr Bueso <dave@gnu.org>
Signed-off-by: Karel Zak <kzak@redhat.com>
12 years agofdisk: cleanup debug messages and comments
Karel Zak [Wed, 26 Sep 2012 12:31:22 +0000 (14:31 +0200)] 
fdisk: cleanup debug messages and comments

Signed-off-by: Karel Zak <kzak@redhat.com>
12 years agofdisk: use fdisk_parttype in add_partition
Karel Zak [Wed, 26 Sep 2012 12:14:54 +0000 (14:14 +0200)] 
fdisk: use fdisk_parttype  in add_partition

Signed-off-by: Karel Zak <kzak@redhat.com>
12 years agofdisk: add fdisk_set_partition_type()
Karel Zak [Wed, 26 Sep 2012 11:30:44 +0000 (13:30 +0200)] 
fdisk: add fdisk_set_partition_type()

 - remove all label specific partition type stuff from fdisk.c to
   label files
 - add new fdisk_set_partition_type() to API

Signed-off-by: Karel Zak <kzak@redhat.com>
12 years agofdisk: add fdisk_get_partition_type()
Karel Zak [Tue, 25 Sep 2012 10:12:28 +0000 (12:12 +0200)] 
fdisk: add fdisk_get_partition_type()

Signed-off-by: Karel Zak <kzak@redhat.com>
12 years agofdisk: add new functions for work with fdisk_parttype
Karel Zak [Tue, 25 Sep 2012 08:23:36 +0000 (10:23 +0200)] 
fdisk: add new functions for work with fdisk_parttype

 - add flags to fdisk_parttype to store more information about the types
 - function for conversion from code to fdisk_parttype
 - function for conversion from string to fdisk_parttype
 - function for conversion from user input to fdisk_parttype
 - support for unknown complex types (e.g. unknown UUIDs)

Signed-off-by: Karel Zak <kzak@redhat.com>
12 years agofdisk: improve list partition types
Karel Zak [Mon, 24 Sep 2012 11:24:09 +0000 (13:24 +0200)] 
fdisk: improve list partition types

 - add fdisk_parttype->typestr for types like GPT UUID or Mac
 - list typestr if specified

Signed-off-by: Karel Zak <kzak@redhat.com>
12 years agofdisk: move partition types to label specific part
Karel Zak [Mon, 24 Sep 2012 09:30:26 +0000 (11:30 +0200)] 
fdisk: move partition types to label specific part

 - move MBR partition types to dos_part_types.h
 - make dos_part_types.h independent on datetypes to keep it useful in
   all fdisks
 - add struct fdisk_parrtype
 - move label specific partition types to context->label

Signed-off-by: Karel Zak <kzak@redhat.com>
12 years agoblkdiscard: new command
Karel Zak [Thu, 27 Sep 2012 09:21:35 +0000 (11:21 +0200)] 
blkdiscard: new command

Add to fstrim(8) code to support new discard BLKDISCARD and
BLKSECDISCARD ioctls for block devices.  The new command is only
symlink to fstrim(8) as the both utils share some code and the basic
ideas.

Based on patch from Lukas Czerner <lczerner@redhat.com>.

Signed-off-by: Karel Zak <kzak@redhat.com>
12 years agolibmount: don't setup new loopdev on remount with regular mtab
Karel Zak [Wed, 26 Sep 2012 09:25:01 +0000 (11:25 +0200)] 
libmount: don't setup new loopdev on remount with regular mtab

[chroot-i486] root:/tmp$ mount -oloop /tmp/blob /tmp/mnt
[chroot-i486] root:/tmp$ mount -o remount,loop,ro /tmp/mnt
[chroot-i486] root:/tmp$ mount
/dev/loop0 on /tmp/mnt type ext2 (ro,loop)
[chroot-i486] root:/tmp$ losetup -a
/dev/loop0: [2051]:306957 (/tmp/blob)
/dev/loop1: [0005]:2218 (/dev/loop0)
[chroot-i486] root:/tmp$ umount /tmp/mnt
umount: /tmp/mnt: filesystem umounted, but mount(8) failed: Device or
resource busy
[chroot-i486] root:/tmp$ losetup -d /dev/loop1
[chroot-i486] root:/tmp$ losetup -d /dev/loop0

Reported-by: g.esp@free.fr
Signed-off-by: Karel Zak <kzak@redhat.com>
12 years agolibmount: improve debug message
Karel Zak [Tue, 25 Sep 2012 15:04:21 +0000 (17:04 +0200)] 
libmount: improve debug message

Signed-off-by: Karel Zak <kzak@redhat.com>
12 years agolibmount: optimize mtab and utab parsing in umount
Karel Zak [Tue, 25 Sep 2012 14:47:18 +0000 (16:47 +0200)] 
libmount: optimize mtab and utab parsing in umount

create 8000 NFS mountpoints:
#!/bin/bash
mount=/tmp/mount
if [ ! -d $mount ]; then
    mkdir -p $mount
fi
for dir in {1..8000}; do
    if [ ! -d $mount/$dir ]; then
mkdir -p $mount/$dir
    fi
    echo mount $dir
    mount -t nfs 127.0.0.1:/ $mount/$dir
done

old version:
time ./umount /tmp/mount/2255

real 0m1.254s
user 0m1.002s
sys 0m0.238s

new version:
time ./umount /tmp/mount/2244

real 0m0.332s
user 0m0.111s
sys 0m0.218s

Reported-by: chenditang <chendt.fnst@cn.fujitsu.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
12 years agolibmount: user-mounted loopback fs cannot be unmounted by user
Karel Zak [Fri, 21 Sep 2012 15:15:07 +0000 (17:15 +0200)] 
libmount: user-mounted loopback fs cannot be unmounted by user

Addresses: https://bugs.archlinux.org/task/31624
Signed-off-by: Karel Zak <kzak@redhat.com>
12 years agomkswap: wipe old signature if there is no part table by default
Milan Broz [Mon, 10 Sep 2012 10:58:39 +0000 (12:58 +0200)] 
mkswap: wipe old signature if there is no part table by default

Historically mkswap avoids wiping any signature on "whole disk",
until force option is given.

While the idea is that it should not wipe possible boot loader,
in reality it leads to many situations where e.g. LUKS device
is overwritten but still can be detected as LUKS (but unusable).

Patch chnges behaviour that only if partition table is detected,
signatures are not wiped.

Also it removes check for block device - loop device can now
map partitions in-kernel, so using mkswap on disk image in file
should behave the same as on disk.

Also it adds warning that know signature was wiped.

Signed-off-by: Milan Broz <mbroz@redhat.com>
12 years agosu: fix compiler warning [-Wstrict-prototypes]
Karel Zak [Fri, 21 Sep 2012 10:38:18 +0000 (12:38 +0200)] 
su: fix compiler warning [-Wstrict-prototypes]

Signed-off-by: Karel Zak <kzak@redhat.com>
12 years agosu: add segmentation fault reporting of the child process
Ondrej Oprala [Tue, 11 Sep 2012 14:39:17 +0000 (16:39 +0200)] 
su: add segmentation fault reporting of the child process

Child processes that ended with segmentation fault previously
indicated this with return status only. The report is now more
verbose if core dump is allowed.

Improved-by: Pádraig Brady <P@draigBrady.com>
Signed-off-by: Ondrej Oprala <ooprala@redhat.com>
12 years agolsblk: fix processing of dm partition mappings
Peter Rajnoha [Thu, 20 Sep 2012 11:17:13 +0000 (13:17 +0200)] 
lsblk: fix processing of dm partition mappings

As blkid_devno_to_wholedisk returns parent dm device for
a partition mapping, the condition used in lsblk incorrectly
checked the parent-child relationship.

In this particular case, we need to process the dm partition
mapping like any other non-partition device as dm devices always
use proper holders/slaves sysfs hierarchy instead of
/sys/block/<parent>/<name> that is used for real partitions.

Example (test1 is a partition mapping and sdb1 is a real partition):
$ lsblk
NAME             MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT
sda                8:0    0  128M  0 disk
`-test (dm-0)    253:0    0  128M  0 dm
  `-test1 (dm-1) 253:1    0  127M  0 part
sdb                8:16   0  128M  0 disk
`-sdb1             8:17   0  127M  0 disk

Before this patch (test1 skipped!):
$ lsblk -s /dev/mapper/test1
NAME        MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT
test (dm-0) 253:0    0  128M  0 dm
`-sda         8:0    0  128M  0 disk

$ lsblk -s /dev/sdb1
NAME  MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT
sdb1    8:17   0  127M  0 disk
`-sdb   8:16   0  128M  0 disk

With this patch (test1 processed correctly):
$ lsblk -s /dev/mapper/test1
NAME          MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT
test1 (dm-1)  253:1    0  127M  0 part
`-test (dm-0) 253:0    0  128M  0 dm
  `-sda         8:0    0  128M  0 disk

$ lsblk -s /dev/sdb1
NAME  MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT
sdb1    8:17   0  127M  0 disk
`-sdb   8:16   0  128M  0 disk

12 years agolib/sysfs: fix sysfs_devname_to_devno for dm partitions
Peter Rajnoha [Thu, 20 Sep 2012 07:39:57 +0000 (09:39 +0200)] 
lib/sysfs: fix sysfs_devname_to_devno for dm partitions

Partitions mapped by device-mapper are not like real partitions where
there's a /sys/block/<parent>/<name>/dev sysfs path. We need to look
at /sys/block/<name>/dev like we do for any other non-partition devices.
The mapped partition is not found otherwise.

For example, this bug shows up in lsblk while specifying a device
on command line while that device is a dm mapping over a partition:
$lsblk
NAME             MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT
sda                8:0    0  128M  0 disk
`-test (dm-0)    253:0    0  128M  0 dm
  `-test1 (dm-1) 253:1    0  127M  0 part

Before this patch:
$lsblk /dev/mapper/test1
lsblk: dm-1: unknown device name

With this patch:
$lsblk /dev/mapper/test1
NAME         MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT
test1 (dm-1) 253:1    0  127M  0 part

12 years agosetterm: make error message more informative
Petr Uzel [Thu, 20 Sep 2012 13:53:50 +0000 (15:53 +0200)] 
setterm: make error message more informative

If `setterm -dump` fails because of lack of permission to read
/dev/vcsa, it should not report that it couldn't read /dev/vcsa0.
This could be misleading if there is only /dev/vcsa, but not /dev/vcsa0.

Before:
$ ./setterm -dump
setterm: Couldn't read /dev/vcsa0

After:
$ ./setterm -dump
setterm: Couldn't read neither /dev/vcsa0 nor /dev/vcsa

(Note: /dev/vcsa0 does not exist and the user does not have read
permission on /dev/vcsa in this case).

Addresses: https://bugzilla.novell.com/show_bug.cgi?id=780615
Reported-by: Christopher Yeleighton <giecrilj@stegny.2a.pl>
Signed-off-by: Petr Uzel <petr.uzel@suse.cz>
12 years agosfdisk: Fix format specifiers for size_t
Thierry Reding [Wed, 19 Sep 2012 09:48:46 +0000 (11:48 +0200)] 
sfdisk: Fix format specifiers for size_t

The proper specifier for size_t is %zu. %lu will work fine on 64-bit
architectures but not on 32-bit.

Signed-off-by: Thierry Reding <thierry.reding@avionic-design.de>
12 years agohwclock: don't warp the systemtime if the RTC is in UTC
Tom Gundersen [Thu, 20 Sep 2012 22:02:46 +0000 (22:02 +0000)] 
hwclock: don't warp the systemtime if the RTC is in UTC

A sideeffect of 839be2ba6b44fa9dc927f081d547ebadec9de19c is that we now
warp the systemtime according to the timezone, on the first call of
--systz. This is not always the correct thing to do, and causes a
regression for us in Arch Linux.

The behavior is correct if the RTC, and hence the systemtime, is
in localtime. However, if the systemtime is already in UTC we don't
want to touch it when we set the kernel timezone (which we still need to
do as some filesystems use this information).

An almost identical issue was also fixed in systemd commit
72edcff5db936e54cfc322d9392ec46e2428fd9b.

Signed-off-by: Tom Gundersen <teg@jklm.no>
12 years agohwclock: wait time in hwclock is not long enough for some ARM devices
Karel Zak [Fri, 21 Sep 2012 10:05:12 +0000 (12:05 +0200)] 
hwclock: wait time in hwclock is not long enough for some ARM devices

On Sun, Sep 16, 2012 at 02:11:48PM +0800, Queen Adam wrote:
> I'm using Archlinux ARM for my Melo A100 box.
> The hwclock always timeout when using select() in rtc.c.
>
> After I change the timeout from 5 to 10, the problem is solved.
>
> In fact the timeout in my ARM box seems only to be a little larger
> than 5s.

Signed-off-by: Karel Zak <kzak@redhat.com>
12 years agodocs: AUTHORS, NEWS: UTF-8 fixes.
Ville Skyttä [Sat, 15 Sep 2012 06:29:50 +0000 (09:29 +0300)] 
docs: AUTHORS, NEWS: UTF-8 fixes.

Signed-off-by: Ville Skyttä <ville.skytta@iki.fi>
12 years agodocs: umount.8 syntax fix.
Ville Skyttä [Sat, 15 Sep 2012 06:29:49 +0000 (09:29 +0300)] 
docs: umount.8 syntax fix.

Signed-off-by: Ville Skyttä <ville.skytta@iki.fi>
12 years agolibmount: append loop option when automatically create loopdev
Karel Zak [Tue, 18 Sep 2012 09:40:44 +0000 (11:40 +0200)] 
libmount: append loop option when automatically create loopdev

The loop option is optional, mount(8) is able to detect that the
source path is regular file (image) with known filesystem -- then a
loop device is automatically created. In this case we have to store
"loop" option to mtab on systems without autoclear loopdev flag.

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