]> git.ipfire.org Git - thirdparty/util-linux.git/log
thirdparty/util-linux.git
8 years agofindmnt: (verify) check filesystem type
Karel Zak [Thu, 22 Sep 2016 11:40:24 +0000 (13:40 +0200)] 
findmnt: (verify) check filesystem type

Signed-off-by: Karel Zak <kzak@redhat.com>
8 years agofindmnt: (verify) add swaparea verification
Karel Zak [Wed, 21 Sep 2016 13:08:24 +0000 (15:08 +0200)] 
findmnt: (verify) add swaparea verification

Signed-off-by: Karel Zak <kzak@redhat.com>
8 years agofindmnt: (verify) add options verification
Karel Zak [Wed, 21 Sep 2016 12:32:47 +0000 (14:32 +0200)] 
findmnt: (verify) add options verification

Signed-off-by: Karel Zak <kzak@redhat.com>
8 years agofindmnt: (verify) add source verification
Karel Zak [Wed, 21 Sep 2016 12:15:49 +0000 (14:15 +0200)] 
findmnt: (verify) add source verification

Signed-off-by: Karel Zak <kzak@redhat.com>
8 years agofindmnt: add --verify and --verbose
Karel Zak [Tue, 20 Sep 2016 13:45:15 +0000 (15:45 +0200)] 
findmnt: add --verify and --verbose

Signed-off-by: Karel Zak <kzak@redhat.com>
8 years agolibsmartcols: use const qualifier for scols_table_get_termwidth
Igor Gnatenko [Fri, 23 Sep 2016 09:24:28 +0000 (11:24 +0200)] 
libsmartcols: use const qualifier for scols_table_get_termwidth

Signed-off-by: Igor Gnatenko <i.gnatenko.brain@gmail.com>
8 years agoMerge branch 'api_const' of https://github.com/ignatenkobrain/util-linux
Karel Zak [Fri, 23 Sep 2016 09:14:15 +0000 (11:14 +0200)] 
Merge branch 'api_const' of https://github.com/ignatenkobrain/util-linux

* 'api_const' of https://github.com/ignatenkobrain/util-linux:
  libsmartcols: use const qualifier where it's possible
  debug: use const void * for ul_debugobj()
  libsmartcols: make get_line/column_separator() return const

8 years agoMerge branch 'master' of https://github.com/ignatenkobrain/util-linux
Karel Zak [Fri, 23 Sep 2016 09:07:15 +0000 (11:07 +0200)] 
Merge branch 'master' of https://github.com/ignatenkobrain/util-linux

8 years agolibsmartcols: keep scols_table_get_termwidth() read-only
Karel Zak [Thu, 22 Sep 2016 11:47:23 +0000 (13:47 +0200)] 
libsmartcols: keep scols_table_get_termwidth() read-only

Addresses: https://github.com/karelzak/util-linux/issues/356
Signed-off-by: Karel Zak <kzak@redhat.com>
8 years agoswapon: fix discard option parsing
Karel Zak [Wed, 21 Sep 2016 12:47:32 +0000 (14:47 +0200)] 
swapon: fix discard option parsing

The current code does not work as expected if there is an option
behind the discard=<arg>, for example:

  swapon /dev/sdc -o discard=once,pri=10

ignores "once" the result is SWAP_FLAG_DISCARD; strace:

Old version:

  swapon("/dev/sdc", SWAP_FLAG_PREFER|SWAP_FLAG_DISCARD|10) = 0

Fixed version:

  swapon("/dev/sdc", SWAP_FLAG_PREFER|SWAP_FLAG_DISCARD|SWAP_FLAG_DISCARD_ONCE|10) = 0

Signed-off-by: Karel Zak <kzak@redhat.com>
8 years agolibsmartcols: use const qualifier where it's possible
Igor Gnatenko [Wed, 21 Sep 2016 06:30:48 +0000 (08:30 +0200)] 
libsmartcols: use const qualifier where it's possible

Closes: https://github.com/karelzak/util-linux/issues/355
Signed-off-by: Igor Gnatenko <i.gnatenko.brain@gmail.com>
8 years agodebug: use const void * for ul_debugobj()
Igor Gnatenko [Wed, 21 Sep 2016 06:22:35 +0000 (08:22 +0200)] 
debug: use const void * for ul_debugobj()

We don't modify data it's pointing out and we should not modify it.

Also remove casting to void * as gcc will do it automatically (before
we had to cast it explicitly to avoid warning on discarding 'const'
qualifier).

