]> git.ipfire.org Git - thirdparty/util-linux.git/log
thirdparty/util-linux.git
9 years agovipw: use puts() when formatting unnecessary
Karel Zak [Mon, 14 Mar 2016 15:02:06 +0000 (16:02 +0100)] 
vipw: use puts() when formatting unnecessary

Signed-off-by: Karel Zak <kzak@redhat.com>
9 years agoMerge branch 'travis-osx' of https://github.com/rudimeier/util-linux
Karel Zak [Mon, 14 Mar 2016 14:59:10 +0000 (15:59 +0100)] 
Merge branch 'travis-osx' of https://github.com/rudimeier/util-linux

* 'travis-osx' of https://github.com/rudimeier/util-linux:
  travis: add OSX build
  travis: switch to Ubuntu 14.04 Trusty
  build-sys: improve uuidd and script build conditions
  build-sys: use AC_PROG_MKDIR_P and remove a few gnuisms
  build-sys: add missing "not found" strings
  build-sys: fix again UL_SCANF_TYPE_MODIFIER
  tests: don't use system's mount commands
  tests: improve skipping of old btrfs-tools
  tests: remove invalid argument in libmount/debug
  tests: skip old socat silently
  misc: fix icc/clang compiler warnings
  misc: fix printf i386 compiler warnings

9 years agotests: make libmount/lock optional
Karel Zak [Mon, 14 Mar 2016 12:24:54 +0000 (13:24 +0100)] 
tests: make libmount/lock optional

Signed-off-by: Karel Zak <kzak@redhat.com>
9 years agosulogin: fix sigset_t initialization
Karel Zak [Mon, 14 Mar 2016 12:21:27 +0000 (13:21 +0100)] 
sulogin: fix sigset_t initialization

Reported-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
Signed-off-by: Karel Zak <kzak@redhat.com>
9 years agodocs: update AUTHORS file
Sami Kerola [Sun, 13 Mar 2016 10:31:49 +0000 (10:31 +0000)] 
docs: update AUTHORS file

Former email address has not reached me since summer 2015.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
9 years agobash-completion: lsns: add missing completion file
Sami Kerola [Sun, 13 Mar 2016 10:31:48 +0000 (10:31 +0000)] 
bash-completion: lsns: add missing completion file

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
9 years agobash-completion: lslogins: add missing completion file
Sami Kerola [Sun, 13 Mar 2016 10:31:47 +0000 (10:31 +0000)] 
bash-completion: lslogins: add missing completion file

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
9 years agobash-completion: ipcmk: add missing completion file
Sami Kerola [Sun, 13 Mar 2016 10:31:46 +0000 (10:31 +0000)] 
bash-completion: ipcmk: add missing completion file

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
9 years agobash-completion: fsck.cramfs, isosize: find files an argument
Sami Kerola [Sun, 13 Mar 2016 10:31:45 +0000 (10:31 +0000)] 
bash-completion: fsck.cramfs, isosize: find files an argument

Earlier completion suggested only options for the command, this changes
options to be proposed when first character of an argument is dash.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
9 years agosetsid: fix argument count bug
Sami Kerola [Sun, 13 Mar 2016 10:31:44 +0000 (10:31 +0000)] 
setsid: fix argument count bug

The below demonstrates what happen before this change.

$ setsid --wait
setsid: child 3252 did not exit normally: Success

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
9 years agoisosize: stop unmeaningful printing errno message
Sami Kerola [Sun, 13 Mar 2016 10:31:43 +0000 (10:31 +0000)] 
isosize: stop unmeaningful printing errno message

Earlier printout had strange looking 'Success'.

$ isosize --sectors /dev/urandom
isosize: /dev/urandom: might not be an ISO filesystem
isosize: 733error: le=-1971599244 be=1633181607: Success
...

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
9 years agologger: fix memory leak [ASAN and valgrind]
Sami Kerola [Sun, 13 Mar 2016 10:31:40 +0000 (10:31 +0000)] 
logger: fix memory leak [ASAN and valgrind]

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
9 years agoswapon: fix discard=pages docs
Richard Yao [Fri, 11 Mar 2016 22:03:27 +0000 (17:03 -0500)] 
swapon: fix discard=pages docs

The documentation for discard=pages is ambiguous in that it could be
interpreted to mean either that the pages are discarded immediately
after being freed or that the pages are discarded immediately before
being reused by a write. Both implementations would satisfy the
statement "discard freed swap pages before they are avaliable for
reuse", but the kernel does the former.

