]> git.ipfire.org Git - thirdparty/util-linux.git/log
thirdparty/util-linux.git
7 years agozramctl: be more specific about default output
Karel Zak [Tue, 4 Apr 2017 10:06:45 +0000 (12:06 +0200)] 
zramctl: be more specific about default output

Signed-off-by: Karel Zak <kzak@redhat.com>
7 years agolib/strutils: fix typos in huge size suffixes
Karel Zak [Mon, 3 Apr 2017 10:52:53 +0000 (12:52 +0200)] 
lib/strutils: fix typos in huge size suffixes

Signed-off-by: Karel Zak <kzak@redhat.com>
7 years agotests: add --mountpoint to findmnt calls
Karel Zak [Fri, 31 Mar 2017 12:00:24 +0000 (14:00 +0200)] 
tests: add --mountpoint to findmnt calls

... if necessary to make things more robust.

Signed-off-by: Karel Zak <kzak@redhat.com>
7 years agoutmpdump: remove unnecessary variable
Sami Kerola [Wed, 29 Mar 2017 21:35:05 +0000 (22:35 +0100)] 
utmpdump: remove unnecessary variable

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
7 years agohwclock: remove 1994 Award BIOS workaround
J William Piggott [Fri, 24 Mar 2017 15:03:16 +0000 (11:03 -0400)] 
hwclock: remove 1994 Award BIOS workaround

Remove the 1994 Award BIOS bug workaround as
previously discussed more than two years ago:
http://marc.info/?l=util-linux-ng&m=141682406902804&w=2

* sys-utils/hwclock.c: remove badyear option
* sys-utils/hwclock.h: same
* sys-utils/hwclock.8.in: same

Signed-off-by: J William Piggott <elseifthen@gmx.com>
7 years agotest: fix mountpoint device check in libmount/loop
Ruediger Meier [Fri, 31 Mar 2017 10:09:46 +0000 (12:09 +0200)] 
test: fix mountpoint device check in libmount/loop

This test could fail if the build directory is somehow exoticly
mounted (shared bind mounts, symlinks).

CC: Stanislav Brabec <sbrabec@suse.cz>
Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
7 years agolscpu: fix mem leak [coverity scan]
Karel Zak [Fri, 31 Mar 2017 09:05:26 +0000 (11:05 +0200)] 
lscpu: fix mem leak [coverity scan]

Signed-off-by: Karel Zak <kzak@redhat.com>
7 years agolscpu: check return code [coverity scan]
Karel Zak [Fri, 31 Mar 2017 08:58:50 +0000 (10:58 +0200)] 
lscpu: check return code [coverity scan]

Signed-off-by: Karel Zak <kzak@redhat.com>
7 years agozramctl: make mm_stat parser more robust
Karel Zak [Thu, 30 Mar 2017 10:10:01 +0000 (12:10 +0200)] 
zramctl: make mm_stat parser more robust

Let's fallback to attribute files if mm_stat file is incomplete. It
should not happen, but I have seen RHEL7 kernel where is no
num_migrated/pages_compacted attribute...

Signed-off-by: Karel Zak <kzak@redhat.com>
7 years agoagetty: fix typo
Karel Zak [Mon, 27 Mar 2017 16:02:54 +0000 (18:02 +0200)] 
agetty: fix typo

Signed-off-by: Karel Zak <kzak@redhat.com>
7 years agotests: define columns for fincore test
Karel Zak [Mon, 27 Mar 2017 13:13:17 +0000 (15:13 +0200)] 
tests: define columns for fincore test

Signed-off-by: Karel Zak <kzak@redhat.com>
7 years agoagetty: fix characters reorder in login prompt
Karel Zak [Mon, 27 Mar 2017 12:54:39 +0000 (14:54 +0200)] 
agetty: fix characters reorder in login prompt

The current agetty uses TIOCSTI ioctl to return already read chars
from login name back to the terminal (without read() before
tcsetattr() we will lost data already written by user). The ioctl
based solution is fragile due to race -- we can return chars when
terminal already contains another new chars. The result is reordered
chars in login name.

The solution is to use extra buffer for already read data.

Reported-by: Michael Tretter <m.tretter@pengutronix.de>
Signed-off-by: Karel Zak <kzak@redhat.com>
7 years agounshare: add note about persisten PID namespaces
Karel Zak [Mon, 27 Mar 2017 11:25:31 +0000 (13:25 +0200)] 
unshare: add note about persisten PID namespaces

Signed-off-by: Karel Zak <kzak@redhat.com>
7 years agofincore: add column RES
Karel Zak [Mon, 27 Mar 2017 11:08:40 +0000 (13:08 +0200)] 
fincore: add column RES