Signed-off-by: Igor Gnatenko <i.gnatenko.brain@gmail.com>
8 years agolibsmartcols: make get_line/column_separator() return const
Igor Gnatenko [Wed, 21 Sep 2016 05:25:23 +0000 (07:25 +0200)] 
libsmartcols: make get_line/column_separator() return const

The patch introduces tiny API changes (char * -> const char *) for
    scols_table_get_line_separator
    scols_table_get_column_separator

Signed-off-by: Igor Gnatenko <i.gnatenko.brain@gmail.com>
8 years agotrivial: use tabs consistently
Igor Gnatenko [Tue, 20 Sep 2016 13:36:55 +0000 (15:36 +0200)] 
trivial: use tabs consistently

Signed-off-by: Igor Gnatenko <i.gnatenko.brain@gmail.com>
8 years agoMerge branch 'hotfix' of https://github.com/ignatenkobrain/util-linux
Karel Zak [Mon, 19 Sep 2016 12:21:18 +0000 (14:21 +0200)] 
Merge branch 'hotfix' of https://github.com/ignatenkobrain/util-linux

8 years agoMerge branch 'typos' of https://github.com/ignatenkobrain/util-linux
Karel Zak [Mon, 19 Sep 2016 12:20:37 +0000 (14:20 +0200)] 
Merge branch 'typos' of https://github.com/ignatenkobrain/util-linux

* 'typos' of https://github.com/ignatenkobrain/util-linux:
  libsmartcols: fix typos in docs

8 years agolibsmartcols: be consistent, use 'sy' for symbols
Igor Gnatenko [Sat, 17 Sep 2016 16:55:52 +0000 (18:55 +0200)] 
libsmartcols: be consistent, use 'sy' for symbols

Signed-off-by: Igor Gnatenko <i.gnatenko.brain@gmail.com>
8 years agolibsmartcols: fix typos in docs
Igor Gnatenko [Sun, 18 Sep 2016 09:47:13 +0000 (11:47 +0200)] 
libsmartcols: fix typos in docs

Signed-off-by: Igor Gnatenko <i.gnatenko.brain@gmail.com>
8 years agolibsmartcols: be more strict about empty tables
Karel Zak [Mon, 19 Sep 2016 12:07:38 +0000 (14:07 +0200)] 
libsmartcols: be more strict about empty tables

and don't print extra \n for empty table.

Signed-off-by: Karel Zak <kzak@redhat.com>
8 years agolibsmartcols: fix comment
Karel Zak [Mon, 19 Sep 2016 11:48:42 +0000 (13:48 +0200)] 
libsmartcols: fix comment

Signed-off-by: Karel Zak <kzak@redhat.com>
8 years agolibsmartcols: cleanup get functions
Karel Zak [Mon, 19 Sep 2016 11:39:03 +0000 (13:39 +0200)] 
libsmartcols: cleanup get functions

The patch introduces tiny API changes (int -> size_t) for

scols_table_get_ncols
scols_table_get_nlines

Addresses: https://github.com/karelzak/util-linux/issues/349
Signed-off-by: Karel Zak <kzak@redhat.com>
8 years agotests: add columns separator to libsmartcols test
Karel Zak [Fri, 16 Sep 2016 12:18:01 +0000 (14:18 +0200)] 
tests: add columns separator to libsmartcols test

Signed-off-by: Karel Zak <kzak@redhat.com>
8 years agotests: add export and raw to libsmartcols test
Karel Zak [Fri, 16 Sep 2016 11:49:37 +0000 (13:49 +0200)] 
tests: add export and raw to libsmartcols test

Signed-off-by: Karel Zak <kzak@redhat.com>
8 years agotests: add libsmartcols JSON test
Karel Zak [Fri, 16 Sep 2016 11:37:08 +0000 (13:37 +0200)] 
tests: add libsmartcols JSON test

Signed-off-by: Karel Zak <kzak@redhat.com>
8 years agolibsmartcols: add JSON support to sample application
Karel Zak [Fri, 16 Sep 2016 11:30:29 +0000 (13:30 +0200)] 
libsmartcols: add JSON support to sample application

Signed-off-by: Karel Zak <kzak@redhat.com>
8 years agolibsmartcols: improve JSON
Karel Zak [Fri, 16 Sep 2016 11:22:47 +0000 (13:22 +0200)] 
libsmartcols: improve JSON

Signed-off-by: Karel Zak <kzak@redhat.com>
8 years agolibsmartcols: cleanup line separator usage
Karel Zak [Fri, 16 Sep 2016 11:00:47 +0000 (13:00 +0200)] 
libsmartcols: cleanup line separator usage

 * use line separator only to separate lines, not after last line
 * explicitly print \n after table in scols_print_table()
 * don't terminate table by \n or line separator in scols_print_table_to_string()

