]> git.ipfire.org Git - thirdparty/util-linux.git/log
thirdparty/util-linux.git
9 years agotests: skip btrfs tests if version too old
Ruediger Meier [Wed, 9 Mar 2016 11:30:53 +0000 (11:30 +0000)] 
tests: skip btrfs tests if version too old

Noticed on Debian 7 (Wheezy), btrfs-tools 0.19:
btrfs inspect-internal: unknown token 'rootid'

CC: Stanislav Brabec <sbrabec@suse.cz>
Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
9 years agotests: fix non-working udevadm settle for scsi_debug
Ruediger Meier [Wed, 9 Mar 2016 11:26:38 +0000 (11:26 +0000)] 
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>
9 years agotests: hotfix, wait for scsi_debug partion
Ruediger Meier [Wed, 9 Mar 2016 13:08:03 +0000 (13:08 +0000)] 
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>
9 years agotests: don't use mkfs.btrfs option -f
Ruediger Meier [Wed, 9 Mar 2016 11:30:53 +0000 (11:30 +0000)] 
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>
9 years agotests: ignore swapon warnings
Ruediger Meier [Wed, 9 Mar 2016 11:01:54 +0000 (12:01 +0100)] 
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>
9 years agotests: udevadm settle before losetup -d
Ruediger Meier [Wed, 9 Mar 2016 10:33:47 +0000 (11:33 +0100)] 
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>
9 years agomisc: avoid shadowing
Karel Zak [Wed, 9 Mar 2016 11:00:52 +0000 (12:00 +0100)] 
misc: avoid shadowing

Signed-off-by: Karel Zak <kzak@redhat.com>
9 years agolib/linux_version: avoid major and minor shadowing
Karel Zak [Wed, 9 Mar 2016 10:49:42 +0000 (11:49 +0100)] 
lib/linux_version: avoid major and minor shadowing

Signed-off-by: Karel Zak <kzak@redhat.com>
9 years agocal: remove libtermcap arguments to my_tgetstr()
Sami Kerola [Tue, 8 Mar 2016 22:35:50 +0000 (22:35 +0000)] 
cal: remove libtermcap arguments to my_tgetstr()

Missed in commit b4566a8a8d0cf345e637194f9c95091a1ef4dfe0.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
9 years agomisc: remove path name definitions that are unused
Sami Kerola [Tue, 8 Mar 2016 22:13:38 +0000 (22:13 +0000)] 
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>
9 years agotests: mark script race test as "known fail"
Karel Zak [Wed, 9 Mar 2016 10:41:13 +0000 (11:41 +0100)] 
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>
9 years agoinclude: move sys/sysmacros.h to c.h
Karel Zak [Tue, 8 Mar 2016 13:29:45 +0000 (14:29 +0100)] 
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>
9 years agoRevert "include sysmacros.h where used"
Karel Zak [Tue, 8 Mar 2016 13:26:33 +0000 (14:26 +0100)] 
Revert "include sysmacros.h where used"

This reverts commit 46a40c018438b7b2b25083a5e5a4a21055a0c1e9.

