Commit Graph

10276 Commits

Author SHA1 Message Date
Karel Zak 95aae4fcee sfdisk, fdisk: add fflush()
Let's add fflush(stdout) before we print to stderr to make output
order more deterministic.

Signed-off-by: Karel Zak <kzak@redhat.com>
2016-03-10 12:26:43 +01:00
Stanislav Brabec c59409b945 libmount: Typo fix 2016-03-10 11:03:00 +01:00
Karel Zak 9b480fe67b look: consider blanks as directory characters
This change introduces regression, but it seems better than to be
incompatible with "sort -d" if we assume that "sort -d" is the right
way how to prepare files for look(1).

It seems (from man page) that the original goal has been compatibility
with sort -d, but this feature has never been fully implemented.

Addresses: https://github.com/karelzak/util-linux/issues/284
Signed-off-by: Karel Zak <kzak@redhat.com>
2016-03-09 15:51:28 +01:00
Karel Zak edcf032b30 Merge branch 'test-fixes' of https://github.com/rudimeier/util-linux
* 'test-fixes' of https://github.com/rudimeier/util-linux:
  tests: fix non-working udevadm settle for scsi_debug
  tests: hotfix, wait for scsi_debug partion
  tests: don't use mkfs.btrfs option -f
  tests: ignore swapon warnings
  tests: udevadm settle before losetup -d
2016-03-09 15:08:50 +01:00
Ruediger Meier 8d323f0dd6 tests: fix non-working udevadm settle for scsi_debug
We don't sleep anymore since 01b38917. This does not work
on Debian 7 (wheezy)/linux-3.2. Is it the kernel's or udev's
fault?

We simmply add a better sleep again plus some todos for later
improvements.

Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
2016-03-09 14:41:10 +01:00
Ruediger Meier 6c5fbca17a tests: hotfix, wait for scsi_debug partion
Maybe we shouldn't use scsi_debug's num_parts=1 but fdisk to
add a partion. This seems to work better with udevadm settle.

Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
2016-03-09 14:12:19 +01:00
Ruediger Meier 1c28070693 tests: don't use mkfs.btrfs option -f
btrfs-tools 0.19 does not have option -f but looks like we don't need
it in this test.

CC: Stanislav Brabec <sbrabec@suse.cz>
Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
2016-03-09 13:44:02 +01:00
Karel Zak 322e553a1c Merge branch 'port-osx' of https://github.com/rudimeier/util-linux
* 'port-osx' of https://github.com/rudimeier/util-linux:
  fdisk: fix warning, uninitialized variable
  logger: fix compiler warning, const facilitynames
  include/bitops: avoid fallbacks for more systems
  include/bitops: add casts to bswap functions
2016-03-09 13:12:50 +01:00
Benno Schulenberg b31fd516ff blkdiscard: slice up the recently changed usage text
Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
2016-03-09 12:11:18 +01:00
Benno Schulenberg 8142133441 mount: further improve formatting of the man page
Mainly by using proper subsections (so they can be indexed),
protecting some things from hyphenation, and marking with \&
periods that don't end sentences.  Tweaking some wordings too.

Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
Signed-off-by: Karel Zak <kzak@redhat.com>
2016-03-09 12:10:52 +01:00
Benno Schulenberg c00043e542 findmnt: improve formatting and wording of the man page
Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
2016-03-09 12:09:27 +01:00
Ruediger Meier 5b4ad40feb tests: ignore swapon warnings
swapon/mkswap warns if system sets different permissions for
loop devices.

I saw this on Debian 7 (wheezy)/linux-3.2:
mkswap: /dev/loop0: insecure permissions 1660, 0660 suggested.
swapon: /dev/loop0: insecure permissions 1660, 0660 suggested.

Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
2016-03-09 12:08:58 +01:00
Ruediger Meier 1e5e93e277 tests: udevadm settle before losetup -d
On Debian 7 (wheezy)/linux-3.2 we need "udevadm settle" between
losetup and losetup -d in case that the backing file is a block
device (scsi_debug).

This issue is visible since:
7e604f3c tests: don't skip case "output undefined"

Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
2016-03-09 12:08:58 +01:00
Karel Zak 8f6a58efde misc: avoid shadowing
Signed-off-by: Karel Zak <kzak@redhat.com>
2016-03-09 12:00:52 +01:00
Karel Zak d404065a82 lib/linux_version: avoid major and minor shadowing
Signed-off-by: Karel Zak <kzak@redhat.com>
2016-03-09 11:49:42 +01:00
Sami Kerola a3e1c47acc cal: remove libtermcap arguments to my_tgetstr()
Missed in commit b4566a8a8d.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2016-03-09 11:44:05 +01:00
Sami Kerola 652822e08b misc: remove path name definitions that are unused
After this commit the following produces zero matches.

