Commit Graph

1228 Commits

Author SHA1 Message Date
Daniel Drake 1f10f4afec isosize: move ISO size functions into a shared header
Move the helper functions that parse ISO data & sector size info into
a separate, shared header.

These will addtionally be used by libblkid's iso9660 parser.

Signed-off-by: Daniel Drake <drake@endlessm.com>
2019-12-16 14:29:24 +08:00
Elliott Mitchell 2bb3aa36b2 cleanup: Remove some spurious spaces
Sorry detail-oriented people tend to wipe these out if they notice them.
Add in automated tools and lots of excess end-of-line spaces get wiped
out.

Addresses: https://github.com/karelzak/util-linux/pull/849
Signed-off-by: Karel Zak <kzak@redhat.com>
2019-10-01 13:01:43 +02:00
Karel Zak 1d84470388 libfdisk: (gpt) fix hybrid MBR detection, fix 'w'
* current code overwrites hybrid MBR because EE partition
  is expected from fist sector, this is not true for hybrid MBR

* print "The partition table has been altered." message also for
  nested contexts

* remove "You have to sync the MBR manually" message

Addresses: https://github.com/karelzak/util-linux/issues/851
Signed-off-by: Karel Zak <kzak@redhat.com>
2019-10-01 12:51:04 +02:00
Karel Zak 5c1c594ee5 fdisk: use 'r' to return from MBR to GPT
The current code uses 'M' to switch between MBR and GPT, but it's not
intuitive to "go back" by 'M'. It seems more user-friendly to use 'r'
as in another places (for example when go from expert menu or from BRD
menu).

The 'M' to return to GPT is still supported for backward compatibility.

Addresses: https://github.com/karelzak/util-linux/pull/849
Signed-off-by: Karel Zak <kzak@redhat.com>
2019-09-30 13:11:17 +02:00
Karel Zak 980a25f9c4 sfdisk: (move-data) improve MiB/s progress bar
Signed-off-by: Karel Zak <kzak@redhat.com>
2019-09-30 12:25:17 +02:00
Karel Zak 135e03892b sfdisk: (man) add note about interactive mode)
Signed-off-by: Karel Zak <kzak@redhat.com>
2019-09-26 15:20:47 +02:00
Karel Zak a6a24f18e6 mkswap: cast before lseek [lgtm scan]
Signed-off-by: Karel Zak <kzak@redhat.com>
2019-09-20 15:47:55 +02:00
Karel Zak c135625734 fdformat: cast before lseek [lgtm scan]
Signed-off-by: Karel Zak <kzak@redhat.com>
2019-09-20 15:45:15 +02:00
Karel Zak e56ca06815 libfdisk: add sector-size to dump
We do not use sector-size from dumps to create partition tables,
because it's always necessary to use real device specific settings.

The new sector-size value is usable when you use the dump as
a description of the device or disk image.

Addresses: https://github.com/karelzak/util-linux/issues/869
Signed-off-by: Karel Zak <kzak@redhat.com>
2019-09-16 10:29:41 +02:00
Matthew Krupcale c7a3455c12 disk-utils: docs: fix sfdisk(8) man page typo
* disk-utils/sfdisk.8: fix typo: "ir" -> "it"
2019-09-10 17:05:22 -04:00
Karel Zak 925f2d4f4f sfdisk: (--move-data) add speed to progress bar, don't use POSIX_FADV_DONTNEED
posix_fadvise() in the loop is pretty expensive.

Signed-off-by: Karel Zak <kzak@redhat.com>
2019-09-06 16:57:40 +02:00
Karel Zak 4bf424188d sfdisk: (--move-data) add simple progress bar
Addresses: https://github.com/karelzak/util-linux/issues/848
Signed-off-by: Karel Zak <kzak@redhat.com>
2019-09-06 15:07:59 +02:00
Karel Zak 7942ba8a79 sfdisk: add --move-use-fsync, disable fsync() by default
It's slow, so slooow...

Addresses: https://github.com/karelzak/util-linux/issues/848
Signed-off-by: Karel Zak <kzak@redhat.com>
2019-09-06 15:07:43 +02:00
Karel Zak 69f30c3126 sfdisk: (--move-data) make log optional
The log may be pretty huge and very probably not used by many users.
Let's make it optional.

The patch also clean up move-data output messages.

Addresses: https://github.com/karelzak/util-linux/issues/848
Signed-off-by: Karel Zak <kzak@redhat.com>
2019-09-06 15:07:30 +02:00
Karel Zak 4ce4675cce sfdisk: (--move-data) keep step size based on optimal I/O
The current implementation is too paranoid and tries to keep in
memory only data which are on disk too. It means very small step size
when move partition only a few sectors left/right.

This patch enlarge the buffer to at least 1MiB and aligned to optimal
I/O.

Addresses: https://github.com/karelzak/util-linux/issues/848
Signed-off-by: Karel Zak <kzak@redhat.com>
2019-09-06 15:05:59 +02:00
Karel Zak 45aaa8f3db sfdisk: make --no-act usable for --move-data too
Signed-off-by: Karel Zak <kzak@redhat.com>
2019-09-06 12:37:26 +02:00
Karel Zak 91099dea35 tests: update sfdisk wipe output
- stderr is used for the warning (like in fdisk)

Signed-off-by: Karel Zak <kzak@redhat.com>
2019-09-05 16:46:14 +02:00
Karel Zak 40af0db4cd fdisk: fix quit dialog for non-libreadline version
We need to clear stdin errors otherwise it returns EOF forever after
CTRL+D.

Reported-by: Lukas Czerner <lczerner@redhat.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
2019-09-05 12:34:01 +02:00
Karel Zak fff85eb577 fdisk: make quit question more usable
Reported-by: Lukas Czerner <lczerner@redhat.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
2019-09-05 12:06:27 +02:00
Karel Zak 6cd671d427 fdisk: cleanup wipe warning
Let's remove 'old' from the sentence, add man page reference to
sfdisk.