9 years agomount: adjust some wordings and formatting in the man page
Benno Schulenberg [Tue, 8 Mar 2016 09:07:52 +0000 (10:07 +0100)] 
mount: adjust some wordings and formatting in the man page

Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
9 years agosfdisk: adjust more wordings and formatting in the man page
Benno Schulenberg [Tue, 8 Mar 2016 09:07:51 +0000 (10:07 +0100)] 
sfdisk: adjust more wordings and formatting in the man page

Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
9 years agoctrlaltdel: tweak the wording in the man page
Benno Schulenberg [Tue, 8 Mar 2016 09:07:50 +0000 (10:07 +0100)] 
ctrlaltdel: tweak the wording in the man page

Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
9 years agolosetup: correct some formatting in the man page
Benno Schulenberg [Tue, 8 Mar 2016 09:07:49 +0000 (10:07 +0100)] 
losetup: correct some formatting in the man page

Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
9 years agomount: hardwrap an overlong example in the man page
Benno Schulenberg [Tue, 8 Mar 2016 09:07:48 +0000 (10:07 +0100)] 
mount: hardwrap an overlong example in the man page

Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
9 years agofstrim: a few tiny tweaks of the man page
Benno Schulenberg [Tue, 8 Mar 2016 09:07:47 +0000 (10:07 +0100)] 
fstrim: a few tiny tweaks of the man page

Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
9 years agoagetty: tweak formatting and some wordings in the man page
Benno Schulenberg [Tue, 8 Mar 2016 09:07:46 +0000 (10:07 +0100)] 
agetty: tweak formatting and some wordings in the man page

Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
9 years agofdisk, sfdisk: adjust the wording of the --wipe option
Benno Schulenberg [Tue, 8 Mar 2016 09:07:45 +0000 (10:07 +0100)] 
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>
9 years agofdisk, sfdisk: adjust some formatting in the man pages
Benno Schulenberg [Tue, 8 Mar 2016 09:07:44 +0000 (10:07 +0100)] 
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>
9 years agoinclude sysmacros.h where used
Mike Frysinger [Mon, 7 Mar 2016 22:26:33 +0000 (17:26 -0500)] 
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>
9 years agotests: don't compare btrfs mount options
Karel Zak [Tue, 8 Mar 2016 12:38:36 +0000 (13:38 +0100)] 
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>
9 years agogetopt: fix -n name for BSD
Ruediger Meier [Mon, 7 Mar 2016 10:44:55 +0000 (11:44 +0100)] 
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>
9 years agotests: improve getopt loop error case
Ruediger Meier [Mon, 7 Mar 2016 08:20:59 +0000 (09:20 +0100)] 
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>
9 years agotests: getopt2, add function gnu_getopt_clean()
Ruediger Meier [Sun, 6 Mar 2016 21:28:11 +0000 (22:28 +0100)] 
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>
9 years agotests: don't skip case "output undefined"
Ruediger Meier [Sat, 5 Mar 2016 17:51:59 +0000 (18:51 +0100)] 
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>
9 years agotests: cramfs, fix root group
Ruediger Meier [Thu, 3 Mar 2016 12:54:17 +0000 (13:54 +0100)] 
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>
9 years agolibmount: don't include libio.h
Ruediger Meier [Thu, 3 Mar 2016 16:29:58 +0000 (17:29 +0100)] 
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>
9 years agomisc: never cast void* from malloc(3) and friends
Ruediger Meier [Fri, 26 Feb 2016 10:10:24 +0000 (11:10 +0100)] 
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>
9 years agolibfdisk: remove ifdef HDIO_GETGEO
Ruediger Meier [Thu, 25 Feb 2016 19:29:30 +0000 (20:29 +0100)] 
libfdisk: remove ifdef HDIO_GETGEO

We don't use HDIO_GETGEO since e5b5a349.

Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
9 years agofdisk: sun, undef HAVE_QSORT_R for non-Linux
Ruediger Meier [Thu, 25 Feb 2016 17:29:48 +0000 (18:29 +0100)] 
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>
9 years agolib: include sys/stat.h for struct stat
Ruediger Meier [Mon, 22 Feb 2016 15:49:15 +0000 (16:49 +0100)] 
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>
9 years agomisc: again fixing many printf format strings
Ruediger Meier [Mon, 22 Feb 2016 10:58:05 +0000 (11:58 +0100)] 
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>
9 years agowipefs, sfdisk: include libgen.h for basename(3p)
Ruediger Meier [Thu, 18 Feb 2016 02:07:23 +0000 (03:07 +0100)] 
wipefs, sfdisk: include libgen.h for basename(3p)

Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
9 years agoMerge branch 'master' of https://github.com/Rufflewind/util-linux
Karel Zak [Mon, 7 Mar 2016 15:04:27 +0000 (16:04 +0100)] 
Merge branch 'master' of https://github.com/Rufflewind/util-linux

9 years agoMerge branch 'tests-results-again' of https://github.com/rudimeier/util-linux
Karel Zak [Mon, 7 Mar 2016 14:55:08 +0000 (15:55 +0100)] 
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

9 years agoMerge branch 'fix-minix' of https://github.com/rudimeier/util-linux
Karel Zak [Mon, 7 Mar 2016 14:50:34 +0000 (15:50 +0100)] 
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