$ for i in \
_PATH_DEV_TTY \
_PATH_INITTAB \
_PATH_MNTTAB_DIR \
_PATH_MOUNTED_LOCK \
_PATH_MOUNTED_TMP \
_PATH_RC \
_PATH_REBOOT \
_PATH_SECURE \
_PATH_SECURETTY \
_PATH_SHUTDOWN_CONF \
_PATH_SINGLE \
_PATH_UMOUNT \
_PATH_USERTTY
do git grep $i; done

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2016-03-09 11:44:05 +01:00
Karel Zak deea8ad4a4 tests: mark script race test as "known fail"
Addresses: https://github.com/karelzak/util-linux/issues/296
Signed-off-by: Karel Zak <kzak@redhat.com>
2016-03-09 11:41:13 +01:00
Ruediger Meier 056e622c91 fdisk: fix warning, uninitialized variable
This was a typo in 4afb337e.

Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
2016-03-08 14:56:02 +01:00
Ruediger Meier f5fceb401e logger: fix compiler warning, const facilitynames
This was the warning on FreeBSD:
misc-utils/logger.c:221:24: warning: passing 'const CODE [25]' to parameter of type 'CODE *' (aka 'struct _code *') discards qualifiers
      [-Wincompatible-pointer-types-discards-qualifiers]
                facility = decode(s, facilitynames);
                                     ^~~~~~~~~~~~~