Note that the patch is little bit trick due to impact to the trees
printing. Now print_tree_line() should be more readable.

Signed-off-by: Karel Zak <kzak@redhat.com>
8 years agotests: add libsmartcols wrap and wrapnl tree tests
Karel Zak [Thu, 15 Sep 2016 10:32:58 +0000 (12:32 +0200)] 
tests: add libsmartcols wrap and wrapnl tree tests

Signed-off-by: Karel Zak <kzak@redhat.com>
8 years agotests: add tree libsmartcols test files
Karel Zak [Thu, 15 Sep 2016 10:25:08 +0000 (12:25 +0200)] 
tests: add tree libsmartcols test files

Signed-off-by: Karel Zak <kzak@redhat.com>
8 years agolibsmartcols: fix tree padding
Karel Zak [Thu, 15 Sep 2016 10:22:12 +0000 (12:22 +0200)] 
libsmartcols: fix tree padding

We cannot use cell-padding char with in tree ASCII art, because
tree uses two chars rather than one.

Signed-off-by: Karel Zak <kzak@redhat.com>
8 years agolibsmartcols: add support for trees to the sample application
Karel Zak [Thu, 15 Sep 2016 10:12:18 +0000 (12:12 +0200)] 
libsmartcols: add support for trees to the sample application

Signed-off-by: Karel Zak <kzak@redhat.com>
8 years agoMerge branch 'patch-1' of https://github.com/ignatenkobrain/util-linux
Karel Zak [Thu, 15 Sep 2016 08:05:15 +0000 (10:05 +0200)] 
Merge branch 'patch-1' of https://github.com/ignatenkobrain/util-linux

8 years agotrivial: s/automatical/automatic/g
Igor Gnatenko [Wed, 14 Sep 2016 17:36:51 +0000 (19:36 +0200)] 
trivial: s/automatical/automatic/g

"Automatical" is archaic form of "automatic".

Signed-off-by: Igor Gnatenko <i.gnatenko.brain@gmail.com>
8 years agosmartcols/symbols: free cell_padding in unref()
Igor Gnatenko [Tue, 13 Sep 2016 13:06:49 +0000 (15:06 +0200)] 
smartcols/symbols: free cell_padding in unref()

Signed-off-by: Igor Gnatenko <ignatenko@redhat.com>
8 years agotests: add missing expected/ dir stuff
Karel Zak [Wed, 14 Sep 2016 15:02:54 +0000 (17:02 +0200)] 
tests: add missing expected/ dir stuff

Signed-off-by: Karel Zak <kzak@redhat.com>
8 years agotests: add libsmartcols title test
Karel Zak [Wed, 14 Sep 2016 10:49:46 +0000 (12:49 +0200)] 
tests: add libsmartcols title test

Signed-off-by: Karel Zak <kzak@redhat.com>
8 years agotests: add another libsmartcols tests
Karel Zak [Wed, 14 Sep 2016 10:38:34 +0000 (12:38 +0200)] 
tests: add another libsmartcols tests

Signed-off-by: Karel Zak <kzak@redhat.com>
8 years agolibsmartcols: fix hidden file usage
Karel Zak [Wed, 14 Sep 2016 10:37:53 +0000 (12:37 +0200)] 
libsmartcols: fix hidden file usage

Signed-off-by: Karel Zak <kzak@redhat.com>
8 years agobuild-sys: remove dead libsmartcols sample
Karel Zak [Tue, 13 Sep 2016 14:50:10 +0000 (16:50 +0200)] 
build-sys: remove dead libsmartcols sample

Signed-off-by: Karel Zak <kzak@redhat.com>
8 years agotests: improve libsmartcols test
Karel Zak [Tue, 13 Sep 2016 12:12:11 +0000 (14:12 +0200)] 
tests: improve libsmartcols test

Signed-off-by: Karel Zak <kzak@redhat.com>
8 years agolibsmartcols: add functions to control terminal usage
Karel Zak [Tue, 13 Sep 2016 12:06:01 +0000 (14:06 +0200)] 
libsmartcols: add functions to control terminal usage

Signed-off-by: Karel Zak <kzak@redhat.com>
8 years agolibsmartcols: add application to test library features
Karel Zak [Tue, 13 Sep 2016 11:08:02 +0000 (13:08 +0200)] 
libsmartcols: add application to test library features

Signed-off-by: Karel Zak <kzak@redhat.com>
8 years agolibsmartcols: fix WRAPNL on strings without \n
Karel Zak [Mon, 12 Sep 2016 14:12:22 +0000 (16:12 +0200)] 
libsmartcols: fix WRAPNL on strings without \n