9 years agobuild-sys: add and use openat build conditionals
Ruediger Meier [Mon, 29 Feb 2016 16:45:46 +0000 (17:45 +0100)] 
build-sys: add and use openat build conditionals

Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
9 years agofdisk: remove unused include sysfs.h
Ruediger Meier [Mon, 29 Feb 2016 12:58:48 +0000 (13:58 +0100)] 
fdisk: remove unused include sysfs.h

Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
9 years agolib: move fopen_at() to fileutils.h, remove at.h
Ruediger Meier [Mon, 29 Feb 2016 11:49:13 +0000 (12:49 +0100)] 
lib: move fopen_at() to fileutils.h, remove at.h

Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
9 years agolib: remove openat fallback functions (include/at.h)
Ruediger Meier [Mon, 29 Feb 2016 11:38:58 +0000 (12:38 +0100)] 
lib: remove openat fallback functions (include/at.h)

I have validated that we are still compatible at least back to
  - openSUSE 11.4
  - SLE 11
  - RHEL/CentOS 6
  - OSX 10.10.x, (Xcode 6.3)
  - FreeBSD 10.2

Confirmed incompatibility:
  - OSX 10.9.x, (Xcode 6.2)

Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
9 years agotaskset: fix description of `-c` option in the man page
Yuriy M. Kaminskiy [Sun, 28 Feb 2016 00:57:03 +0000 (03:57 +0300)] 
taskset: fix description of `-c` option in the man page

Commit 42f15e9848dc07e86a2b80c742a0179aaced6c71 introduced a certain
inaccuracy in -c option description; it is not _the option with an argument_,
but it is the flag that changes interpretation of `mask` parameter.
The difference is almost not noticeable, but there are one corner case where it is:
   taskset -c 1 -p $$
fails (but it would work if 42f15e was correct). Instead,
   taskset -c -p 1 $$
works (but it should not have if 42f15e was correct).

Signed-off-by: Karel Zak <kzak@redhat.com>
9 years agomisc: safer (and uniform) handling of return value
Yuriy M. Kaminskiy [Sat, 27 Feb 2016 16:27:29 +0000 (19:27 +0300)] 
misc: safer (and uniform) handling of return value

When `rc` is `INT_MAX`, `rc + 1` result in signed integer overflow.

Signed-off-by: Karel Zak <kzak@redhat.com>
9 years agolsns.c: fix error return
Yuriy M. Kaminskiy [Sat, 27 Feb 2016 16:14:44 +0000 (19:14 +0300)] 
lsns.c: fix error return

If non-negative value returned, errno could be unset (especially 0).

Signed-off-by: Karel Zak <kzak@redhat.com>
9 years agolscpu: fix backward buffer size adjustment after adding delimiter
Yuriy M. Kaminskiy [Sat, 27 Feb 2016 15:00:50 +0000 (18:00 +0300)] 
lscpu: fix backward buffer size adjustment after adding delimiter

remaining buffer space was increased after adding character, instead
of decreasing

Signed-off-by: Karel Zak <kzak@redhat.com>
9 years agolibfdisk: Fix order of C/H/S numbers output
Andreas Henriksson [Thu, 25 Feb 2016 10:26:53 +0000 (11:26 +0100)] 
libfdisk: Fix order of C/H/S numbers output

While the header says C/H/S the actual numbers where printed as
C/S/H.

Addresses: http://bugs.debian.org/815847
Reported-by: "groups, freeman" <freeman_groups@reason.dyndns.org>
Signed-off-by: Andreas Henriksson <andreas@fatal.se>
9 years agoMerge branch 'port-osx' of https://github.com/rudimeier/util-linux
Karel Zak [Mon, 7 Mar 2016 13:37:31 +0000 (14:37 +0100)] 
Merge branch 'port-osx' of https://github.com/rudimeier/util-linux

* 'port-osx' of https://github.com/rudimeier/util-linux:
  lib: include strutils.h for mempcpy()
  build-sys: remove duplicate cal sources
  lib: provide fallback if mkostemp(3) missing
  build-sys: chrt requires a sched_set* function
  build-sys: add --disable-ipcrm --disable-ipcs
  build-sys: disable login-utils if shadow.h or utmp.h is missing
  login-utils: minor utmp cleanup
  build-sys: build_init should check for flock
  newgrp: rename memset_s()
  misc: fix some includes
  libsmartcols: fix uninitialized variable
  fdisk: fix warning, incompatible pointer types passing 'uint64_t *'
  logger: use SCM_CREDENTIALS on LINUX only