misc-utils/logger.c:187:43: note: passing argument to parameter 'codetab' here
static int decode(const char *name, CODE *codetab)

Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
2016-03-08 14:55:57 +01:00
Ruediger Meier d20eb029d5 include/bitops: avoid fallbacks for more systems
Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
2016-03-08 14:55:38 +01:00
Ruediger Meier d01c0adb83 include/bitops: add casts to bswap functions
Based on kernel sources include/uapi/linux/swab.h.

Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
2016-03-08 14:55:17 +01:00
Karel Zak 075d2c0754 include: move sys/sysmacros.h to c.h
The file is no portable (#ifdef HAVE_SYS_SYSMACROS_H is necessary),
but needed on many places. It seems better to keep it in c.h.

Signed-off-by: Karel Zak <kzak@redhat.com>
2016-03-08 14:29:45 +01:00
Karel Zak 3fe3f560b7 Revert "include sysmacros.h where used"
This reverts commit 46a40c0184.
2016-03-08 14:26:33 +01:00
Benno Schulenberg bcdf097812 mount: adjust some wordings and formatting in the man page
Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
2016-03-08 14:21:55 +01:00
Benno Schulenberg c805c36923 sfdisk: adjust more wordings and formatting in the man page
Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
2016-03-08 14:21:55 +01:00
Benno Schulenberg c3cd675108 ctrlaltdel: tweak the wording in the man page
Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
2016-03-08 14:21:55 +01:00
Benno Schulenberg 289619bdb6 losetup: correct some formatting in the man page
Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
2016-03-08 14:21:55 +01:00
Benno Schulenberg bed9c1f5e5 mount: hardwrap an overlong example in the man page
Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
2016-03-08 14:21:55 +01:00
Benno Schulenberg bbe6f3cf39 fstrim: a few tiny tweaks of the man page
Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
2016-03-08 14:21:55 +01:00
Benno Schulenberg 2da0d7c0c2 agetty: tweak formatting and some wordings in the man page
Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
2016-03-08 14:21:55 +01:00
Benno Schulenberg 589b69316c fdisk, sfdisk: adjust the wording of the --wipe option
Use "when" as argument, to match the argument of --color,
that can have the same three values.

Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
2016-03-08 14:21:55 +01:00
Benno Schulenberg 7e3b3f4710 fdisk, sfdisk: adjust some formatting in the man pages
Only the optional argument should be in italics,
the literal = should be bold.

Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
2016-03-08 14:21:55 +01:00
Mike Frysinger 46a40c0184 include sysmacros.h where used
BSD/Linux systems stick major/minor/makedev in sysmacros.h.  Newer Linux
libraries have been moving away from including sysmacros.h implicitly via
sys/types.h, so include it directly.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2016-03-08 14:21:55 +01:00
Karel Zak 076153f816 tests: don't compare btrfs mount options
We don't control mount options in the mountinfo file and the options
depend on kernel version. It does not make sense to hardcode the
options in the expected outputs.

Note that libmount should be portable enough to be able to work with
all kernel versions. It seems better to check libmount functionality
than kernel mount options formatting.

Signed-off-by: Karel Zak <kzak@redhat.com>
2016-03-08 13:38:36 +01:00
Ruediger Meier 5c78d493c0 getopt: fix -n name for BSD
BSD gets the program name for warnings from getprogname() and not
from argv. Thus we use setprogname() there.

Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
2016-03-07 23:36:46 +01:00
Ruediger Meier 0ab03906c1 tests: improve getopt loop error case
Avoid exit 1 in test scripts. Simplify and complete redirection
to TS_OUPUT.

Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
2016-03-07 23:36:42 +01:00
Ruediger Meier 06311163e5 tests: getopt2, add function gnu_getopt_clean()
This makes the test compatible to OpenBSD, OSX and musl libc.

Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
2016-03-07 23:34:51 +01:00
Ruediger Meier 7e604f3c80 tests: don't skip case "output undefined"
Treat missing expected files as empty and let the test fail if
there is non-empty output.

Expected output may be missing in these cases:
 1. forgot to commit the file after changing/adding a (sub)test
 2. a bug in a test where we do tricks with TS_EXPECTED
 3. and most notable if ts_die() is called before a subtest is
    initialized, e.g. in ts_scsi_debug_init()

I always wondered why we don't treat this as FAILED. Now we do
so, ts_finalize and ts_gen_diff looks much cleaner now.

The change discovers that tests with subtest were ignoring the
"non-sub" expected files which had to be fixed. BTW we removed
any zero sized files.

Moreover now we respect diff's return value. In past all test
succeeded when diff was not able to write to diffdir, e.g. when
running tests as normal user after they run as root.

Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
2016-03-07 23:34:24 +01:00
Ruediger Meier 91aced978b tests: cramfs, fix root group
Sudo may login as group wheel or may use user's original group.
Note that group 0 is not named "root" on all Unix systems.

We have some more tests with similar issues but they are Linux-only
(losetup, scsi_debug). We don't fix them unless somebody complains.

BTW we use hexdump instead of md5sum.

Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
2016-03-07 23:30:34 +01:00
Ruediger Meier 9d76c6fb9f libmount: don't include libio.h
This include was added just one month ago in 5a971329 but I don't see
what it was good for. It's missing in musl libc.

Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
2016-03-07 23:29:55 +01:00
Ruediger Meier fea1cbf748 misc: never cast void* from malloc(3) and friends
Such cast could hide serious compiler warnings in case we are
missing includes (e.g. <stdlib.h> or "xalloc.h").

See
http://stackoverflow.com/questions/605845/do-i-cast-the-result-of-malloc

Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
2016-03-07 23:29:27 +01:00
Ruediger Meier d9851e63fb libfdisk: remove ifdef HDIO_GETGEO
We don't use HDIO_GETGEO since e5b5a349.

Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
2016-03-07 23:29:05 +01:00
Ruediger Meier 7a11addee8 fdisk: sun, undef HAVE_QSORT_R for non-Linux
Linux/glibc's qsort_r(3) has differently ordered arguments than BSD
implementations. For now we undef that quick and dirty.

The real fix would be to make configure check for qsort_r more
carefully (AC_CHECK_FUNCS with AC_LANG_WERROR). Moreover one could
add a wrapper to swap arguments, see
https://github.com/noporpoise/sort_r/blob/master/sort_r.h

Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
2016-03-07 23:28:48 +01:00
Ruediger Meier e210cfc8c8 lib: include sys/stat.h for struct stat
Compiler warning:
'struct stat' will not be visible outside of this function [-Wvisibility]

Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
2016-03-07 23:17:12 +01:00
Ruediger Meier fdbd7bb940 misc: again fixing many printf format strings
This is again a huge patch regarding printf format strings to
fix compiler warnings seen on clang/OSX.

I'm trying to follow these rules strictly:

 #type      #format   #cast
 uintmax_t   %ju      -
 intmax_t    %jd      -
 uint64_t    PRIu64   -
 int64_t     PRId64   -
 size_t      %zu      -
 ssize_t     %zd      -
 ino_t       %ju      (uintmax_t)
 off_t       %jd      (intmax_t)

Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
2016-03-07 23:16:04 +01:00
Ruediger Meier 8acff75afc wipefs, sfdisk: include libgen.h for basename(3p)
Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
2016-03-07 21:25:36 +01:00
Karel Zak 8f18a9142c Merge branch 'master' of https://github.com/Rufflewind/util-linux 2016-03-07 16:04:27 +01:00
Karel Zak cd1c5986b8 Merge branch 'tests-results-again' of https://github.com/rudimeier/util-linux
* 'tests-results-again' of https://github.com/rudimeier/util-linux:
  tests: add option --parsable
  tests: --parallel prints results in a single line
2016-03-07 15:55:08 +01:00
Karel Zak fdbfe2e7f0 Merge branch 'fix-minix' of https://github.com/rudimeier/util-linux
* 'fix-minix' of https://github.com/rudimeier/util-linux:
  tests: minix, add a useful non-root check
  tests: fix minix tests for big endian
  mkfs.minix: fix v2/v3 .badblocks inode number for big endian
  fsck.minix: fix v3 version offset
  tests: minix, some corrections and cleanup
  tests: minix, use hexdump instead of md5sum
2016-03-07 15:50:34 +01:00