Signed-off-by: Karel Zak <kzak@redhat.com>
2019-09-04 14:54:54 +02:00
Karel Zak 03154d2cf2 sfdisk: add -J between mutually exclusive options
Signed-off-by: Karel Zak <kzak@redhat.com>
2019-09-03 16:22:21 +02:00
Karel Zak ce16f04efa fdisk: add hint about --wipe to warning
Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=1748020
Signed-off-by: Karel Zak <kzak@redhat.com>
2019-09-03 11:57:23 +02:00
Karel Zak eabcbfc449 sfdisk: mark --dump and --list-free as mutually exclusive
Reported-by: Bertrand Jacquin <bertrand@jacquin.bzh>
Signed-off-by: Karel Zak <kzak@redhat.com>
2019-09-02 13:10:44 +02:00
Karel Zak 7837cd491a sfdisk: write all message to stdout
The code writes message to stdout and \n to stderr.

Signed-off-by: Karel Zak <kzak@redhat.com>
2019-08-30 15:40:06 +02:00
Sami Kerola dbeb1d733e
docs: try to find broken man references and fix them
Unfortunately methods I used to find and fix were based on quite manual
process that cannot be easily repeated so I do not see how this fix could be
turned into a tools/checkmans.sh addition.  Well, lets hope doing this
manually twice every decade is good enough.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2019-08-26 19:43:40 +01:00
Sami Kerola a7466bdcbe
po: remove possibility to translate static option arguments
These strings are expected to be wrote exactly as they are parsed, so make
translating them impossible.  Since mkfs.cramfs -N option arguments need
this treatment use opportunity to slice usage() output to multiple lines.

Addresses: https://bugs.debian.org/907568
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2019-08-24 09:29:52 +01:00
Karel Zak 5200aa99d2 partx: document -d vs. --nr and fix test
The commit ab025087f9 has disabled error
message, but unfortunately it keeps wrong return code. This has been fixed
by commit 53ae7d60cf.

This commit add hit about it to docs and fix regression test too.

Signed-off-by: Karel Zak <kzak@redhat.com>
2019-08-21 13:42:22 +02:00
Karel Zak 53ae7d60cf partx: don't report ENXIO as error on -d
The errno ENXIO should be ignored, unfortunately the current code uses
variable 'rc' for ioctl return code as well as for final del_parts()
return value. So, failed ioctl (which should be ignored) affects all
del_parts() status.

  # modprobe scsi_debug dev_size_mb=100
  # partx  -d --nr 1-1024 /dev/sdc; echo $?
  1

The device dos not contains any partitions, so 0 return code is
expected in this case.

Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=1739179
Signed-off-by: Karel Zak <kzak@redhat.com>
2019-08-21 10:51:18 +02:00
Rosen Penev 050def0f35
Remove unused utime.h header
It is sometimes unavailable and errors on inclusion. For example, when
disabled in uClibc-ng.
2019-08-08 12:14:39 -07:00
Karel Zak 08474fde66 libfdisk: (script) support shortcuts in the type= field
The unnamed-field format supports partition type shortcuts:

	",1MiB,L'

but for named-field format it requires full type:

 (mbr)	"size=1MiB,type=83"
 (gpt)  "size=1MiB,type=0FC63DAF-8483-4772-8E79-3D69D8477DE4"

This patch implements type shortcuts also for named-field format:

	"size=1MiB,type=L"

to make it more user-friendly and unified.

Addresses: https://github.com/karelzak/util-linux/issues/837
Signed-off-by: Karel Zak <kzak@redhat.com>
2019-08-08 10:34:27 +02:00
Karel Zak 41994e0097 cfdisk: free libfdisk items
Signed-off-by: Karel Zak <kzak@redhat.com>
2019-06-11 11:22:39 +02:00
Karel Zak 49e1a33346 cfdisk: simplify code
Signed-off-by: Karel Zak <kzak@redhat.com>
2019-06-11 10:54:22 +02:00
Karel Zak b0eca21a5c fdisk: add note about -S and -H
It's seems people still follow old advices for SSD/4K devices. Let's
make CHS deprecation more visible at the begin of the man page...

Signed-off-by: Karel Zak <kzak@redhat.com>
2019-05-28 15:12:31 +02:00
Karel Zak 9f34182d53 sfdisk: use xstrcpy()
Signed-off-by: Karel Zak <kzak@redhat.com>
2019-05-20 12:42:43 +02:00
Sami Kerola 84f46d1f67
sfdisk: remove unnecessary size check [cppcheck]
Following warning is false positive.  Size of the buffer is defined using
BUFSIZ, and so the strncpy() will never overwrite the last byte that is
initialized to zero in get_user_reply().

[disk-utils/sfdisk.c:137] -> [disk-utils/sfdisk.c:136]: (warning) Either the
condition 'bufsz!=0' is redundant or strncpy() argument nr 3 can have
invalid value.  The value is -1 but the valid values are '0:'.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2019-05-18 22:07:20 +01:00
Karel Zak 89770db4ef fdisk: initialize buffers for get_user_reply() [coverity scan]
It's probably unnecessary, but better be safe than sorry.

Signed-off-by: Karel Zak <kzak@redhat.com>
2019-05-14 15:00:01 +02:00
Karel Zak 2c308875a7 misc: consolidate version printing and close_stdout()
Signed-off-by: Karel Zak <kzak@redhat.com>
2019-04-16 15:14:13 +02:00
Karel Zak 68224d108d include/c: add print_version() macro
Let's consolidate the version printing code. It also seems better to
use exit() after --version, because it's handled in different way by
ASAN.

It's strange, but ASAN reports leaks after return in main(). Note that
we do not use free-before-exit.