9 years agosetarch: fix personality syscall return code check
Dmitry V. Levin [Fri, 4 Mar 2016 21:22:52 +0000 (00:22 +0300)] 
setarch: fix personality syscall return code check

Depending on architecture and kernel version, personality
syscall is either capable or incapable of returning an error.
If the return value is not an error, then it's the previous
personality value, which can be an arbitrary value
undistinguishable from an error value.
To make things clear, a second call is needed.

For more details about personality syscall peculiarities see
https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=glibc-2.22-637-ge0043e17dfc5

Signed-off-by: Dmitry V. Levin <ldv@altlinux.org>
9 years agohexdump: certain long options should not accept arguments
Phil Ruffwind [Sun, 6 Mar 2016 18:45:02 +0000 (13:45 -0500)] 
hexdump: certain long options should not accept arguments

As documented in the manual and the usage info, the long options
--one-byte-char, --canonical, and --two-bytes-octal should not accept
any arguments.

Signed-off-by: Phil Ruffwind <rf@rufflewind.com>
9 years agotests: add option --parsable
Ruediger Meier [Sat, 5 Mar 2016 14:40:57 +0000 (15:40 +0100)] 
tests: add option --parsable

This is to force the one-line results also for non-parallel case.
We are using it for travis auto-build and on other build farms.

Moreover you can set this (and any other) option globally by env
which is the only way to pass it to make distcheck.

Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
9 years agotests: --parallel prints results in a single line
Ruediger Meier [Thu, 17 Dec 2015 09:46:32 +0000 (10:46 +0100)] 
tests: --parallel prints results in a single line

Like in non-parallel case we are printing only one line per
(sub)test now. The output lines must contain the full test name
to be useful.

This patch does not change anything for the non-parallel output
format except a bit code cleanup.

BTW changed blkid/low-probe test description to have shorter
lines.

Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
9 years agotests: minix, add a useful non-root check
Ruediger Meier [Thu, 3 Mar 2016 00:57:35 +0000 (01:57 +0100)] 
tests: minix, add a useful non-root check

Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
9 years agotests: fix minix tests for big endian
Ruediger Meier [Wed, 2 Mar 2016 12:48:46 +0000 (13:48 +0100)] 
tests: fix minix tests for big endian

You may diff the new .BE files with non-BE file to see whether they
look fine.

Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
9 years agomkfs.minix: fix v2/v3 .badblocks inode number for big endian
Ruediger Meier [Tue, 1 Mar 2016 20:03:13 +0000 (21:03 +0100)] 
mkfs.minix: fix v2/v3 .badblocks inode number for big endian

For minix v2/v3 on big endian systems the inode number of the unwanted
".badblocks" file was not set to zero. This was introduced when v3 was
added in a2657ae3.

Actually it did not seem to cause any problems but since we zero it out
at all we should do it correctly. Now we zero out the whole directory
entry (inclusive ".badblocks" file name, also for v1). Unfortunately we
have to update the test data checksums.

CC: Davidlohr Bueso <davidlohr@hp.com>
Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
9 years agofsck.minix: fix v3 version offset
Ruediger Meier [Wed, 2 Mar 2016 21:29:00 +0000 (22:29 +0100)] 
fsck.minix: fix v3 version offset

Our test-suite discoverd it on big endian systems, but it was also
broken on little endian for inode numbers > 0xffff.

Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
9 years agotests: minix, some corrections and cleanup
Ruediger Meier [Wed, 2 Mar 2016 19:14:26 +0000 (20:14 +0100)] 
tests: minix, some corrections and cleanup

 - move generic "check_minix_fs_type" tests to the top
 - add some todos/notes about potential issues
 - add "real" badblocks test (-l)
 - don't check sed's but fsck's return value
 - to see debian bug 773892 we would need "-f"
 - add some more hexdumps

CC: Sami Kerola <kerolasa@iki.fi>
Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
9 years agotests: minix, use hexdump instead of md5sum
Ruediger Meier [Wed, 2 Mar 2016 11:59:55 +0000 (12:59 +0100)] 
tests: minix, use hexdump instead of md5sum

Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
9 years agolib: include strutils.h for mempcpy()
Ruediger Meier [Thu, 25 Feb 2016 13:21:23 +0000 (14:21 +0100)] 
lib: include strutils.h for mempcpy()