Doing a discard operation (which is non-queued on SATA drives before
SATA 3.1) before a write operation to the same sector is pointless
unless using, pre-SATA 3.1 drives, where discard is detrimental because
ATA TRIM is a non-queued command.

Anyone who wants discard operations on swap and interprets the man page
as describing the incorrect behavior would opt for discard=once over
discard, when discard provides the behavior of both discard=once and
discard=pages, which is what they likely want.

Lets make a small change to the documentation to clarify the behavior.

Signed-off-by: Richard Yao <ryao@gentoo.org>
9 years agotravis: add OSX build
Ruediger Meier [Sat, 12 Mar 2016 22:45:00 +0000 (23:45 +0100)] 
travis: add OSX build

Of course OSX is not an important target but since it's available on
travis we can (mis)use it to generally improve non-Linux and non-GNU
compatibility. People are using musl, busybox or whatever and
util-linux should work for them. Having OSX build running regularly
will help us to freeze the lately improved BSD compatibility and
to check code which is usually ifdef'ed.

We are using the most recent OSX 10.11.x / Xcode 7.3 though the older
travis OSX images are working too currently.

If it turns out that this OSX build is too annoying when we are about
to add support for latest Linux features then we could add:
  allow_failures:
    - os: osx
to let it fail silently.

Note I've tried hard to keep .travis-functions.sh readable for the
Linux case. I've removed --with-python because it's default anyway,
--enable-gtk-doc is still tested in discheck.

OSX root check would also work (almost, using another --prefix) but
would only run one more test yet (minix).

OSX distcheck would have some issues with conditionally built man
pages and does not work with default distcheck confopts. No need to
fix that because distcheck is more for maintainer machines.

BTW to increase travis build speed again we could remove some targets
from the matrix without losing tested scenarios:
 - nonroot for Linux seems to be waste of time
 - clang/Linux could be root check only
For now we keep it as is.

Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
9 years agotravis: switch to Ubuntu 14.04 Trusty
Ruediger Meier [Sat, 12 Mar 2016 22:44:50 +0000 (23:44 +0100)] 
travis: switch to Ubuntu 14.04 Trusty

Now we have a reasonable recent build system with systemd, etc. We still
keep old Ubuntu 12.04 Precise to check backward compatibility but
remove the hack to install socat.

Note the new env variable PRECISE="yes" is only there to see it on travis
website.

Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
9 years agobuild-sys: improve uuidd and script build conditions
Ruediger Meier [Sun, 13 Mar 2016 20:14:08 +0000 (21:14 +0100)] 
build-sys: improve uuidd and script build conditions

Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
9 years agobuild-sys: use AC_PROG_MKDIR_P and remove a few gnuisms
Ruediger Meier [Sun, 13 Mar 2016 19:47:26 +0000 (20:47 +0100)] 
build-sys: use AC_PROG_MKDIR_P and remove a few gnuisms

Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
9 years agobuild-sys: add missing "not found" strings
Ruediger Meier [Sun, 13 Mar 2016 04:46:07 +0000 (05:46 +0100)] 
build-sys: add missing "not found" strings

Otherwise configure output looks like this:
  configure: WARNING:  not found; not building cfdisk

Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
9 years agobuild-sys: fix again UL_SCANF_TYPE_MODIFIER
Ruediger Meier [Sun, 13 Mar 2016 02:19:26 +0000 (03:19 +0100)] 
build-sys: fix again UL_SCANF_TYPE_MODIFIER

This reverts commit c8494d88:
  "build-sys: fix UL_SCANF_TYPE_MODIFIER for icc"

plus fix the check prog, because it found "%as" to be valid on
systems where "%a" is used for float conversion.

icc warns about "%ms" but it works anyways. Our AC_RUN_IFELSE prog
should do it right now regardless of compiler warnings.

Note "%ms" is POSIX.1-2008 standard but still not available on
many systems. Maybe it's time to remove "%as" fallback for old
glibc which is even less portable.

Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
9 years agotests: don't use system's mount commands
Ruediger Meier [Sun, 13 Mar 2016 05:07:16 +0000 (06:07 +0100)] 
tests: don't use system's mount commands

Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
9 years agotests: improve skipping of old btrfs-tools
Ruediger Meier [Sat, 12 Mar 2016 11:23:32 +0000 (12:23 +0100)] 
tests: improve skipping of old btrfs-tools

Older Linux distributions came with differently incomplete
btrfs-tools 0.19+git versions (2009-2013). Old mkfs.btrfs
needs minimum device size 256M.

Note the most simple way to skip btrfs-tools < 3.14 would be
  btrfs property --help 2>&1 || ts_skip "btrfs too old"
but I want to include 3.12 because of Ubuntu Trusty on travis.