Signed-off-by: Karel Zak <kzak@redhat.com>
7 years agotests: remove status=none dd(1) from fincore
Karel Zak [Fri, 24 Mar 2017 12:13:28 +0000 (13:13 +0100)] 
tests: remove status=none dd(1) from fincore

seems dd(1) sucks on travis more than expected:

 dd: invalid status flag: `none'
 Try `dd --help' for more information.

Signed-off-by: Karel Zak <kzak@redhat.com>
7 years agotests: redirect unwanted dd(1) advices to /dev/null
Karel Zak [Fri, 24 Mar 2017 11:23:59 +0000 (12:23 +0100)] 
tests: redirect unwanted dd(1) advices to /dev/null

It seems that dd(1) on travis writes unwanted messages to stdout

  dd: you probably want conv=notrunc with oflag=append

and we do not want conv=

Signed-off-by: Karel Zak <kzak@redhat.com>
7 years agoblkid: fix compiler warning [-Wdiscarded-qualifiers]
Karel Zak [Fri, 24 Mar 2017 11:07:17 +0000 (12:07 +0100)] 
blkid: fix compiler warning [-Wdiscarded-qualifiers]

Let's also hide the show[] array in has_item().

Signed-off-by: Karel Zak <kzak@redhat.com>
7 years agoMerge branch '2017wk11' of git://github.com/kerolasa/lelux-utiliteetit
Karel Zak [Fri, 24 Mar 2017 10:59:57 +0000 (11:59 +0100)] 
Merge branch '2017wk11' of git://github.com/kerolasa/lelux-utiliteetit

* '2017wk11' of git://github.com/kerolasa/lelux-utiliteetit:
  blkid: add control struct
  blkid: simplify version option handling
  tests: add static keyword where needed [smatch scan]
  tests: do not use plain 0 as NULL [smatch scan]
  libsmartcols: fix test variable shadowing

7 years agobash-completion: update fincore to have latest options
Sami Kerola [Thu, 23 Mar 2017 22:05:23 +0000 (22:05 +0000)] 
bash-completion: update fincore to have latest options

Also include --output smartcols fields.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
7 years agoMerge branch 'hwclock-date7-1' of github.com:jwpi/util-linux
Karel Zak [Fri, 24 Mar 2017 10:51:06 +0000 (11:51 +0100)] 
Merge branch 'hwclock-date7-1' of github.com:jwpi/util-linux

* 'hwclock-date7-1' of github.com:jwpi/util-linux:
  hwclock-rtc.c: try the 'new' rtc class first

7 years agolibblkid: fix typo
Karel Zak [Fri, 24 Mar 2017 10:46:33 +0000 (11:46 +0100)] 
libblkid: fix typo

Signed-off-by: Karel Zak <kzak@redhat.com>
7 years agohwclock-rtc.c: try the 'new' rtc class first
J William Piggott [Mon, 13 Mar 2017 00:26:37 +0000 (20:26 -0400)] 
hwclock-rtc.c: try the 'new' rtc class first

* sys-utils/hwclock-rtc.c: try to open the 'new' rtc class driver first.
* sys-utils/hwclock.8.in: document this.

Signed-off-by: J William Piggott <elseifthen@gmx.com>
7 years agobuild-sys: add missing header file
Karel Zak [Thu, 23 Mar 2017 14:59:58 +0000 (15:59 +0100)] 
build-sys: add missing header file

Signed-off-by: Karel Zak <kzak@redhat.com>
7 years agolibblkid: prevent OOB access while probing HFS+
Tobias Stoeckmann [Wed, 15 Mar 2017 21:12:00 +0000 (22:12 +0100)] 
libblkid: prevent OOB access while probing HFS+

It is possible to perform out of boundary read accesses due to
insufficient boundary checks in probe_hfsplus.

The first issue occurs if the leaf count in a B-node is too
small. The second happens while parsing a unicode description which
is longer than 255 UTF-8 characters. The length is stored in a 16 bit
integer, but the array in the struct is limited to 255 * 2, which is
in sync with Apple's Open Source HFS+ implementation (HFSUniStr255).

Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
7 years agotests: refresh fincore test
Karel Zak [Thu, 23 Mar 2017 14:28:39 +0000 (15:28 +0100)] 
tests: refresh fincore test

Signed-off-by: Karel Zak <kzak@redhat.com>
7 years agofincore: fix error on open()
Karel Zak [Thu, 23 Mar 2017 14:28:05 +0000 (15:28 +0100)] 
fincore: fix error on open()

Signed-off-by: Karel Zak <kzak@redhat.com>
7 years agofincore: add --raw and --json
Karel Zak [Thu, 23 Mar 2017 13:34:12 +0000 (14:34 +0100)] 
fincore: add --raw and --json