We have that mempcpy fallback since 2013 (02887b73) but forgot to
include it.

This fixes a segfault of cal(1) on FreeBSD and OSX.

Compiler warning was:
lib/mbsalign.c:468:14: warning: implicit declaration of function 'mempcpy' is invalid in C99 [-Wimplicit-function-declaration]
      dest = mempcpy (dest, str_to_print, min (n_used_bytes, space_left));
             ^
lib/mbsalign.c:468:12: warning: incompatible integer to pointer conversion assigning to 'char *' from 'int' [-Wint-conversion]
      dest = mempcpy (dest, str_to_print, min (n_used_bytes, space_left));

CC: Daniel Trebbien <dtrebbien@gmail.com>
Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
9 years agobuild-sys: remove duplicate cal sources
Ruediger Meier [Thu, 25 Feb 2016 13:46:50 +0000 (14:46 +0100)] 
build-sys: remove duplicate cal sources

These extra sources should have been removed since cal is
linked against libcommon (see 7b353df2).

CC: Sami Kerola <kerolasa@iki.fi>
Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
9 years agolib: provide fallback if mkostemp(3) missing
Ruediger Meier [Sat, 27 Feb 2016 12:28:04 +0000 (13:28 +0100)] 
lib: provide fallback if mkostemp(3) missing

It's missing on OSX.

CC: Yuriy M. Kaminskiy <yumkam@gmail.com>
Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
9 years agobuild-sys: chrt requires a sched_set* function
Ruediger Meier [Wed, 24 Feb 2016 12:14:20 +0000 (13:14 +0100)] 
build-sys: chrt requires a sched_set* function

Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
9 years agobuild-sys: add --disable-ipcrm --disable-ipcs
Ruediger Meier [Mon, 8 Feb 2016 14:32:26 +0000 (15:32 +0100)] 
build-sys: add --disable-ipcrm --disable-ipcs

ipcs's source history looks like some people are using it on BSD
but it won't build on most non-Linux systems. That's why it's nice
let "./configure --disable-ipcrm --disable-ipcs" work.

Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
9 years agobuild-sys: disable login-utils if shadow.h or utmp.h is missing
Ruediger Meier [Tue, 23 Feb 2016 22:15:35 +0000 (23:15 +0100)] 
build-sys: disable login-utils if shadow.h or utmp.h is missing

Actually we could have also used UL_REQUIRES_LINUX because our
utmp usage and the shadow.h header is unlikely to be portable.
However only requiring these headers may help others who are
curious what needs to be done to port something.

Note, we could easily make the utmp stuff more portable by using
utmpx which is POSIX standard and on LINUX (glibc) basically just
renaming work. See getutxent(3).

Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
9 years agologin-utils: minor utmp cleanup
Ruediger Meier [Wed, 24 Feb 2016 19:25:11 +0000 (20:25 +0100)] 
login-utils: minor utmp cleanup

- consistently use ut->ut_user instead of ut->ut_name
- don't include obsolete lastlog.h BSD header

Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
9 years agobuild-sys: build_init should check for flock
Ruediger Meier [Wed, 24 Feb 2016 08:34:48 +0000 (09:34 +0100)] 
build-sys: build_init should check for flock

To let a plain ./configure work on systems without create_timer().
see 254743e4

Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
9 years agonewgrp: rename memset_s()
Ruediger Meier [Wed, 24 Feb 2016 01:07:57 +0000 (02:07 +0100)] 
newgrp: rename memset_s()

It's already defined in OSX standard c library.

Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
9 years agomisc: fix some includes
Ruediger Meier [Mon, 22 Feb 2016 16:25:21 +0000 (17:25 +0100)] 
misc: fix some includes

features.h:  any glibc header includes this already
libgen.h:    was unused there
sys/uio.h:   for writev(3p)
sys/queue.h  seems like it was never used

Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
9 years agolibsmartcols: fix uninitialized variable
Ruediger Meier [Fri, 26 Feb 2016 00:32:18 +0000 (01:32 +0100)] 
libsmartcols: fix uninitialized variable