Addresses: https://github.com/karelzak/util-linux/issues/343
Signed-off-by: Karel Zak <kzak@redhat.com>
8 years agolibsmartcols: fix WRAPNL crashes
Karel Zak [Mon, 12 Sep 2016 09:58:34 +0000 (11:58 +0200)] 
libsmartcols: fix WRAPNL crashes

Addresses: https://github.com/karelzak/util-linux/issues/344
Signed-off-by: Karel Zak <kzak@redhat.com>
8 years agomount: add note about another flags for "remount,bind"
Karel Zak [Thu, 8 Sep 2016 09:57:34 +0000 (11:57 +0200)] 
mount: add note about another flags for "remount,bind"

The man page is talking about read-only bind mounts (-o
remount,bind,ro), but this feature also works for another VFS flags
like nodev, suid, etc. For example:

 mount -o remount,bind,noatime /mountpoint

is a valid command.

Addresses: https://github.com/karelzak/util-linux/issues/342
Signed-off-by: Karel Zak <kzak@redhat.com>
8 years agolibsmartcols: support LIBSMARTCOLS_DEBUG_PADDING=on
Karel Zak [Wed, 7 Sep 2016 10:25:06 +0000 (12:25 +0200)] 
libsmartcols: support LIBSMARTCOLS_DEBUG_PADDING=on

This env.variable forces libsmartcols to use visible padding chars.
The standard debug has to be enabled (to minimize overhead for
non-debug execution).

For example:

 $ LIBSMARTCOLS_DEBUG=all LIBSMARTCOLS_DEBUG_PADDING=on findmnt 2> ~/log

Signed-off-by: Karel Zak <kzak@redhat.com>
8 years agolibsmartcols: add fallback for symbols
Karel Zak [Wed, 7 Sep 2016 09:45:35 +0000 (11:45 +0200)] 
libsmartcols: add fallback for symbols

Signed-off-by: Karel Zak <kzak@redhat.com>
8 years agolibsmartcols: allow to change cell padding char
Karel Zak [Wed, 7 Sep 2016 09:07:04 +0000 (11:07 +0200)] 
libsmartcols: allow to change cell padding char

Signed-off-by: Karel Zak <kzak@redhat.com>
8 years agofsck: remove fs-specific options from man page
Karel Zak [Tue, 6 Sep 2016 12:49:48 +0000 (14:49 +0200)] 
fsck: remove fs-specific options from man page

Let's force users to read fs-specific man pages rather than try to be
smart and maintain some non-fsck options in fsck.8.

Reported-by: Matej Cepl <mcepl@redhat.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
8 years agolibsmartcols: extend wrapnl sample
Karel Zak [Tue, 6 Sep 2016 11:01:45 +0000 (13:01 +0200)] 
libsmartcols: extend wrapnl sample

Signed-off-by: Karel Zak <kzak@redhat.com>
8 years agolibsmartcols: fix padding for non-maxout output
Karel Zak [Tue, 6 Sep 2016 11:01:09 +0000 (13:01 +0200)] 
libsmartcols: fix padding for non-maxout output

Signed-off-by: Karel Zak <kzak@redhat.com>
8 years agolibsmartcols: remove debuging code from sample
Karel Zak [Tue, 6 Sep 2016 10:24:49 +0000 (12:24 +0200)] 
libsmartcols: remove debuging code from sample

Signed-off-by: Karel Zak <kzak@redhat.com>
8 years agolibsmartcols: commit missing file
Karel Zak [Tue, 6 Sep 2016 09:18:18 +0000 (11:18 +0200)] 
libsmartcols: commit missing file

Signed-off-by: Karel Zak <kzak@redhat.com>
8 years agolibsmartcols: support multi-line cells based on line breaks
Karel Zak [Tue, 6 Sep 2016 08:51:25 +0000 (10:51 +0200)] 
libsmartcols: support multi-line cells based on line breaks

Now libsmartcols completely control when and how wrap long
lines/cells. This is sometimes user unfriendly and it would be nice to
support multi-line cells where wrap is based on \n (new line char).

This patch add new column flag SCOLS_FL_WRAPNL.

Signed-off-by: Karel Zak <kzak@redhat.com>
8 years agolib/randutils: add xsrand() and rand_get_number()
Karel Zak [Tue, 6 Sep 2016 08:19:52 +0000 (10:19 +0200)] 
lib/randutils: add xsrand() and rand_get_number()

Signed-off-by: Karel Zak <kzak@redhat.com>
8 years agosfdisk: add --no-tell-kernel
Karel Zak [Fri, 2 Sep 2016 09:14:54 +0000 (11:14 +0200)] 
sfdisk: add --no-tell-kernel

