]> git.ipfire.org Git - thirdparty/util-linux.git/log
thirdparty/util-linux.git
10 years agolibfdisk: add version.c
Karel Zak [Tue, 13 Jan 2015 12:46:31 +0000 (13:46 +0100)] 
libfdisk: add version.c

Signed-off-by: Karel Zak <kzak@redhat.com>
10 years agolibfdisk: fix some typos
Karel Zak [Tue, 13 Jan 2015 12:46:09 +0000 (13:46 +0100)] 
libfdisk: fix some typos

Signed-off-by: Karel Zak <kzak@redhat.com>
10 years agolibblkid: fix compiler warnings [-Wpointer-sign]
Karel Zak [Tue, 13 Jan 2015 12:40:25 +0000 (13:40 +0100)] 
libblkid: fix compiler warnings [-Wpointer-sign]

Signed-off-by: Karel Zak <kzak@redhat.com>
10 years agolibsmartcols: (docs) improve section descriptions
Karel Zak [Tue, 13 Jan 2015 11:23:40 +0000 (12:23 +0100)] 
libsmartcols: (docs) improve section descriptions

Signed-off-by: Karel Zak <kzak@redhat.com>
10 years agolibmount: (docs) add monitor example
Karel Zak [Tue, 13 Jan 2015 11:13:09 +0000 (12:13 +0100)] 
libmount: (docs) add monitor example

Signed-off-by: Karel Zak <kzak@redhat.com>
10 years agodocs: update API docs years
Karel Zak [Tue, 13 Jan 2015 11:03:17 +0000 (12:03 +0100)] 
docs: update API docs years

Signed-off-by: Karel Zak <kzak@redhat.com>
10 years agolibmount: cleanup gtk-docs warnings
Karel Zak [Tue, 13 Jan 2015 10:57:15 +0000 (11:57 +0100)] 
libmount: cleanup gtk-docs warnings

Signed-off-by: Karel Zak <kzak@redhat.com>
10 years agolibsmartcols: cleanup gtk-docs warnings
Karel Zak [Tue, 13 Jan 2015 10:56:57 +0000 (11:56 +0100)] 
libsmartcols: cleanup gtk-docs warnings

Signed-off-by: Karel Zak <kzak@redhat.com>
10 years agolibfdisk: cleanup gtk-docs warnings
Karel Zak [Tue, 13 Jan 2015 10:45:19 +0000 (11:45 +0100)] 
libfdisk: cleanup gtk-docs warnings

Signed-off-by: Karel Zak <kzak@redhat.com>
10 years agoraw: fix raw query
Karel Zak [Tue, 13 Jan 2015 08:53:46 +0000 (09:53 +0100)] 
raw: fix raw query

Bug introduced by commit cd121363.

References: https://bugzilla.redhat.com/show_bug.cgi?id=1181444
Signed-off-by: Karel Zak <kzak@redhat.com>
10 years agohwclock: don't check CMOS automatically on x86_64
Karel Zak [Tue, 13 Jan 2015 08:44:11 +0000 (09:44 +0100)] 
hwclock: don't check CMOS automatically on x86_64

We have enabled CMOS also for x86_64, but it should be available only
if --directisa is explicitly specified.

Signed-off-by: Karel Zak <kzak@redhat.com>
10 years agounshare: add some examples
Lubomir Rintel [Sun, 28 Dec 2014 20:23:37 +0000 (21:23 +0100)] 
unshare: add some examples

...and fix one typo.

Signed-off-by: Lubomir Rintel <lkundrak@v3.sk>
Signed-off-by: Karel Zak <kzak@redhat.com>
10 years agohwclock: man regression
JWP [Fri, 9 Jan 2015 18:43:38 +0000 (13:43 -0500)] 
hwclock: man regression

Fixes merge for commit 2ed1d70 that clobbered commit 98ac774

Signed-off-by: J William Piggott <elseifthen@gmx.com>
10 years agosetarch: cleanup options usage
Karel Zak [Mon, 12 Jan 2015 11:19:54 +0000 (12:19 +0100)] 
setarch: cleanup options usage

* call --help, --verbose and --list from one place only
* add 'archwrapper' variable to detect when called by symplink
* make --list available only got setchar(8) (but no for symlinks)

Reported-by: Benno Schulenberg <bensberg@justemail.net>
Signed-off-by: Karel Zak <kzak@redhat.com>
10 years agodocs: mention that setarch may not be able to set all listed architectures
Benno Schulenberg [Sat, 10 Jan 2015 13:41:33 +0000 (14:41 +0100)] 
docs: mention that setarch may not be able to set all listed architectures