Signed-off-by: Karel Zak <kzak@redhat.com>
7 years agofincore: add --output
Karel Zak [Thu, 23 Mar 2017 13:27:42 +0000 (14:27 +0100)] 
fincore: add --output

Signed-off-by: Karel Zak <kzak@redhat.com>
7 years agofincore: add --bytes and --noheadings
Karel Zak [Thu, 23 Mar 2017 13:17:46 +0000 (14:17 +0100)] 
fincore: add --bytes and --noheadings

Signed-off-by: Karel Zak <kzak@redhat.com>
7 years agofincore: use libsmartcols
Karel Zak [Thu, 23 Mar 2017 13:09:20 +0000 (14:09 +0100)] 
fincore: use libsmartcols

Signed-off-by: Karel Zak <kzak@redhat.com>
7 years agofincore: cleanup return codes
Karel Zak [Thu, 23 Mar 2017 12:06:34 +0000 (13:06 +0100)] 
fincore: cleanup return codes

Don't use EXIT_* macros as functions return code.

Signed-off-by: Karel Zak <kzak@redhat.com>
7 years agobash-completion: add a function for fincore command
Masatake YAMATO [Tue, 7 Mar 2017 02:33:52 +0000 (11:33 +0900)] 
bash-completion: add a function for fincore command

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
7 years agotests: add cases for testing fincore command
Masatake YAMATO [Tue, 7 Mar 2017 02:33:51 +0000 (11:33 +0900)] 
tests: add cases for testing fincore command

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
7 years agoman: add a page for fincore command
Masatake YAMATO [Tue, 7 Mar 2017 02:33:50 +0000 (11:33 +0900)] 
man: add a page for fincore command

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
7 years agofincore: new command for counting pages of file contents in core
Masatake YAMATO [Tue, 7 Mar 2017 02:33:49 +0000 (11:33 +0900)] 
fincore: new command for counting pages of file contents in core

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
7 years agoMerge remote-tracking branch 'jwpi/hwclock-date7'
Karel Zak [Thu, 23 Mar 2017 11:36:47 +0000 (12:36 +0100)] 
Merge remote-tracking branch 'jwpi/hwclock-date7'

* jwpi/hwclock-date7:
  lib: add parse-date documentation
  hwclock: use parse_date function
  build-sys: add parse-date.y
  lib: add parse-date.y

7 years agoFix menu spelling in cfdisk debug messages
Karel Zak [Wed, 22 Mar 2017 09:43:55 +0000 (10:43 +0100)] 
Fix menu spelling in cfdisk debug messages

Signed-off-by: Karel Zak <kzak@redhat.com>
7 years agoblkid: add control struct
Sami Kerola [Sat, 11 Mar 2017 18:52:56 +0000 (18:52 +0000)] 
blkid: add control struct

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
7 years agoblkid: simplify version option handling
Sami Kerola [Fri, 10 Mar 2017 20:14:10 +0000 (20:14 +0000)] 
blkid: simplify version option handling

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
7 years agotests: add static keyword where needed [smatch scan]
Sami Kerola [Fri, 10 Mar 2017 19:56:16 +0000 (19:56 +0000)] 
tests: add static keyword where needed [smatch scan]

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
7 years agotests: do not use plain 0 as NULL [smatch scan]
Sami Kerola [Fri, 10 Mar 2017 19:50:14 +0000 (19:50 +0000)] 
tests: do not use plain 0 as NULL [smatch scan]

Likewise commit 87918040658f2fa9b1bf78f1f8f4f5c065a2e3a3.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
7 years agolibsmartcols: fix test variable shadowing
Sami Kerola [Sun, 5 Mar 2017 21:02:53 +0000 (21:02 +0000)] 
libsmartcols: fix test variable shadowing

libsmartcols/samples/fromfile.c:57:16: warning: declaration of 'flags'
shadows a global declaration [-Wshadow]
libsmartcols/samples/fromfile.c:29:33: note: shadowed declaration is here
libsmartcols/samples/fromfile.c:101:8: warning: declaration of 'flags'
shadows a global declaration [-Wshadow]

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
7 years agolibfdisk: fix compiler warning [-Wsign-compare]
Karel Zak [Thu, 16 Mar 2017 09:01:54 +0000 (10:01 +0100)] 
libfdisk: fix compiler warning [-Wsign-compare]

Signed-off-by: Karel Zak <kzak@redhat.com>
7 years agotests: refresh lscpu tests
Karel Zak [Wed, 15 Mar 2017 10:49:22 +0000 (11:49 +0100)] 
tests: refresh lscpu tests

.. due to libsmartcols use for the default output. The output does not
contain extra unnecessary blank space anymore.