The option forces sfdisk to not call re-read partitions ioctl after
write PT.

Requested-by: Scott Moser <smoser@ubuntu.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
8 years agotests: update sfdisk output strings
Karel Zak [Thu, 1 Sep 2016 09:43:42 +0000 (11:43 +0200)] 
tests: update sfdisk output strings

Signed-off-by: Karel Zak <kzak@redhat.com>
8 years agosfdisk: make non-interactive output more readable
Karel Zak [Wed, 31 Aug 2016 13:51:11 +0000 (15:51 +0200)] 
sfdisk: make non-interactive output more readable

 # echo -e ',1M\n,2M' | sfdisk /dev/sdc

Old version:

  >>> Created a new DOS disklabel with disk identifier 0x8fc7d065.
  Created a new partition 1 of type 'Linux' and of size 1 MiB.
  /dev/sdc2: Created a new partition 2 of type 'Linux' and of size 2 MiB.
  /dev/sdc3:

New version:

  >>> Created a new DOS disklabel with disk identifier 0x9afe17c0.
 /dev/sdc1: Created a new partition 1 of type 'Linux' and of size 1 MiB.
 /dev/sdc2: Created a new partition 2 of type 'Linux' and of size 2 MiB.
 /dev/sdc3: Done.

Addresses: https://github.com/karelzak/util-linux/issues/337
Signed-off-by: Karel Zak <kzak@redhat.com>
8 years agolibsmartcols: use SCOLS_FL_RIGHT in sample
Karel Zak [Wed, 31 Aug 2016 13:51:03 +0000 (15:51 +0200)] 
libsmartcols: use SCOLS_FL_RIGHT in sample

Signed-off-by: Karel Zak <kzak@redhat.com>
8 years agolibsmartcols: add maxout sample
Karel Zak [Wed, 31 Aug 2016 13:15:28 +0000 (15:15 +0200)] 
libsmartcols: add maxout sample

Signed-off-by: Karel Zak <kzak@redhat.com>
8 years agolibsmartcols: fix minimal column width calculation
Karel Zak [Wed, 31 Aug 2016 13:13:06 +0000 (15:13 +0200)] 
libsmartcols: fix minimal column width calculation

Signed-off-by: Karel Zak <kzak@redhat.com>
8 years agolibsmartcols: fix non-tty output for 'maxout' columns
Karel Zak [Wed, 31 Aug 2016 11:01:48 +0000 (13:01 +0200)] 
libsmartcols: fix non-tty output for 'maxout' columns

Signed-off-by: Karel Zak <kzak@redhat.com>
8 years agolibsmartcols: fix title output on non-tty
Karel Zak [Wed, 31 Aug 2016 10:42:38 +0000 (12:42 +0200)] 
libsmartcols: fix title output on non-tty

Signed-off-by: Karel Zak <kzak@redhat.com>
8 years agolibsmartcols: fix scols_table_enable_colors() usage in samples
Karel Zak [Wed, 31 Aug 2016 10:05:48 +0000 (12:05 +0200)] 
libsmartcols: fix scols_table_enable_colors() usage in samples

Signed-off-by: Karel Zak <kzak@redhat.com>
8 years agolibsmartcols: don't print title color is colors disabled
Karel Zak [Wed, 31 Aug 2016 10:05:21 +0000 (12:05 +0200)] 
libsmartcols: don't print title color is colors disabled

Signed-off-by: Karel Zak <kzak@redhat.com>
8 years agolib/loopdev: Set errno in is_loopdev on error
Tobias Stoeckmann [Tue, 30 Aug 2016 19:00:38 +0000 (21:00 +0200)] 
lib/loopdev: Set errno in is_loopdev on error

The function is_loopdev does not set errno if the supplied string does
not reference a valid loop device. Fix this to avoid an error message
like this one:

  losetup: /: failed to use device: Success

I prefer this one:

  losetup: /: failed to use device: No such device

Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
8 years agomount: add note about paths verification to mount.8
Karel Zak [Wed, 31 Aug 2016 07:48:43 +0000 (09:48 +0200)] 
mount: add note about paths verification to mount.8

Signed-off-by: Karel Zak <kzak@redhat.com>
8 years agolibblkid: [exfat] Limit maximum number of iterations in find_label
Rostislav Skudnov [Tue, 30 Aug 2016 10:07:49 +0000 (10:07 +0000)] 
libblkid: [exfat] Limit maximum number of iterations in find_label

Do not hang if there is a cluster chain loop in rootdir

[kzak@redhat.com: - add return NULL]