This got broken in 2a750b4c.

Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
9 years agofdisk: fix warning, incompatible pointer types passing 'uint64_t *'
Ruediger Meier [Mon, 22 Feb 2016 15:32:06 +0000 (16:32 +0100)] 
fdisk: fix warning, incompatible pointer types passing 'uint64_t *'

Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
9 years agologger: use SCM_CREDENTIALS on LINUX only
Ruediger Meier [Fri, 19 Feb 2016 00:44:14 +0000 (01:44 +0100)] 
logger: use SCM_CREDENTIALS on LINUX only

This is a build fix of FreeBSD and OSX. Basically we revert
the following commit for non-linux systems:
27a9eb53 "use --id as local socket credentials"

Note I could also compile it like this:

  #ifdef HAVE_SYS_UCRED_H
  # define _WANT_UCRED
  # include <sys/param.h>
  # include <sys/ucred.h>
  # define SCM_CREDENTIALS SCM_CREDS
  #endif

  [...]
  #ifdef _linux_
  cred->pid = ctl->pid;
  #endif
  [...]

... but don't know how to test whether it does what it
should.

Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
9 years agoblkdiscard: add --zeroout (BLKZEROOUT ioctl)
Karel Zak [Wed, 24 Feb 2016 14:21:38 +0000 (15:21 +0100)] 
blkdiscard: add --zeroout (BLKZEROOUT ioctl)

Requested-by: Yaniv Kaul <ykaul@redhat.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
9 years agoMerge branch 'ldadd-cflags-warnings' of https://github.com/rudimeier/util-linux
Karel Zak [Wed, 24 Feb 2016 12:51:10 +0000 (13:51 +0100)] 
Merge branch 'ldadd-cflags-warnings' of https://github.com/rudimeier/util-linux

* 'ldadd-cflags-warnings' of https://github.com/rudimeier/util-linux:
  build-sys: disable unused parameter warnings for some test progs
  misc: fix compiler warnungs (unsigned/signed)
  misc: fix warnings "unused parameter" [-Wunused-parameter]
  libfdisk: fix warnings, "redundant redeclaration" [-Wredundant-decls]
  tests: fix compiler warnings [-Wmissing-prototypes]
  libfdisk: fix compiler warnings [-Wmissing-prototypes]
  libfdisk: fix missing symbol
  libblkid: fix compiler warnings [-Wmissing-prototypes]
  libmount: add mnt_fs_set_priority()
  build-sys: always add AM_CFLAGS
  build-sys: always use global LDADD

9 years agolibsmartcols: fix stupid typo
Karel Zak [Wed, 24 Feb 2016 12:42:28 +0000 (13:42 +0100)] 
libsmartcols: fix stupid typo

Signed-off-by: Karel Zak <kzak@redhat.com>
9 years agounshare: add example for persistent mount namespace
Karel Zak [Wed, 24 Feb 2016 12:28:19 +0000 (13:28 +0100)] 
unshare: add example for persistent mount namespace

References: https://github.com/karelzak/util-linux/issues/289
Signed-off-by: Karel Zak <kzak@redhat.com>
9 years agochrt: restore removed ifdef SCHED_RESET_ON_FORK
Ruediger Meier [Wed, 24 Feb 2016 11:29:49 +0000 (12:29 +0100)] 
chrt: restore removed ifdef SCHED_RESET_ON_FORK

They got lost in acde3a05.

Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
9 years agochrt: fix case SCHED_RR
Ruediger Meier [Wed, 24 Feb 2016 11:29:48 +0000 (12:29 +0100)] 
chrt: fix case SCHED_RR

Looks like the logic was mistakenly changed in acde3a05.

Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
9 years agolibsmartcols: fix relative column width for maxout
Karel Zak [Wed, 24 Feb 2016 11:34:37 +0000 (12:34 +0100)] 
libsmartcols: fix relative column width for maxout

Signed-off-by: Karel Zak <kzak@redhat.com>
9 years agofindmnt: use scols_table_print_range() for --poll
Karel Zak [Wed, 24 Feb 2016 11:04:24 +0000 (12:04 +0100)] 
findmnt: use scols_table_print_range() for --poll

This change fixes problem with duplicate header line.

Signed-off-by: Karel Zak <kzak@redhat.com>
9 years agologger: always update header when writing stdin line
Karel Zak [Wed, 24 Feb 2016 09:40:08 +0000 (10:40 +0100)] 
logger: always update header when writing stdin line