Signed-off-by: Karel Zak <kzak@redhat.com>
7 years agolscpu: add --json
Karel Zak [Tue, 14 Mar 2017 14:32:53 +0000 (15:32 +0100)] 
lscpu: add --json

Signed-off-by: Karel Zak <kzak@redhat.com>
7 years agolscpu: use libsmartcols to print summary too
Karel Zak [Tue, 14 Mar 2017 14:19:12 +0000 (15:19 +0100)] 
lscpu: use libsmartcols to print summary too

Addresses: https://github.com/karelzak/util-linux/issues/419
Signed-off-by: Karel Zak <kzak@redhat.com>
7 years agofdisk, sfdisk: avoid non-ANSI function declarations [smatch scan]
Sami Kerola [Mon, 20 Feb 2017 22:12:42 +0000 (22:12 +0000)] 
fdisk, sfdisk: avoid non-ANSI function declarations [smatch scan]

Adding _FUNCTION_DEF definition will exclude compatibility type definitions
that do include void key word in empty argument list.

/usr/include/readline/rltypedefs.h:35:23: warning: non-ANSI function
declaration of function 'Function'

These functions has been replaced by set of new ones in readline 4.2 (April
2001), and removed in 6.3 (February 2014).

Reference: https://cnswww.cns.cwru.edu/php/chet/readline/CHANGES
Rererence: https://blueslugs.com/blog/2016-10-23-updating-cppfunction-in-old-readline-consumers/
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
7 years agoblkid: add messages to translations
Sami Kerola [Sun, 5 Mar 2017 20:52:25 +0000 (20:52 +0000)] 
blkid: add messages to translations

Without obvious reason blkid has managed to be part of this project for
pretty long time without getting translations.  Lets change that.  In same
go use the usual error printing facilities instead of fprintf(stderr, ...);

[kzak@redhat.com: - use errtryh(),
                  - cleanup "unsupported output format"]

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
Signed-off-by: Karel Zak <kzak@redhat.com>
7 years agoblkid: add curly braces to do-while statement
Sami Kerola [Sun, 5 Mar 2017 20:52:24 +0000 (20:52 +0000)] 
blkid: add curly braces to do-while statement

Some say people read do-while statements are easily as while statements and
get wrong impression.  This happens because do-whiles are not common.
Adding braces should make it easier to read the code.

Reference: http://www.spinics.net/lists/linux-kernel-janitors/msg02018.html
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
7 years agolibfdisk: fix potentially NULL pointer usage
Karel Zak [Mon, 13 Mar 2017 14:20:56 +0000 (15:20 +0100)] 
libfdisk: fix potentially NULL pointer usage

Reported-by: Sami Kerola <kerolasa@iki.fi>
Signed-off-by: Karel Zak <kzak@redhat.com>
7 years agodocs: improve boilerplate.c options example
Sami Kerola [Sun, 5 Mar 2017 20:52:31 +0000 (20:52 +0000)] 
docs: improve boilerplate.c options example

Make usage() translations to contain complete option help in single
translation unit.  And make -z option example complete.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
7 years agoinclude: fix compiler warning
Sami Kerola [Sun, 5 Mar 2017 20:52:28 +0000 (20:52 +0000)] 
include: fix compiler warning

./include/optutils.h:12:18: warning: null pointer dereference [-Wnull-dereference]
  for (o = opts; o->name; o++)
                 ~^~~~~~
In file included from libfdisk/src/dos.c:12:0:
./include/pt-mbr.h:25:47: warning: potential null pointer dereference [-Wnull-dereference]
  return p[0] | (p[1] << 8) | (p[2] << 16) | (p[3] << 24);
         ~^~~

Well these should be impossible, so add assert() to catch possible bugs.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
7 years agolibblkid: ensure uninitialized variable is not used [clang]
Sami Kerola [Sun, 5 Mar 2017 20:52:23 +0000 (20:52 +0000)] 
libblkid: ensure uninitialized variable is not used [clang]

Following condition can be true if minix file system is corrupt, and versio
number is found to be greater than 3.  It is fair to say described scenario
is unlikely.