Signed-off-by: Karel Zak <kzak@redhat.com>
2019-04-16 13:47:17 +02:00
Karel Zak 4534e4f2fb fsck: (man) labels are available for all filesystems
Signed-off-by: Karel Zak <kzak@redhat.com>
2019-03-28 15:29:09 +01:00
Karel Zak f91c21cc7e mkswap: be more explicit about maximal number of pages
Addresses: https://github.com/karelzak/util-linux/pull/766
Signed-off-by: Karel Zak <kzak@redhat.com>
2019-03-08 12:14:19 +01:00
Karel Zak c9fbfcfc49 blockdev: make –-getbsz less confusing for end-users
Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=1684078
Signed-off-by: Karel Zak <kzak@redhat.com>
2019-02-28 14:08:23 +01:00
Sami Kerola 4813a5210f various: fix 'uninitialized when used' warnings [clang]
This change fixes "warning: variable 'var' may be uninitialized when used
here [-Wconditional-uninitialized]" warnings reported in various files.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2019-02-18 13:19:24 +01:00
Tobias Stoeckmann a6fb1ce79d sfdisk: Avoid out of boundary read with readline
It is not guaranteed that the returned string of readline() actually
contains as many bytes as buf can contain.

If bufsz is larger than the allocated memory by readline, an out of
boundary read occurs and leads to undefined behaviour. Most likely
that will be a crash.

This can be reproduced when readline-support is compiled in and when
you directly enter "quit" and "n" (to not write changes back to disk)
when sfdisk was called with any given device.

Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
2019-02-18 13:05:14 +01:00
Karel Zak 39f37044b3 fdisk: use 2 decimal places for size in disk summary
In the disk summary it seems nice, but I'm not sure about lists (SIZE
 columns). It seems more readable to keep the lists with one decimal
 place only. New output:

  # sfdisk --list /dev/sda

 Old output:
  Disk /dev/sda: 223.6 GiB, 240057409536 bytes, 468862128 sectors

 New output:
  Disk /dev/sda: 223.58 GiB, 240057409536 bytes, 468862128 sectors

 The rest is unchanged:
  ...
  Device         Start       End   Sectors   Size Type
  /dev/sda1       2048    411647    409600   200M EFI System
  /dev/sda2     411648    821247    409600   200M Linux filesystem
  /dev/sda3     821248 274087935 273266688 130.3G Linux filesystem
  /dev/sda4  274087936 378945535 104857600    50G Linux filesystem
  /dev/sda5  378945536 468862094  89916559  42.9G Linux filesystem

Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=1673452
Signed-off-by: Karel Zak <kzak@redhat.com>
2019-02-12 14:21:54 +01:00
Karel Zak 1895c76f74 swapon: rewrite section about swapfiles
* don't duplicate info on two places -- let's keep only small note
  in mkswap(8) man page, suggest to read swapon(8) man page

* add info about kernel versions for XFS and Btrfs swapfiles support

* use subsection in the NOTES

Addresses: https://github.com/karelzak/util-linux/issues/633
Signed-off-by: Karel Zak <kzak@redhat.com>
2019-01-22 10:02:17 +01:00
Karel Zak 77983e4a21 swapon: (man) iomap for swapfile is already supported by kernel
... since commit 67482129cdabf7cede1301d2415ef4f0156d35cd (Linus'
tree).

Signed-off-by: Karel Zak <kzak@redhat.com>
2019-01-21 17:01:25 +01:00
Karel Zak eebfa469fc swapon: (man) cleanup note about holes
Addresses: https://github.com/karelzak/util-linux/issues/633
Signed-off-by: Karel Zak <kzak@redhat.com>
2019-01-21 12:54:20 +01:00
Karel Zak 12d12102d6 fsck.cramfs: fix utimes() usage
The bug has been introduced by untested commit ad7ac3d598 ;-(

Signed-off-by: Karel Zak <kzak@redhat.com>
2019-01-15 11:44:25 +01:00
Sami Kerola ad7ac3d598
fsck.cramfs: use utimes() instead of utime() that is obsolete
Reference: http://man7.org/linux/man-pages/man3/utime.3p.html#APPLICATION_USAGE
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2019-01-12 08:46:54 +00:00
Karel Zak e6effcac61 fdisk: make partition types uses more robust
* report failed partition type parsing
* make sure partition types code (from user reply) for MBR is hex

Reported-by: Jonny Grant <jg@jguk.org>
Signed-off-by: Karel Zak <kzak@redhat.com>
2019-01-10 12:17:19 +01:00
Karel Zak 19e4cfef52 fdisk: support CTRL+C on change-partition-type dialog
Reported-by: Jonny Grant <jg@jguk.org>
Signed-off-by: Karel Zak <kzak@redhat.com>
2019-01-10 11:26:05 +01:00
Karel Zak 4d09682b3c mkswap: use dd(1) in example rather than fallocate(1)
The man page warns against fallocate on some filesystems and recommends
dd(1) as the most portable solution. So, let's use dd(1) also in the
example used in the same man page.

Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=1203378
Signed-off-by: Karel Zak <kzak@redhat.com>
2018-12-12 12:14:39 +01:00
Noel Cragg 4850e97257 mkswap: fix page size warning message
Signed-off-by: Karel Zak <kzak@redhat.com>
2018-11-29 11:38:41 +01:00
Karel Zak a77bd80d5a sfdisk: disable --activate for Hybrid GPT/MBR
Addresses: https://github.com/karelzak/util-linux/issues/699
Signed-off-by: Karel Zak <kzak@redhat.com>
2018-10-04 14:06:45 +02:00
Karel Zak 49032ef7a4 sfdisk: be more verbose about PMBR on --activate
Addresses: https://github.com/karelzak/util-linux/issues/699
Signed-off-by: Karel Zak <kzak@redhat.com>
2018-10-04 12:40:10 +02:00
Karel Zak 561472a40d mkfs.cramfs: properly copy disk name
Signed-off-by: Karel Zak <kzak@redhat.com>
2018-10-03 17:07:37 +02:00
Karel Zak e4386c8cc0 libfdisk: accept grain script header
The "grain" variable is used to calculate partitions alignment. The
default is 1MiB (or minimal I/O size). The libfdisk provides API to overwrite
this default, but this feature has been nowhere accessible for
end-user.

This patch support for "grain: <size>" in libfdisk scripts.

Addresses: https://github.com/karelzak/util-linux/issues/688
Signed-off-by: Karel Zak <kzak@redhat.com>
2018-09-12 13:26:18 +02:00
Karel Zak aef79c1f8e sfdisk: document script GPT headers
Add first-lba, last-lba and table-length to the sfdisk man page.

Signed-off-by: Karel Zak <kzak@redhat.com>
2018-09-12 12:26:06 +02:00
Karel Zak 6ec4760967 fdisk: add "Disk model:" to the print output
Addresses: https://github.com/karelzak/util-linux/issues/682
Signed-off-by: Karel Zak <kzak@redhat.com>
2018-08-30 14:01:54 +02:00
Jakub Wilk b9c3b903fe Fix man page typos
Signed-off-by: Jakub Wilk <jwilk@jwilk.net>
2018-08-16 11:09:15 +02:00
Bjarni Ingi Gislason 934a6fa80b man pages: Remove "left" (or change to "l") in the column formats of tables
A developmental version of "groff" issued a warning, for example with
"test-groff -b -e -mandoc -T utf8 -rF0 -t -w w -z":

troff: <logger.1>:299: warning: can't find font 't'

Signed-off-by: Bjarni Ingi Gislason <bjarniig@rhi.hi.is>
2018-08-06 08:58:57 +02:00
Karel Zak dbcd1a4964 fdisk: fix error message on 'd' command
Command (m for help): d
	No partition is defined yet!
	Could not delete partition 93840461057817    <--- !

Don't print 'Could not delete..' if no partition is defined yet.

Addresses: https://github.com/karelzak/util-linux/issues/667
Signed-off-by: Karel Zak <kzak@redhat.com>
2018-08-01 09:29:12 +02:00
Awal Garg 757cefbb61 libfdisk: Accept negative numbers for last sector input
[kzak@redhat.com: - add note to the man page
                  - add '-' to the dialog query
                  - cleanup functions names and libfdisk.sym]

Signed-off-by: Karel Zak <kzak@redhat.com>
2018-07-31 14:54:12 +02:00
Karel Zak f2cfb2351a cfdisk: fix compiler warnings [-Wcast-qual]
Signed-off-by: Karel Zak <kzak@redhat.com>
2018-07-23 13:08:56 +02:00
Karel Zak f11157e804 mkswap: fix compiler warnings [-Wcast-qual]
Signed-off-by: Karel Zak <kzak@redhat.com>
2018-07-23 11:43:30 +02:00
Karel Zak 366edea76e mkfs.cramfs: remove redundant condition
util-linux-2.32.1/disk-utils/mkfs.cramfs.c:362]: (style) Redundant condition: If 'EXPR >= 16777216', the comparison 'EXPR' is always true.