This patch partly reverts/rewrites the following commits:
7e604f3c - tests: don't skip case "output undefined"
076153f8 - tests: don't compare btrfs mount options
370d31f7 - tests: skip btrfs tests if version too old

Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
9 years agotests: remove invalid argument in libmount/debug
Ruediger Meier [Thu, 10 Mar 2016 10:29:09 +0000 (11:29 +0100)] 
tests: remove invalid argument in libmount/debug

This was usually no problem because of unsafe strtoul(3) usage in
test prog libmount/src/init.c. But musl's strtoul sets errno if
no digit was found in the argument.

Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
9 years agotests: skip old socat silently
Ruediger Meier [Wed, 9 Mar 2016 17:15:25 +0000 (18:15 +0100)] 
tests: skip old socat silently

I've seen enough logs with verbose socat output for now. Let's
make it quiet.

Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
9 years agomisc: fix icc/clang compiler warnings
Ruediger Meier [Sat, 12 Mar 2016 22:55:48 +0000 (23:55 +0100)] 
misc: fix icc/clang compiler warnings

clang warning:
libmount/src/tab.c:1833:6: warning: variable 'rc' is used uninitialized whenever
      'if' condition is true [-Wsometimes-uninitialized]
        if (!mpc)
            ^~~~

icc printf warnings:
    libmount/src/monitor.c(348): warning #2279: printf/scanf format not a string literal and no format arguments
            DBG(MONITOR, ul_debugobj(mn, status == 1 ? " success" : " nothing"));
            ^
    login-utils/vipw.c(348): warning #2279: printf/scanf format not a string literal and no format arguments
                           : _("You are using shadow passwords on this system.\n"));
                                                                                  ^

icc enum warnings:
    disk-utils/fdisk-menu.c(150): warning #188: enumerated type mixed with another type
            .exclude = FDISK_DISKLABEL_GPT | FDISK_DISKLABEL_BSD,
                       ^
    libsmartcols/src/table_print.c(750): warning #188: enumerated type mixed with another type
                            &width, align,
                                    ^

Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
9 years agomisc: fix printf i386 compiler warnings
Ruediger Meier [Wed, 9 Mar 2016 16:56:58 +0000 (17:56 +0100)] 
misc: fix printf i386 compiler warnings

Still a few printf warnings found on i386 Linux:

libfdisk/src/alignment.c: In function 'fdisk_align_lba':
libfdisk/src/alignment.c:115:3: warning: format '%ju' expects argument of type 'uintmax_t', but argument 6 has type 'long unsigned int' [-Wformat]
sys-utils/lsns.c: In function ‘add_namespace’:
sys-utils/lsns.c:346:2: warning: format ‘%lu’ expects argument of type ‘long unsigned int’, but argument 4 has type ‘ino_t’ [-Wformat]
sys-utils/lsns.c: In function ‘add_process_to_namespace’:
sys-utils/lsns.c:362:2: warning: format ‘%lu’ expects argument of type ‘long unsigned int’, but argument 6 has type ‘ino_t’ [-Wformat]
sys-utils/lsns.c: In function ‘add_scols_line’:
sys-utils/lsns.c:440:4: warning: format ‘%lu’ expects argument of type ‘long unsigned int’, but argument 3 has type ‘ino_t’ [-Wformat]

Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
9 years agobuild-sys: release++ (v2.28-rc1) v2.28-rc1
Karel Zak [Fri, 11 Mar 2016 10:41:05 +0000 (11:41 +0100)] 
build-sys: release++ (v2.28-rc1)

Signed-off-by: Karel Zak <kzak@redhat.com>
9 years agodocs: update v2.28-ReleaseNotes
Karel Zak [Fri, 11 Mar 2016 10:39:28 +0000 (11:39 +0100)] 
docs: update v2.28-ReleaseNotes

Signed-off-by: Karel Zak <kzak@redhat.com>
9 years agodocs: update AUTHORS file
Karel Zak [Thu, 10 Mar 2016 14:28:28 +0000 (15:28 +0100)] 
docs: update AUTHORS file

Signed-off-by: Karel Zak <kzak@redhat.com>
9 years agopo: merge changes
Karel Zak [Thu, 10 Mar 2016 14:19:25 +0000 (15:19 +0100)] 
po: merge changes

Signed-off-by: Karel Zak <kzak@redhat.com>
9 years agopo: update zh_CN.po (from translationproject.org)
Wylmer Wang [Thu, 10 Mar 2016 13:39:45 +0000 (14:39 +0100)] 
po: update zh_CN.po (from translationproject.org)