libblkid/src/superblocks/minix.c:107:13: warning: variable 'zone_size' is
used uninitialized whenever
      'if' condition is false [-Wsometimes-uninitialized]
        } else if (version == 3) {
                   ^~~~~~~~~~~~
libblkid/src/superblocks/minix.c:121:6: note: uninitialized use occurs here
        if (zone_size != 0 || ninodes == 0 || ninodes == UINT32_MAX)
            ^~~~~~~~~

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
7 years agolibblkid: avoid overflow when initializing array
Sami Kerola [Sun, 5 Mar 2017 20:52:22 +0000 (20:52 +0000)] 
libblkid: avoid overflow when initializing array

libblkid/src/superblocks/drbdmanage.c:38:42: warning: too long
initializer-string for array of char(no space for nul char)

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
7 years agolibmount: fix use of preprocessor identifier
Sami Kerola [Sun, 5 Mar 2017 20:52:21 +0000 (20:52 +0000)] 
libmount: fix use of preprocessor identifier

libmount/src/context_mount.c:990:5: warning: undefined preprocessor
identifier 'USE_LIBMOUNT_SUPPORT_MTAB'

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
7 years agomisc: stop mixing declarations and code
Sami Kerola [Sun, 5 Mar 2017 20:52:20 +0000 (20:52 +0000)] 
misc: stop mixing declarations and code

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
7 years agolib/colors: assert rathen than overflow [-Wnull-dereference]
Karel Zak [Mon, 13 Mar 2017 13:44:22 +0000 (14:44 +0100)] 
lib/colors: assert rathen than overflow [-Wnull-dereference]

lib/colors.c: In function 'colors_read_schemes':
lib/colors.c:412:7: warning: potential null pointer dereference [-Wnull-dereference]

Reported-by: Sami Kerola <kerolasa@iki.fi>
Signed-off-by: Karel Zak <kzak@redhat.com>
7 years agolast: use domain string more carefully
Karel Zak [Mon, 13 Mar 2017 11:55:44 +0000 (12:55 +0100)] 
last: use domain string more carefully

Use xstrcpy() to explicitly terminate the domain string.

Reported-by: Tobias Stoeckmann <tobias@stoeckmann.org>
Signed-off-by: Karel Zak <kzak@redhat.com>
7 years agologin: prevent OOB read on illegal /etc/hushlogins
Tobias Stoeckmann [Sun, 12 Mar 2017 16:49:45 +0000 (17:49 +0100)] 
login: prevent OOB read on illegal /etc/hushlogins

If the file /etc/hushlogins exists and a line starts with '\0', the
login tools are prone to an off-by-one read.

I see no reliability issue with this, as it would clearly need a
hostile action from a system administrator. But for the sake of
correctness, I've sent this patch nonetheless.

7 years agolibblkid: Fix blkid.conf parsing
Tobias Stoeckmann [Sun, 12 Mar 2017 16:48:44 +0000 (17:48 +0100)] 
libblkid: Fix blkid.conf parsing

The SEND_UEVENT=yes|no line is not properly parsed, because the offset
jumps one byte too far behind the equal sign. Therefore, every
configuration that contains the line "SEND_UEVENT=yes" still does not
send an uevent.

The fix is simple: adjust the offset to be "12" instead of "13".

7 years agolib: add parse-date documentation
J William Piggott [Sat, 4 Mar 2017 20:03:44 +0000 (15:03 -0500)] 
lib: add parse-date documentation

* Documentation/parse-date.txt - new file
* sys-utils/hwclock.8.in
Fix the --date option description.

Signed-off-by: J William Piggott <elseifthen@gmx.com>
7 years agohwclock: use parse_date function
J William Piggott [Sat, 4 Mar 2017 16:04:10 +0000 (11:04 -0500)] 
hwclock: use parse_date function

* hwclock.c: replace interpret_date_string() with parse_date().
   Eliminates shell injection vulnerability from popen() date(1).
   Removes system dependency on date(1).
   Reduction in hwclock execution time.
   Significant cleanup of hwclock.c code.

* Bug fix for "hwclock --predict --date 'bad_date'" printing:
    hwclock: No usable set-to time.  Cannot set clock.

  The message now matches date(1) for an invalid --date argument.

Signed-off-by: J William Piggott <elseifthen@gmx.com>
7 years agobuild-sys: add parse-date.y
Karel Zak [Sat, 4 Mar 2017 16:01:56 +0000 (11:01 -0500)] 
build-sys: add parse-date.y

* add lib/parse-date.y to build system
* add necessary autotools stuff to generate .c on the fly
  (autotools are smart enough to add generated file to tarball)
* check for bison version by ./autogen.sh
* add non-wanted junk to .gitignore

With some modification by J William Piggott with regard to
moving the parse-date API into timeutils.h

Signed-off-by: J William Piggott <elseifthen@gmx.com>
7 years agolib: add parse-date.y
J William Piggott [Sat, 4 Mar 2017 15:49:41 +0000 (10:49 -0500)] 
lib: add parse-date.y

* include/timeutils.h
    Add parse-date API

* lib/parse-date.y - new file
    Lib function that parses a date string into a timespec struct.
    Derived from gnulib-dd7a871 parse-datetime.y with these changes:
            * reduced to a single function API renamed to parse_date()
            * removed gnulib dependencies
            * removed debugging
            * converted to util-linux coding style

* include/cctype.h - new file
    Like ctype.h only hard coded to the 'C' locale.
    Used by lib/parse-date.y.
    Derived from gnulib-dd7a871 c-ctype.h with these changes:
            * removed gnulib dependencies
            * converted to util-linux coding style
            * add requisite util-linux constants

Signed-off-by: J William Piggott <elseifthen@gmx.com>
7 years agolibsmartcols: allow to add column to already used table
Karel Zak [Fri, 3 Mar 2017 09:37:37 +0000 (10:37 +0100)] 
libsmartcols: allow to add column to already used table

Now it's impossible to add new column if the table already contains
lines with data. This patch forces library to realloc cell array in
the lines to accept a new column.

Signed-off-by: Karel Zak <kzak@redhat.com>
7 years agolibsmartcols: support columns separators greater than one output cell
Karel Zak [Thu, 2 Mar 2017 15:56:39 +0000 (16:56 +0100)] 
libsmartcols: support columns separators greater than one output cell

Signed-off-by: Karel Zak <kzak@redhat.com>
7 years agosfdisk: note about small partition in man page
Karel Zak [Thu, 2 Mar 2017 12:51:40 +0000 (13:51 +0100)] 
sfdisk: note about small partition in man page

Signed-off-by: Karel Zak <kzak@redhat.com>
7 years agosfdisk: add note about alignment to man page
Karel Zak [Thu, 2 Mar 2017 12:44:26 +0000 (13:44 +0100)] 
sfdisk: add note about alignment to man page

Addresses: https://github.com/karelzak/util-linux/issues/417
Signed-off-by: Karel Zak <kzak@redhat.com>
7 years agocolumn: make more obvious what is default behavior
Karel Zak [Wed, 1 Mar 2017 11:25:16 +0000 (12:25 +0100)] 
column: make more obvious what is default behavior

The man page contains mistakes. The default is to fill columns before
lines:

$ printf 'aaaaaaaaaaaaaaaaaaaaaa\nBBBBBBBBBBBBBBBBBBBBB\nXXXXXXX\nYYYYYYYYYYY\nZZZZZ' > data

$ column --columns 80 < data
aaaaaaaaaaaaaaaaaaaaaa XXXXXXX ZZZZZ
BBBBBBBBBBBBBBBBBBBBB YYYYYYYYYYY

$ column  --fillrows --columns 80 < data
aaaaaaaaaaaaaaaaaaaaaa BBBBBBBBBBBBBBBBBBBBB XXXXXXX
YYYYYYYYYYY ZZZZZ

The patch also rename functions in the code to make it more obvious
for code readers.

Signed-off-by: Karel Zak <kzak@redhat.com>
7 years agolibmount: cosmetic change to mnt_table_find_srcpath()
Karel Zak [Tue, 28 Feb 2017 13:47:02 +0000 (14:47 +0100)] 
libmount: cosmetic change to mnt_table_find_srcpath()

Signed-off-by: Karel Zak <kzak@redhat.com>
7 years agolibmount: return tab entry for default node
Petr Vorel [Thu, 23 Feb 2017 18:25:13 +0000 (19:25 +0100)] 
libmount: return tab entry for default node

This is useful for lsblk.

Signed-off-by: Petr Vorel <pvorel@suse.cz>
7 years agosetterm: fix bitfield warning [smatch]
Sami Kerola [Sat, 25 Feb 2017 17:35:17 +0000 (17:35 +0000)] 
setterm: fix bitfield warning [smatch]

term-utils/setterm.c:179:27: warning: dubious bitfield without explicit
`signed' or `unsigned'

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
7 years agolibfdisk: (dos) add ID related debug messages
Karel Zak [Mon, 27 Feb 2017 12:44:08 +0000 (13:44 +0100)] 
libfdisk: (dos) add ID related debug messages

Signed-off-by: Karel Zak <kzak@redhat.com>
7 years agolibfdisk: add version to debug output
Karel Zak [Mon, 27 Feb 2017 12:16:18 +0000 (13:16 +0100)] 
libfdisk: add version to debug output

Signed-off-by: Karel Zak <kzak@redhat.com>
7 years agoagetty: fix a memory leak when parsing \S in issue files
Matthias Gerstner [Mon, 27 Feb 2017 11:03:57 +0000 (12:03 +0100)] 
agetty: fix a memory leak when parsing \S in issue files

7 years agounshare: add note about sysfs and procfs
Karel Zak [Mon, 27 Feb 2017 11:09:35 +0000 (12:09 +0100)] 
unshare: add note about sysfs and procfs

Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=1390057
Signed-off-by: Karel Zak <kzak@redhat.com>
7 years agodocs: add note about branches to README
Karel Zak [Fri, 24 Feb 2017 13:19:04 +0000 (14:19 +0100)] 
docs: add note about branches to README

Signed-off-by: Karel Zak <kzak@redhat.com>
7 years agoblkzone: add count option to bash-completion
Karel Zak [Fri, 24 Feb 2017 11:05:13 +0000 (12:05 +0100)] 
blkzone: add count option to bash-completion

and fix typo in man page

Signed-off-by: Karel Zak <kzak@redhat.com>
7 years agoblkzone: use optutils.h to check mutually exclusive options
Karel Zak [Fri, 24 Feb 2017 10:59:53 +0000 (11:59 +0100)] 
blkzone: use optutils.h to check mutually exclusive options

Signed-off-by: Karel Zak <kzak@redhat.com>
7 years agoblkzone: Add --count option
Damien Le Moal [Fri, 24 Feb 2017 06:45:31 +0000 (15:45 +0900)] 
blkzone: Add --count option

The length option is used to specify the number of zones to
operate on. To be more consistent with other tools, have this
option use a number of sectors and introduce the --count option
to allow users to specify a number of zones.
The --count and --length options cannot be used together on
the command line.

Signed-off-by: Damien Le Moal <damien.lemoal@wdc.com>
7 years agoblkzone: Improve zone information print
Damien Le Moal [Fri, 24 Feb 2017 03:47:29 +0000 (12:47 +0900)] 
blkzone: Improve zone information print

Add "0x" to the zone start, length and write pointer print
to make it always clear that the values are Hexadecimal.

Also update the zone condition string and associated comments
to match more closely the wording in the standard document.
The man page is also updated to match the new wording.

Signed-off-by: Damien Le Moal <damien.lemoal@wdc.com>
7 years agoblkzone: Report all zones if length is not specified
Damien Le Moal [Fri, 24 Feb 2017 03:36:08 +0000 (12:36 +0900)] 
blkzone: Report all zones if length is not specified

Report all zones of the block device when length is not specified
on the command line. To do this, introduce an inner loop in
blkzone_report to repeatedly issue report zone ioctl to the
device.

Signed-off-by: Damien Le Moal <damien.lemoal@wdc.com>
7 years agoblkzone: Reset all zones when length is not specified
Damien Le Moal [Fri, 24 Feb 2017 02:48:45 +0000 (11:48 +0900)] 
blkzone: Reset all zones when length is not specified

If length is 0, operate on all zones starting from offset.
This also fix the maximum length calculation from offset.

Signed-off-by: Damien Le Moal <damien.lemoal@wdc.com>
7 years agoblkreport, blkreset: remove in favour of blkzone
Karel Zak [Thu, 23 Feb 2017 16:03:26 +0000 (17:03 +0100)] 
blkreport, blkreset: remove in favour of blkzone

Signed-off-by: Karel Zak <kzak@redhat.com>
7 years agoblkzone: add bash-completion
Karel Zak [Thu, 23 Feb 2017 16:01:29 +0000 (17:01 +0100)] 
blkzone: add bash-completion

Signed-off-by: Karel Zak <kzak@redhat.com>
7 years agoblkzone: add new command (merge blkreport and blkreset)
Karel Zak [Thu, 23 Feb 2017 15:43:51 +0000 (16:43 +0100)] 
blkzone: add new command (merge blkreport and blkreset)

This new command is based on the original implementation of blkreport
and blkreset command.

Signed-off-by: Karel Zak <kzak@redhat.com>
7 years agobuild-sys: simplify UL_ENABLE_ALIAS() semantic
Karel Zak [Tue, 21 Feb 2017 10:00:19 +0000 (11:00 +0100)] 
build-sys: simplify UL_ENABLE_ALIAS() semantic

Let's follow only $enable_ variables. In this case the MASTERNAME
(e.g. [schedutils] for --enable-schedutils) has to be without
UL_BUILD_INIT.

Signed-off-by: Karel Zak <kzak@redhat.com>
7 years agobuild-sys: fix --disable-all-programs --enable-schedutils
Karel Zak [Mon, 20 Feb 2017 13:17:37 +0000 (14:17 +0100)] 
build-sys: fix --disable-all-programs --enable-schedutils

* add UL_ENABLE_ALIAS(NAME, MASTERNAME) to initialize $enable_<name>
  according to MASTERNAME. Note that we have to use $build_<mastername>,
  the $enable_<mastername> is just AC_ARG_ENABLE() stuff only. The
  $build_ is evaluated and modified by our UL_...() functions.

* add enable-schedutils.conf to have build-system regression test for
  this use-case

Addresses: https://github.com/karelzak/util-linux/issues/415
Signed-off-by: Karel Zak <kzak@redhat.com>
7 years agotests: another improvement to the sfdisk wipe test
Karel Zak [Mon, 20 Feb 2017 12:22:55 +0000 (13:22 +0100)] 
tests: another improvement to the sfdisk wipe test

Signed-off-by: Karel Zak <kzak@redhat.com>
7 years agolibblkid: remove unnecessary 'static' keyword
Karel Zak [Mon, 20 Feb 2017 12:08:30 +0000 (13:08 +0100)] 
libblkid: remove unnecessary 'static' keyword

Signed-off-by: Karel Zak <kzak@redhat.com>
7 years agofindmnt: fix couple memory leaks [cppcheck]
Sami Kerola [Sun, 12 Feb 2017 20:42:49 +0000 (20:42 +0000)] 
findmnt: fix couple memory leaks [cppcheck]

In both cases FILE *f was leaked.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
7 years agolibblkid: declare across file variables in blkidP.h [smatch scan]
Sami Kerola [Sun, 12 Feb 2017 18:48:21 +0000 (18:48 +0000)] 
libblkid: declare across file variables in blkidP.h [smatch scan]

Else these variables will cause following warning:

libblkid/src/superblocks/superblocks.c:165:29: warning: symbol
'superblocks_drv' was not declared.  Should it be static?

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
7 years agolib/idcache: add void to function declaration [smatch scan]
Sami Kerola [Sun, 12 Feb 2017 08:25:03 +0000 (08:25 +0000)] 
lib/idcache: add void to function declaration [smatch scan]

lib/idcache.c:29:29: warning: non-ANSI function declaration of function
'new_idcache'

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
7 years agomisc: add static keyword to where needed [smatch scan]
Sami Kerola [Sun, 12 Feb 2017 00:19:33 +0000 (00:19 +0000)] 
misc: add static keyword to where needed [smatch scan]

text-utils/rev.c:68:9: warning: symbol 'buf' was not declared. Should it be
static?

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
7 years agomisc: do not use plain 0 as NULL [smatch scan]
Sami Kerola [Sat, 11 Feb 2017 20:23:26 +0000 (20:23 +0000)] 
misc: do not use plain 0 as NULL [smatch scan]

text-utils/tailf.c:69:21: warning: Using plain integer as NULL pointer

Since many 'struct option' has used zero as NULL make them more readable in
same go by reindenting, and using named argument requirements.

Reference: https://lwn.net/Articles/93577/
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
7 years agocfdisk: avoid use of VLA in combination with sizeof() [smatch scan]
Sami Kerola [Sat, 11 Feb 2017 19:01:08 +0000 (19:01 +0000)] 
cfdisk: avoid use of VLA in combination with sizeof() [smatch scan]

disk-utils/cfdisk.c:1066:29: error: cannot size expression

One should use sizeof() only when variable size can be known at time of
compilation.  That is not the case with variable length arrays.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
7 years agotests: make sfdisk wipe partition optional
Karel Zak [Fri, 17 Feb 2017 15:24:35 +0000 (16:24 +0100)] 
tests: make sfdisk wipe partition optional

Signed-off-by: Karel Zak <kzak@redhat.com>
7 years agolibfdisk: add sample-fdisk-mkpart binary
Karel Zak [Fri, 17 Feb 2017 15:15:03 +0000 (16:15 +0100)] 
libfdisk: add sample-fdisk-mkpart binary

For example:
# sample-fdisk-mkpart --device /dev/sdc 1M 2M 3M - 5M

# fdisk -l /dev/sdc
...
Device     Boot Start    End Sectors Size Id Type
/dev/sdc1        2048   4095    2048   1M 83 Linux
/dev/sdc2        4096   8191    4096   2M 83 Linux
/dev/sdc3        8192  14335    6144   3M 83 Linux
/dev/sdc4       14336 204799  190464  93M  5 Extended
/dev/sdc5       16384  26623   10240   5M 83 Linux

Addresses: https://github.com/karelzak/util-linux/issues/204
Signed-off-by: Karel Zak <kzak@redhat.com>
7 years agolibfdisk: (dos) make it possible to create primary/logical by template
Karel Zak [Fri, 17 Feb 2017 15:11:37 +0000 (16:11 +0100)] 
libfdisk: (dos) make it possible to create primary/logical by template

Let's check partition partno if specified to create logical or primary
partition.

Addresses: https://github.com/karelzak/util-linux/issues/204
Signed-off-by: Karel Zak <kzak@redhat.com>
7 years agolibfdisk: (gpt) make sure it's GPT in public API
Karel Zak [Fri, 17 Feb 2017 13:47:00 +0000 (14:47 +0100)] 
libfdisk: (gpt) make sure it's GPT in public API

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