Addresses: http://bugs.debian.org/798239
Reported-by: Sami Kerola <kerolasa@iki.fi>
Signed-off-by: Karel Zak <kzak@redhat.com>
9 years agobuild-sys: disable unused parameter warnings for some test progs
Ruediger Meier [Tue, 23 Feb 2016 02:15:23 +0000 (03:15 +0100)] 
build-sys: disable unused parameter warnings for some test progs

Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
9 years agomisc: fix compiler warnungs (unsigned/signed)
Ruediger Meier [Mon, 22 Feb 2016 23:54:41 +0000 (00:54 +0100)] 
misc: fix compiler warnungs (unsigned/signed)

These ones should be fixed:
libblkid/src/probe.c:393:39: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
libblkid/src/probe.c:907:25: warning: signed and unsigned type in conditional expression [-Wsign-compare]
libblkid/src/probe.c:1221:8: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
libblkid/src/partitions/partitions.c:540:47: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
libblkid/src/partitions/partitions.c:1043:14: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
libblkid/src/partitions/partitions.c:1056:38: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
libblkid/src/partitions/partitions.c:1057:37: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
libblkid/src/partitions/partitions.c:1061:38: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
libblkid/src/partitions/partitions.c:1199:27: warning: signed and unsigned type in conditional expression [-Wsign-compare]
libblkid/src/partitions/partitions.c:1410:26: warning: signed and unsigned type in conditional expression [-Wsign-compare]
libblkid/src/partitions/partitions.c:1431:25: warning: signed and unsigned type in conditional expression [-Wsign-compare]
libblkid/src/superblocks/linux_raid.c:151:8: warning: comparison of unsigned expression < 0 is always false [-Wtype-limits]
libblkid/src/superblocks/linux_raid.c:155:2: warning: comparison of unsigned expression < 0 is always false [-Wtype-limits]
libblkid/src/superblocks/superblocks.c:375:30: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
libblkid/src/superblocks/xfs.c:141:24: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
libsmartcols/src/table.c:333:24: warning: signed and unsigned type in conditional expression [-Wsign-compare]
libsmartcols/src/table.c:344:25: warning: signed and unsigned type in conditional expression [-Wsign-compare]
libsmartcols/src/table_print.c:753:9: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
libfdisk/src/ask.c:364:21: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
libfdisk/src/utils.c:33:17: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
libfdisk/src/context.c:435:56: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
libfdisk/src/context.c:730:17: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
libfdisk/src/script.c:557:10: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
libfdisk/src/dos.c:1791:17: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
libfdisk/src/gpt.c:813:42: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
misc-utils/logger.c:408:26: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
misc-utils/logger.c:408:26: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
misc-utils/logger.c:408:26: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
misc-utils/logger.c:408:26: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
misc-utils/logger.c:408:26: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
disk-utils/partx.c:140:13: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
disk-utils/partx.c:551:16: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
disk-utils/partx.c:640:16: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]

Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
9 years agomisc: fix warnings "unused parameter" [-Wunused-parameter]
Ruediger Meier [Mon, 22 Feb 2016 23:26:46 +0000 (00:26 +0100)] 
misc: fix warnings "unused parameter" [-Wunused-parameter]

Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
9 years agolibfdisk: fix warnings, "redundant redeclaration" [-Wredundant-decls]
Ruediger Meier [Mon, 22 Feb 2016 22:53:31 +0000 (23:53 +0100)] 
libfdisk: fix warnings, "redundant redeclaration" [-Wredundant-decls]

Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
9 years agotests: fix compiler warnings [-Wmissing-prototypes]
Ruediger Meier [Mon, 22 Feb 2016 22:30:17 +0000 (23:30 +0100)] 
tests: fix compiler warnings [-Wmissing-prototypes]

Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
9 years agolibfdisk: fix compiler warnings [-Wmissing-prototypes]
Ruediger Meier [Mon, 22 Feb 2016 22:06:28 +0000 (23:06 +0100)] 
libfdisk: fix compiler warnings [-Wmissing-prototypes]

Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
9 years agolibfdisk: fix missing symbol
Ruediger Meier [Mon, 22 Feb 2016 22:04:27 +0000 (23:04 +0100)] 
libfdisk: fix missing symbol

Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
9 years agolibblkid: fix compiler warnings [-Wmissing-prototypes]
Ruediger Meier [Mon, 22 Feb 2016 21:23:38 +0000 (22:23 +0100)] 
libblkid: fix compiler warnings [-Wmissing-prototypes]

Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
9 years agolibmount: add mnt_fs_set_priority()
Ruediger Meier [Mon, 22 Feb 2016 20:20:13 +0000 (21:20 +0100)] 
libmount: add mnt_fs_set_priority()