Reported-by: David Binderman <dcb314@hotmail.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
2018-07-18 09:46:40 +02:00
Karel Zak 345ddd2828 blockdev: use new ul_path_* API
Signed-off-by: Karel Zak <kzak@redhat.com>
2018-06-21 13:19:28 +02:00
Karel Zak 61bc5fd156 partx: use new ul_path_* API
Signed-off-by: Karel Zak <kzak@redhat.com>
2018-06-21 13:19:28 +02:00
Karel Zak 7f8a406679 resizepart: use new ul_path_* API
Signed-off-by: Karel Zak <kzak@redhat.com>
2018-06-21 13:19:28 +02:00
Karel Zak efb17218ef libfdisk: use new ul_path_* API
Signed-off-by: Karel Zak <kzak@redhat.com>
2018-06-21 13:07:46 +02:00
Andreas Henriksson aeda8dc3d0 partx: exit with error code when partition read failed
Make sure partx exits with a non-0 return code when
it runs into either code-path where getting the partition
table failed (or wasn't even attempted because of previous
error condition).

Change was tested using:
touch /tmp/foobar
partx -s - /tmp/foobar

Previously that was only printing an error/warning message
and then exiting with 0, but after this change it exits
with 1.

Signed-off-by: Andreas Henriksson <andreas@fatal.se>
Reported-by: Juan Céspedes <cespedes@debian.org>
Addresses: https://bugs.debian.org/898426
2018-06-18 10:42:36 +02:00
Sami Kerola 1405658822 nls: remove translation strings
While looking earlier commit I noticed everything but formatting was removed
from a message in namei.c file.  That inspired me to look if there are more
strings that does not need translation project attention.  This change
removes at least some of them, if not all.