Signed-off-by: Karel Zak <kzak@redhat.com>
8 years agolibblkid: ignore empty MBR on LVM device
Karel Zak [Tue, 30 Aug 2016 10:07:40 +0000 (12:07 +0200)] 
libblkid: ignore empty MBR on LVM device

It's possible to use boot sector and empty MBR on LVM physical volume
to make LVM disk bootable. In this case MBR should be ignored and disk
reported as LVM.

Just for the record, this is ugly non-default LVM setup maintained for
backward compatibility (yes, LVM guys don't like it too).

Unfortunately people still use it. The proper way is to use regular
partitioned disk.

Reported-by: Xen <list@xenhideout.nl>
Signed-off-by: Karel Zak <kzak@redhat.com>
8 years agolibblkid: remove unused function
Karel Zak [Tue, 30 Aug 2016 09:22:30 +0000 (11:22 +0200)] 
libblkid: remove unused function

Signed-off-by: Karel Zak <kzak@redhat.com>
8 years agoumount: cleanup umount.8 about mtab
Karel Zak [Tue, 30 Aug 2016 08:41:05 +0000 (10:41 +0200)] 
umount: cleanup umount.8 about mtab

Signed-off-by: Karel Zak <kzak@redhat.com>
8 years agoumount: fix obsolete info about loop= in umount.8
Karel Zak [Tue, 30 Aug 2016 08:25:44 +0000 (10:25 +0200)] 
umount: fix obsolete info about loop= in umount.8

Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=1370959
Signed-off-by: Karel Zak <kzak@redhat.com>
8 years agolibblkid: Avoid OOB access on illegal ZFS superblocks
Tobias Stoeckmann [Sun, 28 Aug 2016 19:15:59 +0000 (21:15 +0200)] 
libblkid: Avoid OOB access on illegal ZFS superblocks

64 bit systems can trigger an out of boundary access while performing
a ZFS superblock probe.

This happens due to a possible integer overflow while calculating
the remaining available bytes. The variable is of type "int" and the
string length is allowed to be larger than INT_MAX, which means that
avail calculation can overflow, circumventing the "avail < 0" check and
therefore accessing memory outside the "buff" array later on.

Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
8 years agolibfdisk: Distinguish between first LBA sector and partition
Tobias Stoeckmann [Sat, 27 Aug 2016 17:28:48 +0000 (19:28 +0200)] 
libfdisk: Distinguish between first LBA sector and partition

An insufficient check leads to an invalid free space output, as seen here:

$ dd if=/dev/zero of=cfdisk.iso bs=1M count=1
$ losetup -f cfdisk.iso
$ echo w | fdisk /dev/loop0
$ echo '1,1' | sfdisk /dev/loop0 --append
$ echo '3,' | sfdisk /dev/loop0 --append
$ sfdisk --list-free /dev/loop0
Start End Sectors Size
    1   2       2   1K
$ _

In this case, libfdisk fails to notice that it tries to calculate space
between two partitions, not between start of disk and first partition.
Currently, the code tries to achieve that by checking the address of the
last "partition", which is the first_lba block.  Now if the first
partition is merely 1 block in size, the "last" address is still equal
to the first_lba block, which renders the check in libfdisk for the next
partition invalid.

I chose to use "nparts == 0" for this check, because the partitions are
properly sorted before iterating over them.

Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
8 years agolibfdisk: Fix assert error in free space handling
Tobias Stoeckmann [Sat, 27 Aug 2016 17:28:16 +0000 (19:28 +0200)] 
libfdisk: Fix assert error in free space handling

An off-by-one issue exists in fdisk_get_freespaces. It can trigger an
assert, as seen here:

$ dd if=/dev/zero of=cfdisk.iso bs=1M count=1
$ losetup -f cfdisk.iso
$ echo w | fdisk /dev/loop0
$ echo '1,2' | sfdisk /dev/loop0 --append
$ echo '3,' | sfdisk /dev/loop0 --append
$ sfdisk --list-free /dev/loop0
Aborted
$ _

Problem here is an invalid "grain" processing. A grain is considered
expected free space between partitions which can be required for proper
alignment. Normally, it's 1 MB but in this case our iso is merely 1 MB
so the grain is reduced to 1 byte.

The if-condition in question checks for "last + grain <= pa->start" and
therefore even triggers if there is no space between them (due to equal
check). Eventually, the start block address is higher than the end block
address which triggers the assert().

Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
8 years agolib/pager: fix test
Karel Zak [Fri, 26 Aug 2016 15:47:01 +0000 (17:47 +0200)] 
lib/pager: fix test

Signed-off-by: Karel Zak <kzak@redhat.com>
8 years agolib/pager: restore signals setting by pager_close()
Karel Zak [Fri, 26 Aug 2016 11:02:37 +0000 (13:02 +0200)] 
lib/pager: restore signals setting by pager_close()

Signed-off-by: Karel Zak <kzak@redhat.com>
8 years agofdisk: use PAGER for 'l' command.
Karel Zak [Fri, 26 Aug 2016 10:09:53 +0000 (12:09 +0200)] 
fdisk: use PAGER for 'l' command.

The list of the partition types is too long. Let's try to use $PAGER.

Reported-by: Bruce Dubbs <bruce.dubbs@gmail.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
8 years agolib/pager: cleanup and extend API
Karel Zak [Fri, 26 Aug 2016 10:07:25 +0000 (12:07 +0200)] 
lib/pager: cleanup and extend API

* clean up function names

* add functions to temporary redirect to the pager and then restore
  original terminal output

Signed-off-by: Karel Zak <kzak@redhat.com>
8 years agosu, runuser, setpriv: create links between man pages
Karel Zak [Thu, 18 Aug 2016 09:12:44 +0000 (11:12 +0200)] 
su, runuser, setpriv: create links between man pages

.. and add notes about differences between the utuils.

Reported-by: Lennart Poettering <lennart@poettering.net>
Signed-off-by: Karel Zak <kzak@redhat.com>
8 years agotests: fix losetup tests for --nooverlap
Karel Zak [Wed, 17 Aug 2016 11:54:34 +0000 (13:54 +0200)] 
tests: fix losetup tests for --nooverlap

Signed-off-by: Karel Zak <kzak@redhat.com>
8 years agolosetup: allow to use --nooverlap when device specified
Karel Zak [Wed, 17 Aug 2016 11:52:22 +0000 (13:52 +0200)] 
losetup: allow to use --nooverlap when device specified

Signed-off-by: Karel Zak <kzak@redhat.com>
8 years agotests: Add losetup-loop test suite
Stanislav Brabec [Tue, 2 Aug 2016 18:00:46 +0000 (20:00 +0200)] 
tests: Add losetup-loop test suite

Add losetup loop test suite that tests proper behavior of conflicting and
re-used loop devices.

Signed-off-by: Stanislav Brabec <sbrabec@suse.cz>
8 years agolosetup: Prevent AUTOCLEAR detach race
Stanislav Brabec [Wed, 17 Aug 2016 10:54:40 +0000 (12:54 +0200)] 
losetup: Prevent AUTOCLEAR detach race

Kernel needs some time to delete a device after losetup --detach. If
the losetup --find --nooverlay is called just after losetup --delete,
it can sometimes attempt to recycle the device that is just being
released.  To prevent this race, clear the AUTOCLEAR flag of the
device.

[kzak@redhat.com: - rebase to the new version of the code]

Signed-off-by: Stanislav Brabec <sbrabec@suse.cz>
Signed-off-by: Karel Zak <kzak@redhat.com>
8 years agoloopdev: Implememt loopcxt_set_status()
Stanislav Brabec [Tue, 2 Aug 2016 17:57:56 +0000 (19:57 +0200)] 
loopdev: Implememt loopcxt_set_status()

Implement stand-alone loopcxt_set_status(). It allows manipulation with some
loop device parameters even if it is initialized.

Its function is limited by the kernel implementation, and only a small subset of
changes is allowed.

For more see linux/drivers/block/loop.c:loop_set_status()

Signed-off-by: Stanislav Brabec <sbrabec@suse.cz>
8 years agolosetup: add --nooverlap options
Karel Zak [Wed, 17 Aug 2016 10:28:33 +0000 (12:28 +0200)] 
losetup: add --nooverlap options

This patch introduces overlap detections and loop devices
re-use for losetup(8). We already support this feature for mount(8)
where it's enabled by default (because we mount filesystems and it's
always mistake to share the same filesystem between more loop
devices).