Looks like it got lost in ce4dd666.

Compiler warning discoverd this issue:
libmount/src/fs.c:1171:5: warning: no previous prototype for 'mnt_fs_set_priority' [-Wmissing-prototypes]
 int mnt_fs_set_priority(struct libmnt_fs *fs, int prio)
     ^

Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
9 years agobuild-sys: always add AM_CFLAGS
Ruediger Meier [Mon, 22 Feb 2016 19:20:14 +0000 (20:20 +0100)] 
build-sys: always add AM_CFLAGS

We were missing our nice compliler warnings for many programs
and libs. See next commits how many trivial and non-trival
warnings have to be fixed.

Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
9 years agobuild-sys: always use global LDADD
Ruediger Meier [Mon, 22 Feb 2016 18:48:30 +0000 (19:48 +0100)] 
build-sys: always use global LDADD

This was a major showstopper when building on a system where
LTLIBINTL libs are needed (e.g. OSX). Maybe there are a few test
programs which wouldn't need LDADD ... never mind.

Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
9 years agolibsmartcols: fix scols_table_print_range() to print header
Karel Zak [Mon, 22 Feb 2016 09:43:25 +0000 (10:43 +0100)] 
libsmartcols: fix scols_table_print_range() to print header

References: https://github.com/karelzak/util-linux/issues/287
Signed-off-by: Karel Zak <kzak@redhat.com>
9 years agoMerge branch 'scols_table_print_range_to_string' of https://github.com/ignatenkobrain...
Karel Zak [Mon, 22 Feb 2016 09:37:41 +0000 (10:37 +0100)] 
Merge branch 'scols_table_print_range_to_string' of https://github.com/ignatenkobrain/util-linux

9 years agoMerge branch 'errno-strutils' of https://github.com/rudimeier/util-linux
Karel Zak [Mon, 22 Feb 2016 08:50:57 +0000 (09:50 +0100)] 
Merge branch 'errno-strutils' of https://github.com/rudimeier/util-linux

9 years agoipcs: show gid instead of uid
Hushan Jia [Mon, 22 Feb 2016 05:10:24 +0000 (21:10 -0800)] 
ipcs: show gid instead of uid

ipcs -i incorrectly used uid where it should be gid

Signed-off-by: Hushan Jia <hushan.jia@gmail.com>
9 years agovipw: Remove pre-ANSI compiler support
Romain Naour [Fri, 19 Feb 2016 21:50:48 +0000 (22:50 +0100)] 
vipw: Remove pre-ANSI compiler support

__P() is used for compatibility with old K&R C compilers. With
ANSI C this macro has no effect.

This fixes a compilation error with musl libc because of undeclared
__P.

Ref:
https://lists.samba.org/archive/samba-technical/2015-June/108042.html

Signed-off-by: Romain Naour <romain.naour@gmail.com>
9 years agobuild-sys: fix typo
Romain Naour [Fri, 19 Feb 2016 21:50:47 +0000 (22:50 +0100)] 
build-sys: fix typo

When timer_create is available have_timer must be
set to "yes". But instead have_time is used.

Replace have_time by have_timer.

Fixes:
http://autobuild.buildroot.net/results/993/9935cd0522d4f978ba2e788a690f66790686b76b

Signed-off-by: Romain Naour <romain.naour@gmail.com>
9 years agolibsmartcols: implement scols_table_print_range_to_string
Igor Gnatenko [Sun, 21 Feb 2016 20:13:50 +0000 (21:13 +0100)] 
libsmartcols: implement scols_table_print_range_to_string

Reference: https://github.com/karelzak/util-linux/issues/283
Signed-off-by: Igor Gnatenko <i.gnatenko.brain@gmail.com>
9 years agotests: add logger tests "id _numbers_ with spaces"
Ruediger Meier [Sun, 21 Feb 2016 17:03:13 +0000 (18:03 +0100)] 
tests: add logger tests "id _numbers_ with spaces"

Leading spaces are allowed.

Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>