agetty: cleanup debug ifdefs

Signed-off-by: Karel Zak <kzak@redhat.com>
su: fix lastlog and btmp logging

The su(1) logging code mix ups "old" and "new" passwd structs. The
result is things like

	Sep  9 11:50:45 x2 su: (to kzak) kzak on none

in /var/log/messages. The right log entry is

	Sep  9 11:50:45 x2 su: (to root) kzak on pts/3

The bug has been introduced by commit c74a7af17c7a176c358dfaa8e1814786c89ebc14.

References: https://bugzilla.redhat.com/show_bug.cgi?id=1005194
Signed-off-by: Karel Zak <kzak@redhat.com>
lib/strutils: optimalize {starts,ends}with()

Signed-off-by: Karel Zak <kzak@redhat.com>
last: fix memory leak

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
tools: generate autotools files if missing

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
hexdump: revert global exitval variable change

The change f2a037fb7b153954d5d34cca48182b6d8832fcfa had unfavorable
effect of making hexdump to return non-zero exit value always.

This happen because oversight when 'exitval' gets to be set.  By clance,
one might expect main() to call next() which will return value for
'exitval'.  That assessment misses later call chain main() -> display()
-> get() -> next(), which in reverse should return correct value for
'exitval'.

It was mentioned in util-linux maillist that Ondrej Oprala is working on
major renewal of the hexdump .  That in mind it seems best to simply to
revert the global 'exitval' and avoid conflict with Ondrej's work.

Reference: http://markmail.org/message/sbnvuhkboreujj5p
Reported-by: Dave Reisner <d@falconindy.com>
CC: Ondrej Oprala <ooprala@redhat.com>
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
lib: rename time-util.c to timeutils.c, fix headers

Signed-off-by: Karel Zak <kzak@redhat.com>
libblkid: Detect external XFS log device

Detects external XFS log devices with a minimum size of 10MB.  It's possible to
craft a smaller log, but that would be very unlikely; it'd require a small XFS
filesystem and an intentionally small log, which would defeat the performance
goal of an external log in the first place.

[kzak@redhat.com: - use UUID_LOG variable name for the log uuid]

Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
libblkid: rename UUID_LOG to LOGUUID

 * the goal is to make the uuid visible and usable it as mount
   variable/spec, then LOGUUID= seems better than UUID_LOG=

 * we already have PARTUUID=

 * the UUID_RAW and UUID_SUB are not used by mount(8)

Signed-off-by: Karel Zak <kzak@redhat.com>
libblkid: populate jbd LOGUUID in addition to UUID

The LOGUUID is alias for UUID, this alias is necessary to standardize
the tag name (we want to use the same tag LOGUUID= for all external
logs on all filesystems).

Note that for another filesystems (e.g. xfs) we have to differentiate
between the journal and filesystem uuids to avoid collisions, because
both devices use the same uuid.

Signed-off-by: Karel Zak <kzak@redhat.com>
libblkid: diffs between errors and failed probing in silicon raid

Signed-off-by: Karel Zak <kzak@redhat.com>
libblkid: diffs between errors and failed probing in via raid

Signed-off-by: Karel Zak <kzak@redhat.com>
libblkid: don't interpret regual XFS as external xfs log

 $ blkid -o udev -p tests/output/blkid/images-fs/xfs.img
 ID_FS_AMBIVALENT=filesystem:xfs other:xfs_external_log

it seems that regular XFS with internal log may be interpreted as log
device. This is incorrect.

This patch checks for XFS magic string to avoid this collision.

Signed-off-by: Karel Zak <kzak@redhat.com>
libblkid: don't use UUID= for xfs external log

The log UUID is usually the same as filesystem UUID, it is bad idea to
have two devices with the same UUID in the system. It seems batter to
use only LOGUUID= for xfs external log.

 # mkfs.xfs -l logdev=/dev/sdb1 /dev/sdb2

 # blkid -p -o udev /dev/sdb1 | grep FS
 ID_FS_LOGUUID=4063d453-5c01-46ce-b92f-9523d64aecc7
 ID_FS_TYPE=xfs_external_log
 ID_FS_USAGE=other

 # blkid -p -o udev /dev/sdb2 | grep FS
 ID_FS_UUID=4063d453-5c01-46ce-b92f-9523d64aecc7
 ID_FS_TYPE=xfs
 ID_FS_USAGE=filesystem

The filesystem (sdb2) uses UUID= and log (sdb1) uses LOGUUID=.

Signed-off-by: Karel Zak <kzak@redhat.com>
tests: add XFS log image

Signed-off-by: Karel Zak <kzak@redhat.com>
tests: refresh jbd blkid test

Signed-off-by: Karel Zak <kzak@redhat.com>
tests: use stable MBR ID

Signed-off-by: Karel Zak <kzak@redhat.com>
libblkid: use separate function to verify checksums

 * consolidate "incorrect checksum" debug messages
 * verify all on one place

Based on patch from Gabriel de Perthuis <g2p.code@gmail.com>

Signed-off-by: Karel Zak <kzak@redhat.com>
wipefs: Also wipe superblocks with bad checksums

[kzak@redhat.com: - move BLKID_SUBLKS_BADCSUM login to
                    blkid_probe_verify_csum()]

Signed-off-by: Gabriel de Perthuis <g2p.code@gmail.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
lib: add crc64()

Based on bcache code from Rolf Fokkens.

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