Stanislav has suggested to enable this feature also for losetup by
default. I'm not sure about it, IMHO it's better to keep losetup(8)
simple and stupid by default, and inform users about possible problems
and solutions in the man page.

The feature forces losetup to scan all loop devices always when new
one is requested. This maybe disadvantage (especially when we use
control-loop  to avoid /sys or /dev scans) on system with huge number
of loop devices.

Co-Author: Stanislav Brabec <sbrabec@suse.cz>
Signed-off-by: Karel Zak <kzak@redhat.com>
8 years agotests: keep 'hppa' in fdisk/bsd test too
Karel Zak [Tue, 16 Aug 2016 11:40:44 +0000 (13:40 +0200)] 
tests: keep 'hppa' in fdisk/bsd test too

Signed-off-by: Karel Zak <kzak@redhat.com>
8 years agobuild-sys: add parisc to define ARCH_
Karel Zak [Tue, 16 Aug 2016 11:39:07 +0000 (13:39 +0200)] 
build-sys: add parisc to define ARCH_

Signed-off-by: Karel Zak <kzak@redhat.com>
8 years agotests: really fix fdisk/bsd for hppa
Helge Deller [Mon, 15 Aug 2016 20:26:30 +0000 (22:26 +0200)] 
tests: really fix fdisk/bsd for hppa