[[kzak@redhat.com: - use minus in option name\

Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
Signed-off-by: Karel Zak <kzak@redhat.com>
10 years agosetarch: differentiate between "unrecognized" and "cannot set"
Benno Schulenberg [Sat, 10 Jan 2015 13:41:32 +0000 (14:41 +0100)] 
setarch: differentiate between "unrecognized" and "cannot set"

When the provided string does not match any architecture that
setarch knows about, the response stays "Unrecognized architecture",
but when trying to set the specified architecture does not have any
effect, then respond with "Kernel cannot set architecture to...".

Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
10 years agopartx: don't use "hard drive" in man pages
Karel Zak [Mon, 12 Jan 2015 10:15:55 +0000 (11:15 +0100)] 
partx: don't use "hard drive" in man pages

Signed-off-by: Karel Zak <kzak@redhat.com>
10 years agodocs: make the wording of the partx man page a bit more precise
Benno Schulenberg [Sun, 11 Jan 2015 21:27:58 +0000 (22:27 +0100)] 
docs: make the wording of the partx man page a bit more precise

Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
10 years agopartx: simplify a --verbose progress message
Benno Schulenberg [Sun, 11 Jan 2015 21:27:57 +0000 (22:27 +0100)] 
partx: simplify a --verbose progress message

Reported-by: Antonio Ceballos <aceballos@gmail.com>
Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
10 years agodocs: remove obsolete and unneeded comments from man-page files
Benno Schulenberg [Sun, 11 Jan 2015 21:27:56 +0000 (22:27 +0100)] 
docs: remove obsolete and unneeded comments from man-page files

Transform some of them into copyright lines.
Also fix three header lines and snip some trailing whitespace.

Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
10 years agodocs: sync the docstring of addpart, delpart and resizepart to the man page
Benno Schulenberg [Sun, 11 Jan 2015 21:27:55 +0000 (22:27 +0100)] 
docs: sync the docstring of addpart, delpart and resizepart to the man page

Also tweak the wording of those man pages a bit.

Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
10 years agopartx: add --update to ul_excl_twq list
Karel Zak [Mon, 12 Jan 2015 09:58:00 +0000 (10:58 +0100)] 
partx: add --update to ul_excl_twq list

Signed-off-by: Karel Zak <kzak@redhat.com>
10 years agolibfdisk: (gpt) cleanup header size usage
Karel Zak [Fri, 9 Jan 2015 12:05:49 +0000 (13:05 +0100)] 
libfdisk: (gpt) cleanup header size usage

Kay reported that Windows 8.1 installed does not recognize GPT created
by libfdisk, but parted works as expected.

It seems (according to the header hexdump) that the problem is
HeaderSize GPT field where libfdisk uses 512 (header + reserved area),
but parted uses 92. The both is pretty valid according to the current
EFI standard, but 92 is probably more backwardly compatible.

I also found places in code where libfdisk gpt driver is inconsistent
and uses sometimes all sector and simetimes sizeof(gpt_header) only.
The right solution is to read all sector (into zeroized memory) and
later write again all sector to the device.

Reported-by: Kay Sievers <kay@vrfy.org>
Signed-off-by: Karel Zak <kzak@redhat.com>
10 years agoMerge branch 'master' of https://github.com/pali/util-linux
Karel Zak [Fri, 9 Jan 2015 09:54:56 +0000 (10:54 +0100)] 
Merge branch 'master' of https://github.com/pali/util-linux

* 'master' of https://github.com/pali/util-linux:
  tests: Add UDF hdd image created by NetBSD newfs_udf (from UDFclient 0.7.7)
  tests: Add UDF hdd image created by NetBSD newfs_udf (from UDFclient 0.7.5)
  tests: Add UDF hdd image created by Linux mkudffs with custom params
  tests: Add UDF hdd image created by Linux mkudffs
  tests: Add UDF hdd image created by Windows 7

10 years agohwclock: man page 'Since v2.26' notes
JWP [Thu, 8 Jan 2015 04:22:01 +0000 (23:22 -0500)] 
hwclock: man page 'Since v2.26' notes

Clean up the 'Since v2.26' man page notes.
They were redundant of information already
in the manual, and became too verbose.

Signed-off-by: J William Piggott <elseifthen@gmx.com>
10 years agohwclock: update man page for v2.26 rc
JWP [Thu, 8 Jan 2015 04:18:52 +0000 (23:18 -0500)] 
hwclock: update man page for v2.26 rc

Authored new section: DATE-TIME CONFIGURATION.
Subsections: Keeping Time..., LOCAL vs UTC, POSIX vs 'RIGHT'.
Errata and drop outdated language.
Updates for v2.26

Signed-off-by: J William Piggott <elseifthen@gmx.com>
10 years agohwclock: Incorrect UTC defaults
JWP [Thu, 8 Jan 2015 04:15:39 +0000 (23:15 -0500)] 
hwclock: Incorrect UTC defaults

Hwclock's default timescale was changed to UTC in:

commit 7894bf0f08740f75610990a2ba76af7a7cbce61e
Date:   Mon Feb 21 13:27:07 2011 +0000

This change was incomplete.

With no /etc/adjtime file the current behavior is:
hwclock --utc --adjust        #Creates a UTC file.
hwclock --localtime --adjust  #File is not created.

That is the opposite of what UTC default should do.

With this patch the behavior is:
hwclock --utc --adjust        #File is not created.
hwclock --localtime --adjust  #Creates a LOCAL file.

'Creates a xxxx file' means: An /etc/adjtime file
is created with zero for all parameters except the
Hardware Clock's timescale field, which is set to
the value indicated by xxxx.

The second item missed in the patch was a test in
the save_adjtime() function that defaults to LOCAL.

Theoretically we cannot get to the save function
without having a value set for adjtime.local_utc,
but the test is there so it needs be correct.

Signed-off-by: J William Piggott <elseifthen@gmx.com>
10 years agohwclock: enable --directisa for x86_64
JWP [Thu, 8 Jan 2015 04:13:21 +0000 (23:13 -0500)] 
hwclock: enable --directisa for x86_64

Currently only x86 and Alpha can use --directisa.
This patch allows x86_64 machines to use it as well.

Signed-off-by: J William Piggott <elseifthen@gmx.com>
10 years agonsenter: add --preserve-credentials and cleanup setgroups() usage
Karel Zak [Thu, 8 Jan 2015 11:52:43 +0000 (12:52 +0100)] 
nsenter: add --preserve-credentials and cleanup setgroups() usage

The new option --preserve-credentials completely disables all
operations related to UIGs and GIDs.

The patch also calls setgroups() before we enter user namespace (so
root can always clear their groups) and after we enter user namespace
(to detect /proc/self/setgroups "deny"). If both fail then nsenter
complains.

Acked-by: "Eric W. Biederman" <ebiederm@xmission.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
10 years agonsenter: keep semantic consistent
Karel Zak [Thu, 8 Jan 2015 11:27:59 +0000 (12:27 +0100)] 
nsenter: keep semantic consistent

The current nseneter behavior is inconsistent and depends on way how
namespace is specified on command line

    # nsenter --user
vs.
    # nseneter --user=filename

if the namespace is specified by <filename> than nsenter does not do
additinal setting and actions (e.g. does not call setgroups, setuid).
This is bug.

Signed-off-by: Karel Zak <kzak@redhat.com>
10 years agounshare: add --setgroups=deny|allow
Karel Zak [Thu, 8 Jan 2015 10:51:58 +0000 (11:51 +0100)] 
unshare: add --setgroups=deny|allow

Since Linux 3.19 the file /proc/self/setgroups controls setgroups(2)
syscall usage in user namespaces. This patch provides command line knob
for this feature.

The new --setgroups does not automatically implies --user to avoid
complexity, it's user's responsibility to use it in right context. The
exception is --map-root-user which is mutually exclusive to
--setgroups=allow.

CC: "Eric W. Biederman" <ebiederm@xmission.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
10 years agounshare: Fix --map-root-user to work on new kernels
Eric W. Biederman [Wed, 17 Dec 2014 23:06:03 +0000 (17:06 -0600)] 
unshare: Fix --map-root-user to work on new kernels

In rare cases droping groups with setgroups(0, NULL) is an operation
that can grant a user additional privileges.  User namespaces were
allwoing that operation to unprivileged users and that had to be
fixed.

Update unshare --map-root-user to disable the setgroups operation
before setting the gid_map.

This is needed as after the security fix gid_map is restricted to
privileged users unless setgroups has been disabled.

Signed-off-by: "Eric W. Biederman" <ebiederm@xmission.com>
10 years agotests: Add UDF hdd image created by NetBSD newfs_udf (from UDFclient 0.7.7)
Pali Rohár [Thu, 8 Jan 2015 16:50:38 +0000 (17:50 +0100)] 
tests: Add UDF hdd image created by NetBSD newfs_udf (from UDFclient 0.7.7)

$ dd if=/dev/zero of=/tmp/test bs=1M count=10
$ newfs_udf -L discname /tmp/test

Version from UDFclient 0.7.7 generate default Volume set identifier correctly.

10 years agotests: Add UDF hdd image created by NetBSD newfs_udf (from UDFclient 0.7.5)
Pali Rohár [Thu, 8 Jan 2015 16:46:58 +0000 (17:46 +0100)] 
tests: Add UDF hdd image created by NetBSD newfs_udf (from UDFclient 0.7.5)

$ dd if=/dev/zero of=/tmp/test bs=1M count=10
$ newfs_udf -L discname /tmp/test

Version from UDFclient 0.7.5 does not generate default Volume set identifier
according to OSTA UDF specification. But it is used so for test is usefull.

10 years agotests: Add UDF hdd image created by Linux mkudffs with custom params
Pali Rohár [Thu, 8 Jan 2015 16:29:58 +0000 (17:29 +0100)] 
tests: Add UDF hdd image created by Linux mkudffs with custom params

$ dd if=/dev/zero of=/tmp/test bs=1M count=10
$ mkudffs -b 512 --lvid=Label --vid=Label --vsid="Volume set identifier" /tmp/test

When calling mkudffs with --vsid param there is bug which cause that garbage
from application stack is copied into Volume set identifier after 8th character.
Characters 1 -- 16 are used in libblkid for generating UUID, so this is perfect
test example that everything is working!

10 years agotests: Add UDF hdd image created by Linux mkudffs
Pali Rohár [Thu, 8 Jan 2015 16:23:32 +0000 (17:23 +0100)] 
tests: Add UDF hdd image created by Linux mkudffs

$ dd if=/dev/zero of=/tmp/test bs=1M count=10
$ mkudffs -b 512 /tmp/test

10 years agotests: Add UDF hdd image created by Windows 7
Pali Rohár [Thu, 8 Jan 2015 16:11:52 +0000 (17:11 +0100)] 
tests: Add UDF hdd image created by Windows 7

10 years agoMerge branch '2015wk01' of https://github.com/kerolasa/lelux-utiliteetit
Karel Zak [Thu, 8 Jan 2015 13:53:01 +0000 (14:53 +0100)] 
Merge branch '2015wk01' of https://github.com/kerolasa/lelux-utiliteetit

* '2015wk01' of https://github.com/kerolasa/lelux-utiliteetit:
  eject: add verbosity to cdrom door lock error
  libblkid: assume strtoull() is available
  ipcs: remove FIXME markup
  ul: remove unexplained TERM=lpr override
  look: remove dead code
  docs: make tools/checkmans.sh to pass without warnings
  build-sys: fix make checkincludes warnings
  docs: add howto-pull-request.txt
  docs: small improvements to howto-contribute.txt

Conflicts:
Documentation/howto-pull-request.txt

10 years agoMerge branch 'master' of https://github.com/pali/util-linux
Karel Zak [Thu, 8 Jan 2015 13:36:20 +0000 (14:36 +0100)] 
Merge branch 'master' of https://github.com/pali/util-linux

* 'master' of https://github.com/pali/util-linux:
  tests: update UDF test (add identifiers)
  libblkid: udf: Fix reading LABEL, add support for UUID and other udf identifiers
  libblkid: superblocks: Add function blkid_probe_set_utf8_id_label for setting utf8 id label

10 years agodocs: add howto-pull-request.txt
Sami Kerola [Wed, 7 Jan 2015 19:25:39 +0000 (19:25 +0000)] 
docs: add howto-pull-request.txt

Reference: http://comments.gmane.org/gmane.linux.utilities.util-linux-ng/10431
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
10 years agodocs: small improvements to howto-contribute.txt
Sami Kerola [Wed, 7 Jan 2015 19:25:38 +0000 (19:25 +0000)] 
docs: small improvements to howto-contribute.txt

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
10 years agoeject: add verbosity to cdrom door lock error
Sami Kerola [Wed, 7 Jan 2015 22:33:09 +0000 (22:33 +0000)] 
eject: add verbosity to cdrom door lock error

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
10 years agolibblkid: assume strtoull() is available
Sami Kerola [Wed, 7 Jan 2015 22:05:43 +0000 (22:05 +0000)] 
libblkid: assume strtoull() is available

The strtoull() is part of ISO/IEC 9899:1999 (aka C99) and the function
has been happily used in prlimit(1) since 2011-10-19 without anyone
complaining compatibility issues.

Reference: http://pubs.opengroup.org/onlinepubs/009695399/functions/strtoul.html
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
10 years agoipcs: remove FIXME markup
Sami Kerola [Wed, 7 Jan 2015 21:44:44 +0000 (21:44 +0000)] 
ipcs: remove FIXME markup

The ipc message q_qbytes information is not in /proc, and it is unlikely
it will ever appear to there.

Reference: https://lkml.org/lkml/2012/11/25/18
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
10 years agoul: remove unexplained TERM=lpr override
Sami Kerola [Wed, 7 Jan 2015 21:30:54 +0000 (21:30 +0000)] 
ul: remove unexplained TERM=lpr override

The FIXME item has been in place since 2011-04-30, and the code has never
made sense, so remove it.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
10 years agolook: remove dead code
Sami Kerola [Wed, 7 Jan 2015 21:24:39 +0000 (21:24 +0000)] 
look: remove dead code

MAP_FILE is ignored compatibility flag.

Reference: http://man7.org/linux/man-pages/man2/mmap.2.html
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
10 years agodocs: make tools/checkmans.sh to pass without warnings
Sami Kerola [Wed, 7 Jan 2015 19:57:54 +0000 (19:57 +0000)] 
docs: make tools/checkmans.sh to pass without warnings

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
10 years agobuild-sys: fix make checkincludes warnings
Sami Kerola [Wed, 7 Jan 2015 19:44:26 +0000 (19:44 +0000)] 
build-sys: fix make checkincludes warnings

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
10 years agodocs: add howto-pull-request.txt
Sami Kerola [Tue, 6 Jan 2015 22:37:52 +0000 (22:37 +0000)] 
docs: add howto-pull-request.txt

Reference: http://comments.gmane.org/gmane.linux.utilities.util-linux-ng/10431
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
10 years agodocs: small improvements to howto-contribute.txt
Sami Kerola [Tue, 6 Jan 2015 20:25:16 +0000 (20:25 +0000)] 
docs: small improvements to howto-contribute.txt

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
10 years agolibsmartcols: use ASCII art for trees rather than padding
Karel Zak [Wed, 7 Jan 2015 14:20:22 +0000 (15:20 +0100)] 
libsmartcols: use ASCII art for trees rather than padding

Based on patch from  Roman Odaisky.

References: https://launchpad.net/bugs/1406133
Signed-off-by: Karel Zak <kzak@redhat.com>
10 years agobuild-sys: support nsenter.static
Karel Zak [Wed, 7 Jan 2015 09:59:16 +0000 (10:59 +0100)] 
build-sys: support nsenter.static

Signed-off-by: Karel Zak <kzak@redhat.com>
10 years agofsck.minix: fix segmentation fault
Sami Kerola [Sat, 3 Jan 2015 09:20:05 +0000 (09:20 +0000)] 
fsck.minix: fix segmentation fault

Return from check_file() and check_file2() functions when maximum name
depth is reached.  The use unsafe strncpy() is also removed just to be on
safe side.

Addresses: https://bugs.debian.org/773892
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
10 years agolslocks: fix type warning
Sami Kerola [Sat, 3 Jan 2015 09:20:04 +0000 (09:20 +0000)] 
lslocks: fix type warning

misc-utils/lslocks.c:229:2: warning: format '%x' expects argument of type
'unsigned int *', but argument 3 has type 'int *' [-Wformat=]

Reference: http://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/tree/fs/locks.c?id=5e0f872c7d7e371fbdf09e864eddd24bddfda8fe#n2533
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
10 years agomaint: fix shadow declaration
Sami Kerola [Wed, 31 Dec 2014 23:01:21 +0000 (23:01 +0000)] 
maint: fix shadow declaration

This change fixes all shadow declarations.  The worth while to mention
fix is with libfdisk sun geometry.  It comes from bitops.h cpu_to_be16
macro that further expands from include/bits/byteswap.h that has the
shadowing.

libfdisk/src/sun.c:961:173: warning: declaration of '__v' shadows a previous local [-Wshadow]
libfdisk/src/sun.c:961:69: warning: shadowed declaration is here [-Wshadow]
libfdisk/src/sun.c:961:178: warning: declaration of '__x' shadows a previous local [-Wshadow]
libfdisk/src/sun.c:961:74: warning: shadowed declaration is here [-Wshadow]

That could have caused earlier some unexpected results.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
10 years agofallocate: create mode 0666, that's what umask is for
Karel Zak [Wed, 7 Jan 2015 08:57:55 +0000 (09:57 +0100)] 
fallocate: create mode 0666, that's what umask is for

User's umask will typically mask the mode down to 0664 or 0644.

Reported-by: Peter Cordes <peter@cordes.ca>
Signed-off-by: Karel Zak <kzak@redhat.com>
10 years agolibmount: (monitor) make mnt_monitor_next_changed() usable for epoll version too
Karel Zak [Tue, 6 Jan 2015 15:18:52 +0000 (16:18 +0100)] 
libmount: (monitor) make mnt_monitor_next_changed() usable for epoll version too

Signed-off-by: Karel Zak <kzak@redhat.com>
10 years agolinmount: (monitor) refresh docs, headers and symbols table
Karel Zak [Wed, 17 Dec 2014 12:09:29 +0000 (13:09 +0100)] 
linmount: (monitor) refresh docs, headers and symbols table

Signed-off-by: Karel Zak <kzak@redhat.com>
10 years agolibmount: (monitor) use inotify for utab lock file
Karel Zak [Wed, 17 Dec 2014 11:50:29 +0000 (12:50 +0100)] 
libmount: (monitor) use inotify for utab lock file

It's better than monitor utab directly. The utab is updated by
rename(2) and it's really tricky for inotify, because it's necessary
to monitor all /run/mount directory and then it's necessary to verify
that the renamed file is really "utab".

The new concept is without possible false positives and it also
triggers the change when utab update is really done.

Signed-off-by: Karel Zak <kzak@redhat.com>
10 years agolibmount: (monitor) add kernel mountninfo monitoring
Karel Zak [Wed, 17 Dec 2014 09:39:37 +0000 (10:39 +0100)] 
libmount: (monitor) add kernel mountninfo monitoring

Signed-off-by: Karel Zak <kzak@redhat.com>
10 years agolibmount: (monitor) cleanup wait/verify stuff
Karel Zak [Tue, 16 Dec 2014 14:28:41 +0000 (15:28 +0100)] 
libmount: (monitor) cleanup wait/verify stuff

Signed-off-by: Karel Zak <kzak@redhat.com>
10 years agolibmount: make public top-level monitor FD only
Karel Zak [Tue, 16 Dec 2014 10:25:52 +0000 (11:25 +0100)] 
libmount: make public top-level monitor FD only

We need full control on changes evaluation, so it's better to
hide all in our private epoll. This change also significantly
simplify the API.

 mn = mnt_new_monitor();
 mnt_monitor_enable_userapce(mn, TRUE, NULL);
 mnt_monitor_enable_kenrel(mn, TRUE);

 fd = mnt_monitor_get_fd(mn);
 ...
   <use 'fd' in epoll controlled by your application>
 ...
 while (mnt_monitor_next_changed(mn, &filename, NULL) == 0)
  printf("%s: change detected\n", filename);

Signed-off-by: Karel Zak <kzak@redhat.com>
10 years agolibmount: monitor unref function refactoring
Karel Zak [Tue, 16 Dec 2014 08:16:09 +0000 (09:16 +0100)] 
libmount: monitor unref function refactoring

Signed-off-by: Karel Zak <kzak@redhat.com>
10 years agolibmount: cleanup monitor test
Karel Zak [Mon, 15 Dec 2014 13:23:54 +0000 (14:23 +0100)] 
libmount: cleanup monitor test

Signed-off-by: Karel Zak <kzak@redhat.com>
10 years agolibmount: split monitor initialization
Karel Zak [Mon, 15 Dec 2014 13:13:25 +0000 (14:13 +0100)] 
libmount: split monitor initialization

The patch introduces mnt_monitor_enable_*() functions (now for
userspace only) to make the API easy to use for high-level purpose.

Signed-off-by: Karel Zak <kzak@redhat.com>
10 years agoipcrm: fix usage
Karel Zak [Tue, 6 Jan 2015 10:55:21 +0000 (11:55 +0100)] 
ipcrm: fix usage

Signed-off-by: Karel Zak <kzak@redhat.com>
10 years agoipc*: use customary fputs() instead of fprintf() with the usage macros
Benno Schulenberg [Wed, 24 Dec 2014 16:56:10 +0000 (17:56 +0100)] 
ipc*: use customary fputs() instead of fprintf() with the usage macros

Also use the clearer word <number> with the --semaphore option.

Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
10 years agotailf: slice up the usage text for ease of translation
Benno Schulenberg [Wed, 24 Dec 2014 16:56:09 +0000 (17:56 +0100)] 
tailf: slice up the usage text for ease of translation

Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
10 years agolook: slice up the usage text for ease of translation
Benno Schulenberg [Wed, 24 Dec 2014 16:56:08 +0000 (17:56 +0100)] 
look: slice up the usage text for ease of translation

Also use the standard macros, and correct the synopsis: use angular
brackets and show that look accepts multiple files.

Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
10 years agocolcrt: slice up the usage text for ease of translation
Benno Schulenberg [Wed, 24 Dec 2014 16:56:07 +0000 (17:56 +0100)] 
colcrt: slice up the usage text for ease of translation

Also use the standard macros for outputting it.

Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
10 years agotextual: list the options of setarch in a more alphabetical order
Benno Schulenberg [Wed, 24 Dec 2014 16:56:06 +0000 (17:56 +0100)] 
textual: list the options of setarch in a more alphabetical order

Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
10 years agosetarch: make the usage synopsis comprehensible for translators
Benno Schulenberg [Wed, 24 Dec 2014 16:56:05 +0000 (17:56 +0100)] 
setarch: make the usage synopsis comprehensible for translators

Use two separate strings for the two different forms of setarch,
instead of filling in an untranslated word into a single string.
Also use the standard angular brackets for nonliteral arguments.

Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
10 years agodocs: restore the alternative form of setarch in its man page
Benno Schulenberg [Wed, 24 Dec 2014 16:56:04 +0000 (17:56 +0100)] 
docs: restore the alternative form of setarch in its man page

Commit c372860ddb4a768f7f6c50cd26d60119370d5cd accidentally removed
the alternative form of setarch in which the command name specifies
the architecture to be set.  Also improve some formatting.

Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
10 years agoipcrm: gettextize the command synopsis of the usage text
Benno Schulenberg [Wed, 24 Dec 2014 16:56:03 +0000 (17:56 +0100)] 
ipcrm: gettextize the command synopsis of the usage text

Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
10 years agoipcs: in usage show resource option as nonoptional when used with -i
Benno Schulenberg [Wed, 24 Dec 2014 16:56:02 +0000 (17:56 +0100)] 
ipcs: in usage show resource option as nonoptional when used with -i

Also, the resource option -a is not valid with -i, so show the valid
ones explicitly.  Also gettextize the synopsis as a single string, as
the two lines are tightly related and other synopses do this too.

Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
10 years agodocs: improve some wordings on the man page of wipefs
Benno Schulenberg [Wed, 24 Dec 2014 16:56:01 +0000 (17:56 +0100)] 
docs: improve some wordings on the man page of wipefs

Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
10 years agotextual: add a docstring to most of the utilities
Benno Schulenberg [Mon, 22 Dec 2014 21:57:17 +0000 (22:57 +0100)] 
textual: add a docstring to most of the utilities

This adds a concise description of a tool to its usage text.

A first form of this patch was proposed by Steven Honeyman
(see http://www.spinics.net/lists/util-linux-ng/msg09994.html).

Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
10 years agochsh: keep struct options in .rodata
Karel Zak [Tue, 6 Jan 2015 10:00:51 +0000 (11:00 +0100)] 
chsh: keep struct options in .rodata

Signed-off-by: Karel Zak <kzak@redhat.com>
10 years agochsh: simplify get_shell_list()
Karel Zak [Tue, 6 Jan 2015 09:57:09 +0000 (10:57 +0100)] 
chsh: simplify get_shell_list()

Signed-off-by: Karel Zak <kzak@redhat.com>
10 years agonewgrp: set function arguments read-only when possible
Sami Kerola [Sat, 20 Dec 2014 12:37:58 +0000 (12:37 +0000)] 
newgrp: set function arguments read-only when possible

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
10 years agonewgrp: move shell determination closer where it is used
Sami Kerola [Sat, 20 Dec 2014 12:26:17 +0000 (12:26 +0000)] 
newgrp: move shell determination closer where it is used

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
10 years agonewgrp: simplify if else clauses
Sami Kerola [Sat, 20 Dec 2014 12:23:06 +0000 (12:23 +0000)] 
newgrp: simplify if else clauses

The 'if' clauses that have termination as either of the control flow
results will never need 'else'.  Making the termination to happen true
flow is enough.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
10 years agochsh: fail get_shell_list() check when /etc/shells cannot be opened
Sami Kerola [Fri, 19 Dec 2014 22:49:32 +0000 (22:49 +0000)] 
chsh: fail get_shell_list() check when /etc/shells cannot be opened

And get rid of stdbool.h true/false usage.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
10 years agochsh: simplify check_shell()
Sami Kerola [Fri, 19 Dec 2014 19:56:29 +0000 (19:56 +0000)] 
chsh: simplify check_shell()

Shell null check is redundant.  The shell can be null only after
ask_new_shell returned such, and that is checked earlier in program
logic.

Secondly the check_shell does not need to return values, in such cases
the program can simply exit.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
10 years agochsh: rewrite function interacting with user to get path to new shell
Sami Kerola [Fri, 19 Dec 2014 19:28:19 +0000 (19:28 +0000)] 
chsh: rewrite function interacting with user to get path to new shell

Rename prompt() to ask_new_shell().  Remove fixed size buffer and
allocate path to new shell, that should make Hurd people happy.  Use
strutils.h for white space trimming.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
10 years agochsh: clean up parse_argv()
Sami Kerola [Sun, 14 Dec 2014 22:58:01 +0000 (22:58 +0000)] 
chsh: clean up parse_argv()

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
10 years agochsh: allow user to set shell to /bin/sh if none is set
Sami Kerola [Sun, 14 Dec 2014 23:20:01 +0000 (23:20 +0000)] 
chsh: allow user to set shell to /bin/sh if none is set

Earlier setting a /bin/sh was impossible for users that had nothing set
as shell, as that was seen as no change.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
10 years agochsh: set few variables read-only and rename one of them
Sami Kerola [Sun, 14 Dec 2014 23:10:48 +0000 (23:10 +0000)] 
chsh: set few variables read-only and rename one of them

This change also improves couple variable initializations.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
10 years agochsh: use getline() to support arbitrarily long lines
Sami Kerola [Sun, 14 Dec 2014 22:50:44 +0000 (22:50 +0000)] 
chsh: use getline() to support arbitrarily long lines

Use of fgets() can make a single long line to be understood as two
entries, and someone could play tricks with the remainder part of the
buffer.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
10 years agochfn, chsh: share illegal_passwd_chars() function
Sami Kerola [Sun, 14 Dec 2014 21:38:56 +0000 (21:38 +0000)] 
chfn, chsh: share illegal_passwd_chars() function

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
10 years agochsh: remove function prototypes
Sami Kerola [Sun, 14 Dec 2014 20:48:12 +0000 (20:48 +0000)] 
chsh: remove function prototypes

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
10 years agocfdisk: improve Dump dialog
Karel Zak [Mon, 5 Jan 2015 11:53:50 +0000 (12:53 +0100)] 
cfdisk: improve Dump dialog

Signed-off-by: Karel Zak <kzak@redhat.com>
10 years agocfdisk: improve menu clean function
Karel Zak [Mon, 5 Jan 2015 11:42:24 +0000 (12:42 +0100)] 
cfdisk: improve menu clean function

Signed-off-by: Karel Zak <kzak@redhat.com>
10 years agocfdisk: detect too small partition sizes
Karel Zak [Mon, 5 Jan 2015 11:13:25 +0000 (12:13 +0100)] 
cfdisk: detect too small partition sizes

References: https://github.com/karelzak/util-linux/issues/136
Signed-off-by: Karel Zak <kzak@redhat.com>
10 years agochfn: fix compilation without libuser
Karel Zak [Fri, 19 Dec 2014 14:05:04 +0000 (15:05 +0100)] 
chfn: fix compilation without libuser

Signed-off-by: Karel Zak <kzak@redhat.com>
10 years agomore: fix compiler warnings
Karel Zak [Fri, 19 Dec 2014 13:34:03 +0000 (14:34 +0100)] 
more: fix compiler warnings

Signed-off-by: Karel Zak <kzak@redhat.com>
10 years agoMerge remote-tracking branch 'sami/2014wk49'
Karel Zak [Fri, 19 Dec 2014 13:28:42 +0000 (14:28 +0100)] 
Merge remote-tracking branch 'sami/2014wk49'

* sami/2014wk49:
  chfn: make command to obey login.defs CHFN_RESTRICT instructions
  chfn: remove set_changed_data() and add add_missing()
  chfn: rename prompt() to ask_new_field()
  chfn: move new and old finger structs to chfn control struct
  chfn: clean up parse_argv()
  chfn: add minimalistic struct chfn_control
  chfn: simplify parse_passwd() by using strsep()
  chfn: fix usage() regression
  chfn: use xasprintf() rather than bunch of strlen() and malloc() calls
  chfn: rewrite prompt() to use strutils
  chfn: remove function prototypes
  lslogins: use hardcoded paths from pathnames.h
  lslogins: add space to systemd journal header and message
  lslogins: reject unknown time format arguments
  lslogins: fix short options
  lslogins: tell why command failed
  lslogins: make journald last logs time stamps to honor --time-format
  lslogins: allow changing password changed and expiration time formats

10 years agoipcs: fix shmctl() usage
Karel Zak [Fri, 19 Dec 2014 12:42:41 +0000 (13:42 +0100)] 
ipcs: fix shmctl() usage

The function shmctl() has to be called with 'struct shmid_ds', and if
you need 'struct shminfo' then the right way is to cast:

bad way:
  struct shm_info info;

  shmctl(0, SHM_INFO, &info);

right way:
  struct shmid_ds buf;
  struct shm_info *info;

  shmctl(0, SHM_INFO, &buf);
  info = (struct shm_info *) &buf);

The patch also fixes bug in ipc_shm_get_limits() where is missing
lim->shmmax in code based on shmctl().

Signed-off-by: Karel Zak <kzak@redhat.com>
10 years agotests: don't check the current ipcs limits
Karel Zak [Fri, 19 Dec 2014 12:36:07 +0000 (13:36 +0100)] 
tests: don't check the current ipcs limits

The ipcs/limit test checks the current kernel limits, but we have no
clue about the current setting, so on on 64bit system it may overflow.

It's better to test for well known limits only. For the random setting
is there ipcs/limit2 test.

Signed-off-by: Karel Zak <kzak@redhat.com>
10 years agomore: blacklist unsigned integer overflow [AddressSanitizer]
Sami Kerola [Wed, 17 Dec 2014 22:57:02 +0000 (22:57 +0000)] 
more: blacklist unsigned integer overflow [AddressSanitizer]

The mbrtowc() return values are overflowing by design.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>