Reference: e19cc7b65b
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2018-05-28 13:36:38 +02:00
Ruediger Meier 333423163b cfdisk: fix compiler warnings, follow-up 7085f1e4 (#636)
Seen on OSX 10.13, xcode 9.3.

 disk-utils/cfdisk.c:1860:45: error: format specifies type 'uintmax_t' (aka 'unsigned long') but the argument has type 'uint64_t' (aka 'unsigned long long') [-Werror,-Wformat]
         DBG(UI, ul_debug("get_size (default=%ju)", *res));
                                             ~~~    ^~~~
                                             %llu
 disk-utils/cfdisk.c:267:60: note: expanded from macro 'DBG'
 #define DBG(m, x)       __UL_DBG(cfdisk, CFDISK_DEBUG_, m, x)
                                                           ^
 ./include/debug.h:67:4: note: expanded from macro '__UL_DBG'
                         x; \
                         ^
 disk-utils/cfdisk.c:1889:25: error: incompatible pointer types passing 'uint64_t *' (aka 'unsigned long long *') to parameter of type 'uintmax_t *' (aka 'unsigned long *') [-Werror,-Wincompatible-pointer-types]
                         rc = parse_size(buf, &user, &pwr);      /* parse */
                                              ^~~~~
 ./include/strutils.h:15:51: note: passing argument to parameter 'res' here
 extern int parse_size(const char *str, uintmax_t *res, int *power);
                                                   ^
 2 errors generated.

Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
2018-05-24 16:31:43 +02:00
Karel Zak 7085f1e49b cfdisk: use uint64_t to avoid compiler warnings
Reported-by: Ruediger Meier <ruediger.meier@ga-group.nl>
Signed-off-by: Karel Zak <kzak@redhat.com>
2018-05-24 09:19:28 +02:00
Bjarni Ingi Gislason 0bb7e904d7 man: Use the correct macro for a font change of one argument
Use the correct macro (I, B) for the font change of one argument, not
those that are used for alternating two fonts, like "BR", "IR", "RB",
or "RI".

Signed-off-by: Bjarni Ingi Gislason <bjarniig@rhi.hi.is>
2018-05-23 10:43:27 +02:00
Karel Zak c9fdebcf54 Merge branch 'output-all' of https://github.com/kerolasa/lelux-utiliteetit
* 'output-all' of https://github.com/kerolasa/lelux-utiliteetit:
  zramctl: add --output-all option
  swapon: add --output-all option
  rfkill: add --output-all option
  partx: add --output-all option
  lsns: add --output-all option
  lsmem: add --output-all option
  lslogins: add --output-all option
  lslocks: add --output-all option
  lscpu: add --output-all option
  losetup: add --output-all option
  findmnt: add --output-all option
2018-05-10 12:15:32 +02:00
Vaclav Dolezal 36787f7a97 fdisk: fix typo in debug string
Signed-off-by: Vaclav Dolezal <vdolezal@redhat.com>
2018-05-09 16:44:58 +02:00
Sami Kerola ba1c9075f4
partx: add --output-all option
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2018-05-03 19:56:21 +01:00
Karel Zak 5653c982e8 fdisk: fix compiler warning [-Wmaybe-uninitialized]
Reported-by: L A Walsh <lkml@tlinx.org>
Signed-off-by: Karel Zak <kzak@redhat.com>
2018-05-03 10:31:09 +02:00
Patrick Steinhardt cc6ab5efb1 cfdisk: fix missing prototype for `get_wch`
The header <ncursesw/ncurses.h> defines the get_wch(3) function only
when `NCURSES_WIDECHAR` is defined. This define is actually getting set
in the same header file, but only in case `_XOPEN_SOURCE` is defined and
has a value of 500 or higher. As we already have the precedence of
defining `_XOPEN_SOURCE` to a value of 600 in some other files, simply
define it to the minimum required value of 500 in "cfdisk.c". This
silences a warning for `get_wch` being unknown.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
2018-04-11 13:04:53 +02:00
Karel Zak cd42d02ff2 libfdisk: (docs) update year
Signed-off-by: Karel Zak <kzak@redhat.com>
2018-03-20 18:55:49 +01:00
Tony Asleson 80ec018c6a libblkid: ignore private Stratis devices
[kzak@redhat.com: - tiny coding style changes]

References: 20e1c3dc03
Signed-off-by: Tony Asleson <tasleson@redhat.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
2018-03-09 13:34:42 +01:00
Karel Zak ac52836781 fsck: cleanup find_fsck()
* remove static variable
* return 0 or 1
* optionally return allocated path to the program

Signed-off-by: Karel Zak <kzak@redhat.com>
2018-02-19 13:05:45 +01:00
Karel Zak 7595bed189 Merge branch 'maybe-for-v2.32' of https://github.com/rudimeier/util-linux
* 'maybe-for-v2.32' of https://github.com/rudimeier/util-linux:
  tests: use pgrep instead of ps --ppid ...
  misc: fix typos using codespell
  lsns: fix clang compiler warning
  tests: add udevadm settle to sfdisk/resize
  build-sys: disable bz2 tarball and fix some am warnings
2018-02-16 11:25:22 +01:00
Ruediger Meier 73afd3f8e8 misc: fix typos using codespell
Some more funny typos, please review carefully.

Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
2018-02-16 11:12:52 +01:00
Karel Zak 5b1c32b887 fsck: coding style cleanup
Signed-off-by: Karel Zak <kzak@redhat.com>
2018-02-16 10:50:14 +01:00
Theodore Ts'o 8bad4fc0d5 fsck: use xasprintf to avoid buffer overruns with an insane fs type
This prevents a crash when running the command:

fsck -t AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA /dev/sda

Reported-by: Hornseth_Brenan@bah.com
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2018-02-16 10:50:03 +01:00
Ruediger Meier 68ac426949 fsck.cramfs: fix error message
errno is invalid in case that we just read(3) too short.

Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
2018-01-24 12:53:34 +01:00
Ruediger Meier 2374b1ab75 fsck.cramfs: fix crash when superblock size is too small
This hopefully fixes the original problem addressed by the reverted
patch 7cb962c7.

The bug was introduced by myself in
    f991dbd3 "fsck.cramfs: allow smaller superblock sizes"

CC: Tobias Stoeckmann <tobias@stoeckmann.org>
Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
2018-01-24 12:53:31 +01:00
Ruediger Meier 919e372da8 Revert "fsck.cramfs: Fix bus error on broken file system."
This reverts commit 7cb962c770.

It can't be right that we mmap (start + super.size) bytes from a file
which is usually only super.size bytes large. The patch "fixed" a
problem when super.size is bad but now it fails for the correct case:

$ mkdir -p root/subdir
$ ./mkfs.cramfs -p root cramfs
$ ./fsck.cramfs cramfs
Bus error (core dumped)

We will fix the original problem later.

CC: Tobias Stoeckmann <tobias@stoeckmann.org>
Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
2018-01-24 12:53:28 +01:00
Karel Zak aefa920a79 sfdisk: add hint about udev and flock to the man page
Addresses: https://github.com/karelzak/util-linux/issues/563
Signed-off-by: Karel Zak <kzak@redhat.com>
2018-01-17 16:30:06 +01:00
Karel Zak a15dca2f6d include/debug: introduce __UL_INIT_DEBUG_FROM_STRING()
Let's make it possible to use debug.h without environment variables.

Suggested-by: J William Piggott <elseifthen@gmx.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
2018-01-17 13:58:29 +01:00
Karel Zak 7e95fd82b7 sfdisk: cleanup shortcuts in man page too
Signed-off-by: Karel Zak <kzak@redhat.com>
2018-01-12 12:38:58 +01:00
Karel Zak 6ebc37854d libfdisk: (script) support R (RAID) and V (LVM) shortcuts
Addresses: https://github.com/karelzak/util-linux/issues/560
Signed-off-by: Karel Zak <kzak@redhat.com>
2018-01-09 12:12:50 +01:00
Karel Zak 2dd2880f12 libfdisk: extend API to provide label specific geometry ranges
Now fdisk provides DOS specific geometry ranges in expert menu.

Addresses: https://github.com/karelzak/util-linux/issues/556
Signed-off-by: Karel Zak <kzak@redhat.com>
2018-01-02 16:43:22 +01:00
Karel Zak a60d6b5217 sfdisk: wait before re-read
The original old (v2.13) fdisk had sleep(2) beany ideafore re-read ioctl. It
seems overkill, but short sleep is probably a good idea as we call
re-read on sfdisk start and at the end. It's possible that sfdisk is
too fast and the initial re-read is not gone yet.

It would be nice to have something more elegant than sleep, any idea?

Addresses: https://github.com/karelzak/util-linux/issues/557
Signed-off-by: Karel Zak <kzak@redhat.com>
2018-01-02 14:48:01 +01:00
Karel Zak 42dea85c5a lib/md5: use ul_/UL_ prefix
The symbols names are too generic.

Addresses: https://github.com/karelzak/util-linux/issues/548
Signed-off-by: Karel Zak <kzak@redhat.com>
2017-12-12 12:06:15 +01:00
Karel Zak aae7bfc8b7 blockdev: be more explicit for BLKSSZ in blockdev.8
Addresses: https://github.com/karelzak/util-linux/issues/535
Signed-off-by: Karel Zak <kzak@redhat.com>
2017-11-13 12:15:17 +01:00
Karel Zak 9d4081cd6d sfdisk: create empty label on 'write' command
Addresses: https://github.com/karelzak/util-linux/issues/528
Signed-off-by: Karel Zak <kzak@redhat.com>
2017-11-03 19:34:49 +01:00
Tobias Stoeckmann 7cb962c770 fsck.cramfs: Fix bus error on broken file system.
The utility fsck.cramfs is prone to a bus error on file systems for
big endian systems with non-standard header sizes. While calculating
the crc32 checksum, it does not properly handle a possible offset
for bootcodes, resulting in out of boundary access of mmap'ed area.

You can trigger the issue with the following commands:

$ mkdir -p cramfs-poc/root/subdir
$ cd cramfs-poc
$ mkfs.cramfs -p -N big root cramfs
$ echo -ne \\00\\x4c | dd of=cramfs bs=1 seek=518 count=2 conv=notrunc
$ fsck.cramfs cramfs

Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
2017-11-02 13:56:14 +01:00
Karel Zak 8175ed3d74 sfdisk: allow to disable bootable flag on all partitions
Let use '-' rather than a partition number to disable the bootable flag
on all partitions:

 sfdisk --activate /dev/sdc -

Signed-off-by: Karel Zak <kzak@redhat.com>
2017-11-02 13:50:30 +01:00
Karel Zak 5d5ca9deaf sfdisk: allow to use --activate for PMBR
Signed-off-by: Karel Zak <kzak@redhat.com>
2017-11-02 13:19:22 +01:00
Karel Zak c48acf70f7 fdisk: (gpt) make PMBR accessible from main menu
Don't force users to go to expert menu to toggle between GPT and PMBR.

Signed-off-by: Karel Zak <kzak@redhat.com>
2017-11-02 11:17:24 +01:00
Karel Zak 502c5186d3 cfdisk: cleanup die-on-signal code
Let's keep signal handler simple and don't cleanup terminal from the
handler.

Signed-off-by: Karel Zak <kzak@redhat.com>
2017-09-26 12:47:50 +02:00
Karel Zak c431d9015a cfdisk: make resize code more readable
Signed-off-by: Karel Zak <kzak@redhat.com>
2017-09-26 12:26:19 +02:00
Karel Zak 3da94b1114 swaplabel: fix --disable-libuuid compilation
Signed-off-by: Karel Zak <kzak@redhat.com>
2017-09-15 13:30:40 +02:00
Philip Prindeville b443c1779e misc: replace magic number 37 with UUID_STR_LEN
Signed-off-by: Philip Prindeville <philipp@redfish-solutions.com>
2017-09-05 11:49:21 +02:00
Vaclav Dolezal 6c183c283b fdisk: use strutils to trim whitespace from input
Signed-off-by: Vaclav Dolezal <vdolezal@redhat.com>
2017-08-29 15:26:39 +02:00
Vaclav Dolezal 1d775aa260 fdisk: fix copy from readline and whitespace stripping
Bug fixed:
---
678: fdisk:      ASK: asking for number ['Partition number', <1,4>, default=1, range: 1-4]
678: fdisk:      ASK: asking for user replay [interactive]
Partition number (1-4, default 1): 12345
678: fdisk:      ASK: user's reply: >>>12345<<<
Value out of range.
678: fdisk:      ASK: asking for user replay [interactive]
Partition number (1-4, default 1): 1
678: fdisk:      ASK: user's reply: >>>12345<<<
Value out of range.
678: fdisk:      ASK: asking for user replay [interactive]
Partition number (1-4, default 1):
678: fdisk:      ASK: user's reply: >>>22345<<<
Value out of range.
---

Signed-off-by: Vaclav Dolezal <vdolezal@redhat.com>
2017-08-28 14:06:15 +02:00
Vaclav Dolezal 3063670425 fdisk: minor fixes to make readline work
Signed-off-by: Vaclav Dolezal <vdolezal@redhat.com>
2017-08-28 14:03:30 +02:00
Karel Zak ebfab541cf fdisk: add missing include
Signed-off-by: Karel Zak <kzak@redhat.com>
2017-08-24 19:59:20 +02:00
Karel Zak c1154128db fdisk: fix readline interaction with signals
The high-level readline API is crazy to use with signals. Fortunately
the library provides low-level rl_callback_* API. In this case we can
use poll() to wait for input and control all signals, etc.

This patch also a little changes fdisk behavior on CTRL+C and CTRL+D.
The signals does not kill fdisk, but forces fdisk to return to the
main menu, if already in the main menu then exit. If the disk layout
has been modified than ask "Do you really want to exit...".

Signed-off-by: Karel Zak <kzak@redhat.com>
2017-08-24 15:48:46 +02:00
Vaclav Dolezal 6c8c429d49 fdisk: handle SIGINT in dialogs as cancel
[kzak@redhat.com: - use sig_atomic_t]

Signed-off-by: Vaclav Dolezal <vdolezal@redhat.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
2017-08-24 13:08:22 +02:00
Vaclav Dolezal 55cf371609 fdisk: add wrap_fgets() for getting user input
make function wrapping rl_fgets() and fputs()&fgets() to remove
code duplication in get_user_reply().

Signed-off-by: Vaclav Dolezal <vdolezal@redhat.com>
2017-08-24 11:27:18 +02:00
Karel Zak 1da83869cf isosize: usage() and coding style cleanup
Signed-off-by: Karel Zak <kzak@redhat.com>
2017-08-21 11:16:51 +02:00
Karel Zak c380180289 isosize: iterate over all arguments even when something fails
Earlier the command exit too early if one of the arguments failed.  After
this change all arguments are examined, and command return value will have
information what happen during processing.

Based on patch from Sami Kerola <kerolasa@iki.fi>

Signed-off-by: Karel Zak <kzak@redhat.com>
2017-08-21 11:11:11 +02:00
Karel Zak 6b1e439a0e cfdisk: add missing 0x7F key mapping
Addresses: https://github.com/karelzak/util-linux/issues/499
Signed-off-by: Karel Zak <kzak@redhat.com>
2017-08-15 14:03:43 +02:00
Karel Zak 80701a7ace blockdev: document --setro more properly
Addresses: https://github.com/karelzak/util-linux/issues/498
Signed-off-by: Karel Zak <kzak@redhat.com>
2017-08-14 11:30:37 +02:00
Karel Zak a351f2e504 cfdisk: add resize function
Signed-off-by: Karel Zak <kzak@redhat.com>
2017-07-19 13:27:50 +02:00
Karel Zak 044ebc0c93 cfdisk: use fdisk_reread_changes()
Let's make cfdisk usable for disks where some partitions are mounted.

Signed-off-by: Karel Zak <kzak@redhat.com>
2017-07-14 11:34:55 +02:00
Karel Zak fadd8e0877 fdisk: use fdisk_reread_changes()
Let's make fdisk usable for disks where some partitions are mounted.

Signed-off-by: Karel Zak <kzak@redhat.com>
2017-07-14 11:34:55 +02:00
Karel Zak 87d04a3339 partx: move partx.h to include/
Let's make the ioctls usable also for libfdisk.

Signed-off-by: Karel Zak <kzak@redhat.com>
2017-07-14 11:34:55 +02:00
Karel Zak ea0acfc335 sfdisk: use fdisk_device_is_used()
Signed-off-by: Karel Zak <kzak@redhat.com>
2017-07-14 11:34:55 +02:00
Karel Zak 884659b32a libblkid: don't use CDROM_GET_CAPABILITY ioctl for DM devices
For some reason kernel commit e980f62353c697cbf0c4325e43df6e44399aeb64
add extra warning when the ioctl is used for DM devices. It seems we
can avoid this ioctl when the device has dm/uuid.

Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=1469532
Signed-off-by: Karel Zak <kzak@redhat.com>
2017-07-12 14:35:53 +02:00
Karel Zak dda4743b45 fdisk: reset context after failed script
Addresses: https://github.com/karelzak/util-linux/issues/481
Signed-off-by: Karel Zak <kzak@redhat.com>
2017-07-10 12:34:47 +02:00
Ruediger Meier f45f3ec34a misc: consolidate macro style USAGE_HELP_OPTIONS
changed in include/c.h and applied via sed:

  sed -i 's/fprintf.*\(USAGE_MAN_TAIL.*\)/printf(\1/' $(git ls-files -- "*.c")
  sed -i 's/print_usage_help_options\(.*\);/printf(USAGE_HELP_OPTIONS\1);/' $(git ls-files -- "*.c")

Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
2017-06-29 16:54:33 +02:00
Ruediger Meier 43c960c8fa blockdev: correct man page name in --help
Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
2017-06-29 15:36:39 +02:00
Ruediger Meier 9f3d0fce66 docs: remove some old history from manpages
We assume that users will have a kernel >= 2.6.0 and removel
references to earlier kernels. There are still a few ones
left.

Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
2017-06-29 12:56:22 +02:00
Ruediger Meier a861538cc8 blockdev: improve --help and man page
Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
2017-06-27 12:28:44 +02:00
Ruediger Meier b305445495 misc: consolidate all --help option descriptions
Now we are always using the same text also for commands
which had still hardcoded descriptions or where we can't
use the standard print_usage_help_options macro.

Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
2017-06-27 12:28:36 +02:00
Ruediger Meier b1a294c448 misc: introduce print_usage_help_options()
Consolidate --help and --version descriptions. We are
now able to align them to the other options.

We changed include/c.h. The rest of this patch was
generated by sed, plus manually setting the right
alignment numbers. We do not change anything but
white spaces in the --help output.

Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
2017-06-27 12:26:19 +02:00
Ruediger Meier 86be6a32d3 misc: cosmetics, remove argument from usage(FILE*)
This patch is trivial and changes nothing, because
we were always using usage(stdout)

Now all our usage() functions look very similar. If wanted we
could auto-generate another big cosmetical patch to remove all
the useless "FILE *out" constants and use printf and puts
rather than their f* friends. Such patch could be automatically
synchronized with the translation project (newlines!) to not
make the translators sick.

Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
2017-06-26 14:38:24 +02:00
Ruediger Meier 6e1eda6f22 misc: never use usage(stderr)
Here we fix all cases where we have usage(FILE*)
functions.

Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
2017-06-26 14:38:24 +02:00
Ruediger Meier 5118d1be2a misc: never use usage(ERROR)
We are using better/shorter error messages and somtimes
also errtryhelp().

Here we fix all cases where the usage function took
an int argument for exit_code.

Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
2017-06-26 14:38:24 +02:00
Ruediger Meier 9325dbfd20 misc: cleanup and fix --unknownopt issues
Fixed checkusage.sh warnings:

  rtcwake: --unknownopt, non-empty stdout

  rtcwake: --unknownopt, stderr too long: 21
  blockdev: --unknownopt, stderr too long: 28
  lsipc: --unknownopt, stderr too long: 77
  pg: --unknownopt, stderr too long: 23
  renice: --unknownopt, stderr too long: 18
  sulogin: --unknownopt, stderr too long: 17
  write: --unknownopt, stderr too long: 12

Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
2017-06-26 14:38:24 +02:00
Karel Zak c3a4cfc579 misc: consolidate usage() "Available columns"
Signed-off-by: Karel Zak <kzak@redhat.com>
2017-06-26 14:09:53 +02:00
Karel Zak d6ec64e824 Merge branch '170622' of github.com:jwpi/util-linux
* '170622' of github.com:jwpi/util-linux:
  Docs: move option naming to howto-contribute.txt
  Docs: update howto-usage-function.txt
  Docs: add a comment for constants to boilerplate.c
  include/c.h: add USAGE_COMMANDS and USAGE_COLUMNS
2017-06-26 13:56:45 +02:00
Karel Zak dfdb1ca818 Merge branch 'fix-exit-codes' of https://github.com/rudimeier/util-linux
* 'fix-exit-codes' of https://github.com/rudimeier/util-linux:
  misc: fix optutils.h related exit codes
  misc: fix xalloc.h related exit codes
  misc: fix more strutils related exit codes
  lib: fix strutils.h, remove STRTOXX_EXIT_CODE
  misc: fix some broken exit codes
2017-06-26 13:47:04 +02:00
Ruediger Meier 300d702540 mkfs.cramfs: add --help and --version
Note, we were already using errtryhelp() without providing
a --help option.

Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
2017-06-25 02:22:27 +02:00
J William Piggott 6e2d5a4460 include/c.h: add USAGE_COMMANDS and USAGE_COLUMNS
* login-utils/lslogins.c: all uses changed
* misc-utils/findmnt.c: likewise
* sys-utils/blkzone.c: likewise
* disk-utils/sfdisk.c: likewise
* sys-utils/lscpu.c: likewise
* sys-utils/lsmem.c: likewise
* sys-utils/wdctl.c: likewise

Signed-off-by: J William Piggott <elseifthen@gmx.com>
2017-06-24 13:57:12 -04:00
Ruediger Meier 778ca2a0d4 misc: fix xalloc.h related exit codes
Found by:

grep -L "XALLOC_EXIT_CODE" $(grep -l "xalloc\.h" \
    $(git grep -l "_EX_\|FINDFS_\|BLKID_EXIT\|EX_USAGE" -- "*.c"))

Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
2017-06-22 22:40:27 +02:00
Ruediger Meier 0b2b32e8a7 misc: fix more strutils related exit codes
Found by grep:

grep -l "\bEXIT_\|exit *( *[0-9][0-9] *)\|strutils\.h" $(grep -L \
    strutils_set_exitcode  $(git grep -l "_EX_\|FINDFS_\|BLKID_EXIT\|EX_USAGE" -- "*.c"))

The Command shows also some false positives (fstrim.c,
context_mount.c, ...)

Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
2017-06-22 22:40:21 +02:00
Ruediger Meier 9c8b9fbacc lib: fix strutils.h, remove STRTOXX_EXIT_CODE
As discussed on the mailing list. We fix all places
where the non-working define STRTOXX_EXIT_CODE was used.

Regarding tunelp, also see 7e3c80a7.

Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
2017-06-22 22:40:12 +02:00
Ruediger Meier 05691d9e88 misc: fix some broken exit codes
These tools have special exit codes. They got changed mistakenly.

See:
  findfs       0e1fa6b6
  fsck         658c0891
  fsck.cramfs  922ec175
  mkfs.cramfs  16154b1f
  tunelp       2ab428f6

FIXME: STRTOXX_EXIT_CODE doesn't work as it should.

Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
2017-06-22 21:51:40 +02:00
Ruediger Meier 58745f3599 fsck: add --help and --version
Also cleanup usage() function, never write usage to stderr.

FIXME:
 - currently strtou32_or_err() exits with wrong exit code.
 - option -C does not use a safe strto*_err function

Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
2017-06-22 21:34:51 +02:00
Sami Kerola 1b5042636f misc: fix reassigned values before old ones has been used [cppcheck]
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2017-06-14 12:19:20 +02:00
Sami Kerola e3e0054f5a isosize: avoid reading more data than what is needed
In same go fix error reporting when input file is not long enough.

$ touch empty
$ isosize empty
isosize: empty: might not be an ISO filesystem
isosize: read error on empty: Success

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2017-06-14 12:18:27 +02:00
Sami Kerola b1557fe981 misc: fix ggc-7 fallthrough warnings
(Original patch and commit message edited by Rudi.)

gcc-7 adds -Wimplicit-fallthrough=3 to our default flag -Wextra.
This warning can be silenced by using comment /* fallthrough */
which is also recognized by other tools like coverity. There are
also other valid comments (see man gcc-7) but we consolidate this
style now.

We could have also used __attribute__((fallthrough)) but the comment
looks nice and does not need to be ifdef'ed for compatibility.

Reference: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=7652
Reference: https://developers.redhat.com/blog/2017/03/10/wimplicit-fallthrough-in-gcc-7/
Reviewed-by: Ruediger Meier <ruediger.meier@ga-group.nl>
Suggested-by: Karel Zak <kzak@redhat.com>
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2017-06-14 11:48:22 +02:00
Jakub Wilk fc747ee72a fdformat: clear progress message before printing "done"
Before:

    Formatting ... done1

After:

    Formatting ... done

Signed-off-by: Jakub Wilk <jwilk@jwilk.net>
2017-06-02 23:54:10 +02:00
Karel Zak c71f5a568f cfdisk: fix compiler warning
Signed-off-by: Karel Zak <kzak@redhat.com>
2017-05-31 10:58:17 +02:00