Finally fix the bsd testcase on the hppa architecture.

Commit 1b7be556e553cdcef6213ead6340832c306011ed tried to fix it,
but missed the fact that "uname -m" returns "parisc" or "parisc64"
instead of "hppa*".

Signed-off-by: Helge Deller <deller@gmx.de>
Cc: 827225@bugs.debian.org
8 years agolsns: support cgroup namespaces
Michał Bartoszkiewicz [Mon, 15 Aug 2016 10:22:30 +0000 (12:22 +0200)] 
lsns: support cgroup namespaces

Signed-off-by: Michał Bartoszkiewicz <mbartoszkiewicz@gmail.com>
8 years agoinclude/closestream: define exit codes
Karel Zak [Tue, 16 Aug 2016 11:35:06 +0000 (13:35 +0200)] 
include/closestream: define exit codes

Signed-off-by: Karel Zak <kzak@redhat.com>
8 years agoinclude/env: minor fixes and clean ups
Karel Zak [Tue, 16 Aug 2016 10:35:57 +0000 (12:35 +0200)] 
include/env: minor fixes and clean ups

Signed-off-by: Karel Zak <kzak@redhat.com>
8 years agoMerge branch 'misc' of https://github.com/kerolasa/lelux-utiliteetit
Karel Zak [Tue, 16 Aug 2016 10:09:00 +0000 (12:09 +0200)] 
Merge branch 'misc' of https://github.com/kerolasa/lelux-utiliteetit

* 'misc' of https://github.com/kerolasa/lelux-utiliteetit:
  pg: stop building the command by default
  kill: remove pid command-name to option alias
  misc: always check setenv(3) return value

8 years agolibblkid: Check that cluster size is nonzero when probing exFAT
Rostislav Skudnov [Thu, 11 Aug 2016 18:24:00 +0000 (18:24 +0000)] 
libblkid: Check that cluster size is nonzero when probing exFAT

This should prevent division by zero in find_label()

Signed-off-by: Rostislav Skudnov <rostislav@tuxera.com>
8 years agolsns: missing ns/<name> is not error
Karel Zak [Mon, 15 Aug 2016 09:02:18 +0000 (11:02 +0200)] 
lsns: missing ns/<name> is not error

For example user namespace is optional it does not make sense to
ignore process completely if the ns/user file is missing.

Reported-by: Michał Bartoszkiewicz <mbartoszkiewicz@gmail.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
8 years agopg: stop building the command by default
Sami Kerola [Mon, 8 Aug 2016 21:08:16 +0000 (22:08 +0100)] 
pg: stop building the command by default

The pg command is marked deprecated in POSIX since 1997, and this project
has thought the same since Feb 2013.  Time has come to stop shipping this
binary by default.

Reference: 956e582874d3a28434018bf12057c745f74821de
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
8 years agokill: remove pid command-name to option alias
Sami Kerola [Mon, 8 Aug 2016 20:50:19 +0000 (21:50 +0100)] 
kill: remove pid command-name to option alias

Removal was promised to happen in March 2016 and the time has come to get
rid of this unexpected feature.

Reference: c5b057b3422504a671ee588fa66574ae876521f1
Reviewed-by: Benno Schulenberg <bensberg@justemail.net>
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
8 years agomisc: always check setenv(3) return value
Sami Kerola [Sun, 7 Aug 2016 06:27:21 +0000 (07:27 +0100)] 
misc: always check setenv(3) return value

At least glibc setenv(3) can fail when system runs out of memory.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
8 years agotests: mark build-in paths test as optional
Karel Zak [Fri, 12 Aug 2016 08:06:59 +0000 (10:06 +0200)] 
tests: mark build-in paths test as optional

The test makes sense only if you know what are you doing (see
 #ifdef(s) in the include/pathnames.h.

Signed-off-by: Karel Zak <kzak@redhat.com>
8 years agoMerge branch 'pathnames_fbsd' of https://github.com/fichtner/util-linux
Karel Zak [Fri, 12 Aug 2016 08:05:00 +0000 (10:05 +0200)] 
Merge branch 'pathnames_fbsd' of https://github.com/fichtner/util-linux