bash-completion: fix typos in mkfs.bfs logic

There is no "bfs" command.  Change this file to match the other
mkfs files where we have a "mkfs." prefix.

Reported-by: Michał Górny <mgorny@gentoo.org>
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
libmount: use memmove when overlap possible

When unmounting some mountpoints as an unprivileged user (via the
'user' option in fstab), the umount fails. Debug output of 'umount
/opt' reveals:

17760: libmount: CXT: [0x22890e0]: do umount
17760: libmount: UTILS: moving to /opt parent
17760: libmount: CXT: current directory moved to / [last_component='opt']
17760: libmount: CXT: [0x22890e0]: umount(2) [target='pt', flags=0x00000000]

valgrind shows the problem:

==23544== Source and destination overlap in memcpy(0x58d1370, 0x58d1371, 4)
==23544==    at 0x4C2BBC3: memcpy@@GLIBC_2.14 (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==23544==    by 0x4E537C3: mnt_chdir_to_parent (utils.c:168)
==23544==    by 0x4E45E4C: mnt_context_do_umount (context_umount.c:601)
==23544==    by 0x4E46513: mnt_context_umount (context_umount.c:855)
==23544==    by 0x403476: umount_one (umount.c:299)
==23544==    by 0x402B34: main (umount.c:629)
==23544==

ref: https://bugs.archlinux.org/task/36968
Signed-off-by: Dave Reisner <dreisner@archlinux.org>
libmount: free username after check

Leak reported by valgrind:

==14226== 7 bytes in 1 blocks are definitely lost in loss record 1 of 1
==14226==    at 0x4C2757B: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==14226==    by 0x5534839: strdup (in /usr/lib/libc-2.18.so)
==14226==    by 0x4E53FE0: mnt_get_username (utils.c:560)
==14226==    by 0x4E456A5: mnt_context_prepare_umount (context_umount.c:413)
==14226==    by 0x4E464F7: mnt_context_umount (context_umount.c:851)
==14226==    by 0x403476: umount_one (umount.c:299)
==14226==    by 0x402B34: main (umount.c:629)

Signed-off-by: Dave Reisner <dreisner@archlinux.org>
build-sys: support --with-python[={2,3}]

 * we use pkg-config to get CGLAGS and LIBS, use package specific
   config (e.g. python-config) is non-sense.

 * default is to follow distribution and use pkg-config module name
   "python". This is probably symlink to python2.pc or python3.pc.

 * --with-python=2 forces to pkg-module "python2 >= 2"

 * --with-python=3 forces to pkg-module "python3 >= 3"

Signed-off-by: Karel Zak <kzak@redhat.com>
pylibmount: rewrite to be py2/py3 universal

Signed-off-by: Ondrej Oprala <ooprala@redhat.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
lscpu: report cpu min mhz

The lscpu tool only shows the current and max CPU frequencies, however,
in many scenarios this is not enough. If there are energy saving situations
(like some CPUs being idle, or not fully used) the cpugov can lower this value.

Signed-off-by: Davidlohr Bueso <davidlohr@hp.com>
libfdisk: gpt: avoid unnecessary pmbr check

We only jump to the 'check_hybrid' label when a valid pmbr
is detected, so we need not recheck again. Move the label's
logic so it doesn't include the check.

Signed-off-by: Davidlohr Bueso <davidlohr@hp.com>
libfdisk: gpt: loosen check fot pmbr size in lba

While most disk partitioning tools out there create a pMBR's size in lba
to be the lesser of the whole disk or 2Tib, Microsoft apparently does not[1].
It always sets the entry to the maximum 32-bit limitation - even though a
drive may be smaller than that.

Loosen this check and only verify that the size is either the whole disk
or 0xFFFFFFFF.  No tool in its right mind would set it to any value
other than these.

[1] http://thestarman.pcministry.com/asm/mbr/GPT.htm#GPTPT

Signed-off-by: Davidlohr Bueso <davidlohr@hp.com>
libfdisk: fix possible floating point exception

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

Signed-off-by: Karel Zak <kzak@redhat.com>
tests: remove remaining set -x

Signed-off-by: Karel Zak <kzak@redhat.com>
libfdisk: use context geometry in SGI and SUN

 * don't call HDIO_GETGEO ioctls in the drivers
 * use context geometry (so user can overwrite it by -C/H/S options)
 * use default geometry is ioctl does not return anything

Signed-off-by: Karel Zak <kzak@redhat.com>
libfdisk: improve fdisk_save_user_geometry()

The functions should not overwrite old setting if the new value (C/H/S) is
zero.

Signed-off-by: Karel Zak <kzak@redhat.com>
libfdisk: (sun) make it more obvious why the first sector moved

Signed-off-by: Karel Zak <kzak@redhat.com>
fdisk: print geometry for dos-compatible mode too
ORIG_HEAD
tests: update sun label test

 * add fdisk -l outputs (to make the test more usable)
 * use more usable geometry
 * don't expect that 'create sun label' oprations asks for C/H/S (we
   follows fdisk_context defaults)

Signed-off-by: Karel Zak <kzak@redhat.com>
tests: update odd output fdisk test

Signed-off-by: Karel Zak <kzak@redhat.com>
libmount: Get rid of an unnecessary check

libmount_debug_mask was OR'ed to MNT_DEBUG_INIT so it should be non-null.
Thus the check is pointless.

Signed-off-by: Namhyung Kim <namhyung@gmail.com>
libmount: Free splitted optstr's when error occurred

When strdup() failed, u, v and f optstr's should be freed.

Signed-off-by: Namhyung Kim <namhyung@gmail.com>
libmount: Set each optstr's to NULL if failed

When mnt_split_optstr() failed in the middle, vfs, fs, user optstr's
are freed but not reset.  It can lead to double frees at the end of
mnt_fs_{ap,pre}pend_options().

Signed-off-by: Namhyung Kim <namhyung@gmail.com>