9 years agopo: update ru.po (from translationproject.org)
Evgeniy Yakushev [Thu, 10 Mar 2016 13:39:45 +0000 (14:39 +0100)] 
po: update ru.po (from translationproject.org)

9 years agopo: update pt_BR.po (from translationproject.org)
Rafael Fontenelle [Thu, 10 Mar 2016 13:39:45 +0000 (14:39 +0100)] 
po: update pt_BR.po (from translationproject.org)

9 years agopo: update de.po (from translationproject.org)
Philipp Thomas [Thu, 10 Mar 2016 13:39:45 +0000 (14:39 +0100)] 
po: update de.po (from translationproject.org)

9 years agopo: update cs.po (from translationproject.org)
Petr Písař [Thu, 10 Mar 2016 13:39:45 +0000 (14:39 +0100)] 
po: update cs.po (from translationproject.org)

9 years agologger: keep man page consistent and use \- everywhere
Karel Zak [Thu, 10 Mar 2016 13:33:45 +0000 (14:33 +0100)] 
logger: keep man page consistent and use \- everywhere

Signed-off-by: Karel Zak <kzak@redhat.com>
9 years agomisc: remove duplicate includes
Karel Zak [Thu, 10 Mar 2016 13:30:32 +0000 (14:30 +0100)] 
misc: remove duplicate includes

Signed-off-by: Karel Zak <kzak@redhat.com>
9 years agotests: update build-sys tests
Karel Zak [Thu, 10 Mar 2016 13:28:30 +0000 (14:28 +0100)] 
tests: update build-sys tests

Signed-off-by: Karel Zak <kzak@redhat.com>
9 years agobuild-sys: fix if..endif for *_la_LDFLAGS
Karel Zak [Thu, 10 Mar 2016 12:54:15 +0000 (13:54 +0100)] 
build-sys: fix if..endif for *_la_LDFLAGS

Signed-off-by: Karel Zak <kzak@redhat.com>
9 years agoMerge branch 'test-btrfs' of https://github.com/rudimeier/util-linux
Karel Zak [Thu, 10 Mar 2016 11:49:49 +0000 (12:49 +0100)] 
Merge branch 'test-btrfs' of https://github.com/rudimeier/util-linux

9 years agosfdisk, fdisk: add fflush()
Karel Zak [Thu, 10 Mar 2016 11:26:43 +0000 (12:26 +0100)] 
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>
9 years agolibmount: Typo fix
Stanislav Brabec [Wed, 9 Mar 2016 19:52:46 +0000 (20:52 +0100)] 
libmount: Typo fix

9 years agolook: consider blanks as directory characters
Karel Zak [Wed, 9 Mar 2016 14:51:28 +0000 (15:51 +0100)] 
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>
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 agoMerge branch 'test-fixes' of https://github.com/rudimeier/util-linux
Karel Zak [Wed, 9 Mar 2016 14:08:50 +0000 (15:08 +0100)] 
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

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 agoMerge branch 'port-osx' of https://github.com/rudimeier/util-linux
Karel Zak [Wed, 9 Mar 2016 12:12:50 +0000 (13:12 +0100)] 
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

9 years agoblkdiscard: slice up the recently changed usage text
Benno Schulenberg [Wed, 9 Mar 2016 10:55:01 +0000 (11:55 +0100)] 
blkdiscard: slice up the recently changed usage text

Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
9 years agomount: further improve formatting of the man page
Benno Schulenberg [Wed, 9 Mar 2016 10:55:00 +0000 (11:55 +0100)] 
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>
9 years agofindmnt: improve formatting and wording of the man page
Benno Schulenberg [Wed, 9 Mar 2016 10:54:59 +0000 (11:54 +0100)] 
findmnt: improve formatting and wording of the man page

Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
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 agofdisk: fix warning, uninitialized variable
Ruediger Meier [Tue, 8 Mar 2016 10:30:25 +0000 (11:30 +0100)] 
fdisk: fix warning, uninitialized variable

This was a typo in 4afb337e.

Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
9 years agologger: fix compiler warning, const facilitynames
Ruediger Meier [Tue, 8 Mar 2016 10:23:14 +0000 (11:23 +0100)] 
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>
9 years agoinclude/bitops: avoid fallbacks for more systems
Ruediger Meier [Tue, 8 Mar 2016 09:35:58 +0000 (10:35 +0100)] 
include/bitops: avoid fallbacks for more systems

Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
9 years agoinclude/bitops: add casts to bswap functions
Ruediger Meier [Tue, 8 Mar 2016 08:11:08 +0000 (09:11 +0100)] 
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>
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