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
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.
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>
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).
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).
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>
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:
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>
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.
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.
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().
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>
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>
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
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.