]> git.ipfire.org Git - thirdparty/util-linux.git/log
thirdparty/util-linux.git
10 years agotests: fix getopt for old glibc
Ruediger Meier [Tue, 24 Mar 2015 08:37:30 +0000 (09:37 +0100)] 
tests: fix getopt for old glibc

Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
10 years agobuild-sys: python is optional, don't fail when missing
Karel Zak [Thu, 26 Mar 2015 11:09:50 +0000 (12:09 +0100)] 
build-sys: python is optional, don't fail when missing

Signed-off-by: Karel Zak <kzak@redhat.com>
10 years agobuild-sys: ncurses is optional, don't fail when missing
Karel Zak [Thu, 26 Mar 2015 10:50:15 +0000 (11:50 +0100)] 
build-sys: ncurses is optional, don't fail when missing

Signed-off-by: Karel Zak <kzak@redhat.com>
10 years agotests: add --exclude=<list> for run.sh
Karel Zak [Wed, 25 Mar 2015 18:32:22 +0000 (19:32 +0100)] 
tests: add --exclude=<list> for run.sh

Signed-off-by: Karel Zak <kzak@redhat.com>
10 years agobuild-sys: support static build with readline
Karel Zak [Wed, 25 Mar 2015 16:55:22 +0000 (17:55 +0100)] 
build-sys: support static build with readline

Signed-off-by: Karel Zak <kzak@redhat.com>
10 years agotests: more(1) depends on terminal, force to TERM=linux
Karel Zak [Wed, 25 Mar 2015 16:36:28 +0000 (17:36 +0100)] 
tests: more(1) depends on terminal, force to TERM=linux

Signed-off-by: Karel Zak <kzak@redhat.com>
10 years agodocs: remove obsolete things from TODO
Karel Zak [Wed, 25 Mar 2015 15:09:32 +0000 (16:09 +0100)] 
docs: remove obsolete things from TODO

Signed-off-by: Karel Zak <kzak@redhat.com>
10 years agosfdisk: add readline support
Karel Zak [Wed, 25 Mar 2015 15:06:39 +0000 (16:06 +0100)] 
sfdisk: add readline support

Signed-off-by: Karel Zak <kzak@redhat.com>
10 years agofdisk: fix readline wrapper
Karel Zak [Wed, 25 Mar 2015 15:06:26 +0000 (16:06 +0100)] 
fdisk: fix readline wrapper

Signed-off-by: Karel Zak <kzak@redhat.com>
10 years agolibfdisk: add fgets() callback for scripts
Karel Zak [Wed, 25 Mar 2015 15:05:14 +0000 (16:05 +0100)] 
libfdisk: add fgets() callback for scripts

Signed-off-by: Karel Zak <kzak@redhat.com>
10 years agolibfdisk: fix symbols versioning script
Karel Zak [Wed, 25 Mar 2015 10:08:22 +0000 (11:08 +0100)] 
libfdisk: fix symbols versioning script

Really stupid copy & past mistake. The libfdisk symbols should not be
prefixed by MOUNT_ suffix.

This change makes binaries linked with libfdisk 2.26 incompatible with
new libfdisk. Fortunately, 2.26 has been the first release and very
probably the library has been used for util-linux fdisks only.

Signed-off-by: Karel Zak <kzak@redhat.com>
10 years agofdisk: add GNU Readline support to fdisk
Karel Zak [Wed, 25 Mar 2015 09:31:37 +0000 (10:31 +0100)] 
fdisk: add GNU Readline support to fdisk

Signed-off-by: Karel Zak <kzak@redhat.com>
10 years agobuild-sys: add --with-readline
Ondrej Oprala [Mon, 2 Feb 2015 17:11:40 +0000 (18:11 +0100)] 
build-sys: add --with-readline

[kzak@redhat.com: - define READLINE_LIBS]

Signed-off-by: Ondrej Oprala <ooprala@redhat.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
10 years agofsck: fix fsck -C {fd} parsing
Stanislav Brabec [Tue, 24 Mar 2015 20:01:10 +0000 (21:01 +0100)] 
fsck: fix fsck -C {fd} parsing

Both fsck(8) and fsck --help documents progress bar redirection as
-C {fd}

This did not work, and only -C{fd} and "-C {fd}" worked.

Signed-off-by: Karel Zak <kzak@redhat.com>
10 years agolibfdisk: (gpt) check header size before verify CRC
Karel Zak [Mon, 23 Mar 2015 11:03:30 +0000 (12:03 +0100)] 
libfdisk: (gpt) check header size before verify CRC

Addresses: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=780834
Signed-off-by: Karel Zak <kzak@redhat.com>
10 years agodmesg: use GMT in tests, add DMESG_TEST_BOOTIME
Karel Zak [Mon, 23 Mar 2015 10:40:59 +0000 (11:40 +0100)] 
dmesg: use GMT in tests, add DMESG_TEST_BOOTIME

We don't want to hardcode anything to the test, just use
env.variable DMESG_TEST_BOOTIME.

Signed-off-by: Karel Zak <kzak@redhat.com>
10 years agologger: fix LOGGER_TEST_TIMEOFDAY check
Karel Zak [Mon, 23 Mar 2015 10:40:45 +0000 (11:40 +0100)] 
logger: fix LOGGER_TEST_TIMEOFDAY check

Signed-off-by: Karel Zak <kzak@redhat.com>
10 years agotests: check dmesg message coloring
Sami Kerola [Sun, 22 Mar 2015 23:05:30 +0000 (23:05 +0000)] 
tests: check dmesg message coloring

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
10 years agotests: check timestamp formats
Sami Kerola [Sun, 22 Mar 2015 23:05:29 +0000 (23:05 +0000)] 
tests: check timestamp formats

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
10 years agotests: add test_dmesg that has fixed boot time
Sami Kerola [Sun, 22 Mar 2015 23:05:28 +0000 (23:05 +0000)] 
tests: add test_dmesg that has fixed boot time

This allows testing time stamp formats.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
10 years agotests: add dmesg multiline message check
Sami Kerola [Sun, 22 Mar 2015 23:05:27 +0000 (23:05 +0000)] 
tests: add dmesg multiline message check

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
10 years agodmesg: fix shadow declaration
Sami Kerola [Sun, 22 Mar 2015 23:05:26 +0000 (23:05 +0000)] 
dmesg: fix shadow declaration

sys-utils/dmesg.c:650:9: warning: declaration of 's' shadows a previous local [-Wshadow]
sys-utils/dmesg.c:619:12: warning: shadowed declaration is here [-Wshadow]

And since the code had to be touched deprecate loop printing one character
at a time, in favour of printf and instruction to repeat spaces the number
required.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
10 years agounshare: add --propagation, use MS_PRIVATE by default
Karel Zak [Wed, 18 Mar 2015 14:13:15 +0000 (15:13 +0100)] 
unshare: add --propagation, use MS_PRIVATE by default

After "unshare --mount" users assume that mount operations within the
new namespaces are unshared (invisible for the rest of the system).

Unfortunately, this is not true and the behavior depends on the
current mount propagation setting. The kernel default is "private",
but for example systemd based distros use "shared". The solution is to
use (for example) "mount --make-private" after unshare(1).

I have been requested many times to provide less fragile and more
unified unshared mount setting *by default* to make things user
friendly.

The patch forces unshare(1) to explicitly use MS_REC|MS_PRIVATE for all
tree by default.

We can use something less (e.g MS_SLAVE), but "private" is the kernel
default, so for many users this change (feature) will be invisible.

This feature is possible to disable by "--propagation unchanged" or it's
possible to specify another propagation flag, supported are:

<slave|shared|private|unchanged>

Acked-by: "Eric W. Biederman" <ebiederm@xmission.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
10 years agonsenter: add -Z to set selinux context
Karel Zak [Fri, 20 Mar 2015 14:26:58 +0000 (15:26 +0100)] 
nsenter: add -Z to set selinux context

The new context is copied from --target <PID>. This solution allows to
keep SELinux happy when you enter container by nsenter(1).

Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=1116100
Signed-off-by: Karel Zak <kzak@redhat.com>
10 years agomount: don't remount read-only on --bind
Karel Zak [Fri, 20 Mar 2015 11:42:33 +0000 (12:42 +0100)] 
mount: don't remount read-only on --bind

mount(8) tries to mount read-only when the previous attempt ends with
EROFS or EACCES. This is bad idea for bind mounts as "ro,bind" has
a special semantic.

Signed-off-by: Karel Zak <kzak@redhat.com>
10 years agotests: remove private2 dir from mount/move
Karel Zak [Fri, 20 Mar 2015 10:05:42 +0000 (11:05 +0100)] 
tests: remove private2 dir from mount/move

The directory is unnecessary, all we need is to create from "private"
directory a mount point (so "--bind $DIR_PRIVATE $DIR_PRIVATE").

Signed-off-by: Karel Zak <kzak@redhat.com>
10 years agotests: some more mount error handling
Ruediger Meier [Thu, 19 Mar 2015 16:12:15 +0000 (17:12 +0100)] 
tests: some more mount error handling

Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
10 years agotests: more error handling in mount/move (refactor)
Ruediger Meier [Thu, 19 Mar 2015 16:12:00 +0000 (17:12 +0100)] 
tests: more error handling in mount/move (refactor)

Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
10 years agotests: mount/move also tests findmnt vs. mountpoint
Ruediger Meier [Thu, 19 Mar 2015 16:11:43 +0000 (17:11 +0100)] 
tests: mount/move also tests findmnt vs. mountpoint

Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
10 years agofindmnt: add --mountpoint command line option
Karel Zak [Thu, 19 Mar 2015 11:08:30 +0000 (12:08 +0100)] 
findmnt: add --mountpoint command line option

The current --target <path> implementation check the <path> elements in
reverse order to get the mountpoint. The feature may be inwanted in
some cases when we really want to check for mountpoint specified by
the <path>. The new option "--mountpoint <path>" allows to be strict.

Signed-off-by: Karel Zak <kzak@redhat.com>
10 years agotests: start script/race test only when --force specified
Karel Zak [Thu, 19 Mar 2015 11:06:35 +0000 (12:06 +0100)] 
tests: start script/race test only when --force specified

The test generates 1000 processes and it seems too invasive for
test/build machines and containers.

Signed-off-by: Karel Zak <kzak@redhat.com>
10 years agohwclock: non-root access in test mode
J William Piggott [Sun, 15 Mar 2015 20:44:05 +0000 (16:44 -0400)] 
hwclock: non-root access in test mode

Allow a non-root user to call all hwclock
functions when the --test option is used.

Signed-off-by: J William Piggott <elseifthen@gmx.com>
10 years agohwclock: increase debug output precision
J William Piggott [Sun, 15 Mar 2015 18:17:13 +0000 (14:17 -0400)] 
hwclock: increase debug output precision

Increased the precision in debug output showing
the clock drift and the time lapsed.

Showing a clock drift of 0.0 while giving a value that the
drift factor was adjusted by makes no sense.

Signed-off-by: J William Piggott <elseifthen@gmx.com>
10 years agotravis: add MAKE_CHECK_OPTS
Karel Zak [Tue, 17 Mar 2015 11:03:28 +0000 (12:03 +0100)] 
travis: add MAKE_CHECK_OPTS

Signed-off-by: Karel Zak <kzak@redhat.com>
10 years agotests: add --skip-loopdevs
Karel Zak [Tue, 17 Mar 2015 10:34:22 +0000 (11:34 +0100)] 
tests: add --skip-loopdevs

Signed-off-by: Karel Zak <kzak@redhat.com>
10 years agoMerge branch 'drone-ci' of https://github.com/rudimeier/util-linux
Karel Zak [Tue, 17 Mar 2015 10:25:57 +0000 (11:25 +0100)] 
Merge branch 'drone-ci' of https://github.com/rudimeier/util-linux

10 years agotests: use ts_skip for logger/journald
Karel Zak [Tue, 17 Mar 2015 10:21:39 +0000 (11:21 +0100)] 
tests: use ts_skip for logger/journald

Signed-off-by: Karel Zak <kzak@redhat.com>
10 years agoSince 569d1dac7bc64457aac11163b6a91ce9b41a6715 we read device start
Karel Zak [Tue, 17 Mar 2015 10:10:20 +0000 (11:10 +0100)] 
Since 569d1dac7bc64457aac11163b6a91ce9b41a6715 we read device start
sector from the /sys/block/.../start file. The file exists only for
partitions, for wholedisk is the start of the device always zero.

References: https://bugzilla.redhat.com/show_bug.cgi?id=1202443
Signed-off-by: Karel Zak <kzak@redhat.com>
10 years agohwclock: cosmetic changes to man page
Karel Zak [Tue, 17 Mar 2015 09:55:46 +0000 (10:55 +0100)] 
hwclock: cosmetic changes to man page

Reported-by: Benno Schulenberg <bensberg@justemail.net>
Signed-off-by: Karel Zak <kzak@redhat.com>
10 years agoMerge branch 'hwman312' of https://github.com/jwpi/util-linux
Karel Zak [Tue, 17 Mar 2015 09:37:13 +0000 (10:37 +0100)] 
Merge branch 'hwman312' of https://github.com/jwpi/util-linux

10 years agobuild-sys: add new compiler warnings
Karel Zak [Tue, 17 Mar 2015 09:15:50 +0000 (10:15 +0100)] 
build-sys: add new compiler warnings

Signed-off-by: Karel Zak <kzak@redhat.com>
10 years agoMerge branch 'tests_logger' of https://github.com/kerolasa/lelux-utiliteetit
Karel Zak [Tue, 17 Mar 2015 09:01:35 +0000 (10:01 +0100)] 
Merge branch 'tests_logger' of https://github.com/kerolasa/lelux-utiliteetit

10 years agotests: remove warning from test output
Ruediger Meier [Mon, 16 Mar 2015 14:15:35 +0000 (15:15 +0100)] 
tests: remove warning from test output

This was added in 3f8478a7 but it's only printed in --help.

Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
10 years agolibblkid: fix compiler warnings
Sami Kerola [Mon, 16 Mar 2015 00:03:49 +0000 (00:03 +0000)] 
libblkid: fix compiler warnings

warning: extra ';' outside of a function [-Wextra-semi]

warning: embedding a directive within macro arguments has undefined
behavior [-Wembedded-directive]

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
10 years agotests: add logger(1) journald test
Sami Kerola [Mon, 16 Mar 2015 23:42:57 +0000 (23:42 +0000)] 
tests: add logger(1) journald test

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
10 years agotests: add logger(1) error condition tests
Sami Kerola [Sun, 15 Mar 2015 12:46:30 +0000 (12:46 +0000)] 
tests: add logger(1) error condition tests

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
10 years agotests: add logger(1) message format tests
Sami Kerola [Sun, 15 Mar 2015 12:00:57 +0000 (12:00 +0000)] 
tests: add logger(1) message format tests

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
10 years agotests: optionally skip tests where loop support is needed
Ruediger Meier [Mon, 16 Mar 2015 11:22:53 +0000 (12:22 +0100)] 
tests: optionally skip tests where loop support is needed

It can be hard to check for loop support (e.g. on LXC containers). Let
the user skip it manually by env:

TS_OPT_FEAT_SKIP_LOOP="yes"

Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
10 years agotravis: whitelist travis* branches
Ruediger Meier [Mon, 16 Mar 2015 11:20:53 +0000 (12:20 +0100)] 
travis: whitelist travis* branches

Sometimes we may want to test non-master branches.

Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
10 years agotravis: move install script to .travis-functions.sh
Ruediger Meier [Mon, 16 Mar 2015 10:21:49 +0000 (11:21 +0100)] 
travis: move install script to .travis-functions.sh

Now this snippet can be re-used by non-travis systems. For example
on drone.io we can use this simple build script:
......
MAKE_CHECK="root"
source ./.travis-functions.sh
travis_install_script || exit
travis_before_script || exit
ret=0
travis_script || ret=$?
travis_after_script
exit $ret
......

Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
10 years agotests: disarm tailf test
Ruediger Meier [Fri, 13 Mar 2015 15:09:37 +0000 (16:09 +0100)] 
tests: disarm tailf test

Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
10 years agotailf: deprecated
Ruediger Meier [Fri, 13 Mar 2015 15:09:36 +0000 (16:09 +0100)] 
tailf: deprecated

We want to remove it in 2 years, March 2017.

See discussion "tailf, really needed?"
http://thread.gmane.org/gmane.linux.utilities.util-linux-ng/10967

[kzak@redhat.com: - move warning to usage()]

Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
Signed-off-by: Karel Zak <kzak@redhat.com>
10 years agotests: use --no-act for logger tests
Karel Zak [Mon, 16 Mar 2015 13:17:49 +0000 (14:17 +0100)] 
tests: use --no-act for logger tests

and also use --stderr on one place only.

Signed-off-by: Karel Zak <kzak@redhat.com>
10 years agotests: add logger(1) command line options tests
Sami Kerola [Sun, 15 Mar 2015 12:54:50 +0000 (12:54 +0000)] 
tests: add logger(1) command line options tests

[kzak@redhat.com: - use LOGGER_TEST_* env]

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
Signed-off-by: Karel Zak <kzak@redhat.com>
10 years agologger: add -DTEST_LOGGER
Karel Zak [Mon, 16 Mar 2015 12:26:52 +0000 (13:26 +0100)] 
logger: add -DTEST_LOGGER

"make test_logger" now compiles logger(1) test program
to overwrite system datetime stuff, hostname and PID, for example:

   export TZ=GMT
   export LOGGER_TEST_TIMEOFDAY=1234567890.123456
   export LOGGER_TEST_HOSTNAME=foo
   export LOGGER_TEST_GETPID=123

   ./test_logger --rfc5424 --no-act --stderr -i --tag MyTag mesg
   <13>1 2009-02-13T23:31:30.123456+00:00 foo MyTag 123 - [timeQuality tzKnown="1" isSynced="0"] mesg

if the LOGGER_TEST_* variables are not specified then default to
standard logger(1) behavior.

Note that it would be possible to use for example "unshare --utc" to
make hostname stable and portable, but LOGGER_TEST_* variables allow
to keep the tests less complex.

Signed-off-by: Karel Zak <kzak@redhat.com>
10 years agologger: add --no-act for testing
Karel Zak [Mon, 16 Mar 2015 11:38:46 +0000 (12:38 +0100)] 
logger: add --no-act for testing

* force --journal mode to also output to stderr when the option
  --stderr specified on command line

* add --no-act to avoid all write() operations to make it possible to
  write tests without "spam" system logs

Signed-off-by: Karel Zak <kzak@redhat.com>
10 years agologger: fix rfc5424 format crash
Karel Zak [Mon, 16 Mar 2015 10:51:05 +0000 (11:51 +0100)] 
logger: fix rfc5424 format crash

$ logger --rfc5424=notq message
Segmentation fault (core dumped)

Reported-by: Sami Kerola <kerolasa@iki.fi>
Signed-off-by: Karel Zak <kzak@redhat.com>
10 years agologger: use errx() when checking user input
Sami Kerola [Sun, 15 Mar 2015 12:54:53 +0000 (12:54 +0000)] 
logger: use errx() when checking user input

Additionally inform in usage() the --msgid requires an argument.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
10 years agologger: check xgethostname() return value
Sami Kerola [Sun, 15 Mar 2015 12:54:48 +0000 (12:54 +0000)] 
logger: check xgethostname() return value

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
10 years agologger: tidy few indentation issues
Sami Kerola [Sun, 15 Mar 2015 12:54:47 +0000 (12:54 +0000)] 
logger: tidy few indentation issues

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
10 years agologger: Fix use of errno after strtol() without zeroing first
Stef Walter [Sun, 15 Mar 2015 13:23:32 +0000 (14:23 +0100)] 
logger: Fix use of errno after strtol() without zeroing first

References: https://bugzilla.redhat.com/show_bug.cgi?id=1202104
Signed-off-by: Karel Zak <kzak@redhat.com>
10 years agohwclock: man-page errata
J William Piggott [Fri, 13 Mar 2015 18:40:59 +0000 (14:40 -0400)] 
hwclock: man-page errata

The information I wrote regarding clock crystals was not
only incomplete, it was wrong. The characteristics of
quartz crystals is beyond the scope of this man-page. It
was misguided to attempt to include it. This commit
removes said information.

Signed-off-by: J William Piggott <elseifthen@gmx.com>
10 years agohwclock: add '11 minute mode' information
J William Piggott [Fri, 13 Mar 2015 18:37:22 +0000 (14:37 -0400)] 
hwclock: add '11 minute mode' information

Add that '11 minute mode' is a kernel compile time
option. Add details regarding its activation and
how to check its status.

Signed-off-by: J William Piggott <elseifthen@gmx.com>
10 years agohwclock: remove depreciated ntpdate
J William Piggott [Fri, 13 Mar 2015 18:35:22 +0000 (14:35 -0400)] 
hwclock: remove depreciated ntpdate

Replace references to the depreciated ntpdate with sntp.

Signed-off-by: J William Piggott <elseifthen@gmx.com>
10 years agohwclock: Improve FILES section
J William Piggott [Fri, 13 Mar 2015 18:34:08 +0000 (14:34 -0400)] 
hwclock: Improve FILES section

Signed-off-by: J William Piggott <elseifthen@gmx.com>
10 years agohwclock: add TZDIR
J William Piggott [Fri, 13 Mar 2015 18:31:50 +0000 (14:31 -0400)] 
hwclock: add TZDIR

Add information about TZDIR and improve the
ENVIRONMENT section.

Signed-off-by: J William Piggott <elseifthen@gmx.com>
10 years agologger: use xstrdup()
Karel Zak [Fri, 13 Mar 2015 12:35:20 +0000 (13:35 +0100)] 
logger: use xstrdup()

Signed-off-by: Karel Zak <kzak@redhat.com>
10 years agotests: fix fdisk/bsd for ppc64le
Ruediger Meier [Thu, 12 Mar 2015 18:08:26 +0000 (19:08 +0100)] 
tests: fix fdisk/bsd for ppc64le

Actually Aurelien's patch a80886e9 should have addressed this already
because it's the case LE, BSD_LABELSECTOR = 0, BSD_LABELOFFSET = 64.

I've asked about this on mailing list but couldn't get more
informations.
Thread "test fdisk/bsd on exotic archs":
http://comments.gmane.org/gmane.linux.utilities.util-linux-ng/10621

Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
10 years agotests: improve readability for fdisk/bsd
Ruediger Meier [Thu, 12 Mar 2015 18:08:25 +0000 (19:08 +0100)] 
tests: improve readability for fdisk/bsd

Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
10 years agolast: keep array of files in main()
Karel Zak [Fri, 13 Mar 2015 10:47:00 +0000 (11:47 +0100)] 
last: keep array of files in main()

Signed-off-by: Karel Zak <kzak@redhat.com>
10 years agolast: fix utmplist usage
Karel Zak [Fri, 13 Mar 2015 10:13:26 +0000 (11:13 +0100)] 
last: fix utmplist usage

last(1) uses a global list of entries, this is unnecessary and it's
also mistake because the pointer to the list is not set to NULL when
last(1) opens another utmp file. For example:

 last -f /var/log/wtmp -f /var/log/wtmp-20150220

ends with unexpected free() call or sometimes with never ending loop.

Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=1201033
Signed-off-by: Karel Zak <kzak@redhat.com>
10 years agocal: care about setuprterm() result
Karel Zak [Thu, 12 Mar 2015 10:50:07 +0000 (11:50 +0100)] 
cal: care about setuprterm() result

References: https://bugzilla.suse.com/show_bug.cgi?id=903440
Signed-off-by: Karel Zak <kzak@redhat.com>
10 years agolibmount: mark overlay as pseudo-FS
Karel Zak [Wed, 11 Mar 2015 10:38:07 +0000 (11:38 +0100)] 
libmount: mark overlay as pseudo-FS

Signed-off-by: Karel Zak <kzak@redhat.com>
10 years agolibmount: add mnt_table_get_fs_root() to header file
Karel Zak [Wed, 11 Mar 2015 10:11:19 +0000 (11:11 +0100)] 
libmount: add mnt_table_get_fs_root() to header file

Signed-off-by: Karel Zak <kzak@redhat.com>
10 years agoMerge branch 'master-silence-format-printf-warning' of https://github.com/rgerhards...
Karel Zak [Wed, 11 Mar 2015 10:07:37 +0000 (11:07 +0100)] 
Merge branch 'master-silence-format-printf-warning' of https://github.com/rgerhards/util-linux

10 years agotests: update sfdisk --dump test
Karel Zak [Wed, 11 Mar 2015 09:58:45 +0000 (10:58 +0100)] 
tests: update sfdisk --dump test

Signed-off-by: Karel Zak <kzak@redhat.com>
10 years agologger: small change in usage()
Karel Zak [Wed, 11 Mar 2015 09:51:13 +0000 (10:51 +0100)] 
logger: small change in usage()

Signed-off-by: Karel Zak <kzak@redhat.com>
10 years agologger man page: fix typo
Rainer Gerhards [Tue, 10 Mar 2015 16:48:05 +0000 (17:48 +0100)] 
logger man page: fix typo

10 years agologger: add --msgid option, permits to set RFC5424 MSGID field
Rainer Gerhards [Tue, 10 Mar 2015 16:47:30 +0000 (17:47 +0100)] 
logger: add --msgid option, permits to set RFC5424 MSGID field

10 years agologger: fix multiple format bugs in rfc5424 formatter
Rainer Gerhards [Tue, 10 Mar 2015 16:26:14 +0000 (17:26 +0100)] 
logger: fix multiple format bugs in rfc5424 formatter

This is more or less a complete rewrite of the formatter. It had
multiple issue, e.g. a missing field (MSGID?) and invalid handling
of nil values.

10 years agosilence compiler warning
Rainer Gerhards [Tue, 10 Mar 2015 13:13:38 +0000 (14:13 +0100)] 
silence compiler warning

This is primarily cosmetic, albeit it also provides an only very
slight improvement in compile time error checking.

10 years agolibmount: cleanup fs root detection code
Karel Zak [Tue, 10 Mar 2015 12:35:56 +0000 (13:35 +0100)] 
libmount: cleanup fs root detection code

Signed-off-by: Karel Zak <kzak@redhat.com>
10 years agofindmnt: don't rely on st_dev for --target
Karel Zak [Tue, 10 Mar 2015 11:51:44 +0000 (12:51 +0100)] 
findmnt: don't rely on st_dev for --target

The overlay filesystem does not provide usable st_dev (in traditional
UNIX way). It's necessary to search in /proc/self/mountinfo to detect
which path element is mountpoint.

$ findmnt --target /mnt/merged/dir-a/foo
TARGET      SOURCE  FSTYPE  OPTIONS
/mnt/merged overlay overlay rw,relatime,lowerdir=/mnt/low,upperdir=/mnt/high/data,workdir=/mnt/high/work

Signed-off-by: Karel Zak <kzak@redhat.com>
10 years agologger: check for ntp_gettime() rather than for timex.h
Karel Zak [Tue, 10 Mar 2015 10:37:45 +0000 (11:37 +0100)] 
logger: check for ntp_gettime() rather than for timex.h

It seems that musl libc and uClibc without UCLIBC_NTP_LEGACY
does not provide ntp_gettime and compile will fail.

References: https://github.com/karelzak/util-linux/issues/174
Signed-off-by: Karel Zak <kzak@redhat.com>
10 years agologger: add --skip-empty-lines to prevent logging empty lines
Rainer Gerhards [Sat, 7 Mar 2015 11:14:21 +0000 (12:14 +0100)] 
logger: add --skip-empty-lines to prevent logging empty lines

Empty log messages are generally considered useless. This option
enables to turn them off when processing files (including stdin).

[kzak@redhat.com: - rename --skip-empty-lines to --skip-empty,
                  - add the option to getopt_long(),
                  - add the option to bash-completion]

Signed-off-by: Karel Zak <kzak@redhat.com>
10 years agologger man page: update --size doc
Rainer Gerhards [Sat, 7 Mar 2015 11:04:43 +0000 (12:04 +0100)] 
logger man page: update --size doc

now we have strict sizes

Signed-off-by: Karel Zak <kzak@redhat.com>
10 years agologger: bugfix: missing sanity checks with --prio-prefix option
Rainer Gerhards [Sat, 7 Mar 2015 10:49:00 +0000 (11:49 +0100)] 
logger: bugfix: missing sanity checks with --prio-prefix option

There were no apparent sanity checks other than applying the logmask
when reading PRI values from files. As such, invalid PRIs (tested with
values 192, 210, and 2100) are accepted. This in turn can trigger
problems in various receivers, especially older versions. See here
for details:

http://www.rsyslog.com/remote-syslog-pri-vulnerability-cve-2014-3683/

Note that 2100 was changed to 52 as described in above link.

This patch refactors PRI processing. Invalid PRIs are detected and in
this case the message is sent with the default priority, with the
invalid pri being part of the message to be sent. This is along the
line of what 2.26 did when it detected the PRI was invalid.

The refactoring now also enables pricese tracking of syslog header
length in all cases, so --size is now strictly obeyed.

[kzak@redhat.com: - fix compiler warning [-Wunused-variable]]

Signed-off-by: Karel Zak <kzak@redhat.com>
10 years agologger: refactor message generation
Rainer Gerhards [Fri, 6 Mar 2015 17:52:26 +0000 (18:52 +0100)] 
logger: refactor message generation

Previously, the message format was generated in one big step. Now
this is refactored to generate the header independently. This not
only provides a better isolation of functionality, but enables
to calculate the size of the header *before* generating the user
part of the message. That in turn is needed in order to precisely
enforce the message size limit. This is especially important while
processing files, as here parts of the message may be lost if the
receiver truncates the message. The file reader itself tries to
guard against this by reading only the permitted number of bytes,
but without knowing the header size, it would mis-guess here.

Note that when --prio-prefix is given, we still do not know exactly
the header length, because the PRI value is between 1 and 3 bytes.
Unfortunately, we do not know the actual size before reading. With
the current (simple) approach, we need to read the full line before
getting the PRI, so this is a hen-egg problem. To solve this, a
more complex reader would be required. It is questionable if this
is necessary for a tool like logger. So currently, we still have a
2-byte window of uncertainty if --prio-prefix is given.

[kzak@redhat.com: - fix compiler warnings [-Wunused-but-set-variable]]

Signed-off-by: Karel Zak <kzak@redhat.com>
10 years agologger: permit to send messages larger than 1024 characters
Rainer Gerhards [Fri, 6 Mar 2015 14:50:34 +0000 (15:50 +0100)] 
logger: permit to send messages larger than 1024 characters

This is an important capability that has been specified in RFC5424.
However, messages larger than 1024 chars are being accepted for years
now by at least rsyslog and syslog-ng.

This patch adds the option --size to permit setting a new max
size, with 1024 being the default.

Note that the size limit is only approximative, as we do not take the
header size in account (RFC talks about total message length).

[[kzak@redhat.com: - add 'S' to getopt_long(),
                   - rename --message-size to --size
                   - add the option to bash-completion]

Signed-off-by: Karel Zak <kzak@redhat.com>
10 years agoagetty: reload issue on --autologin --login-pause too
Karel Zak [Mon, 9 Mar 2015 11:45:52 +0000 (12:45 +0100)] 
agetty: reload issue on --autologin --login-pause too

The current "agetty --reload" implementation does not refresh issue
file output on autologin. Let's support this use-case too.

Reported-by: Sitsofe Wheeler <sitsofe@gmail.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
10 years agoagetty: make sure that reload file exists
Karel Zak [Mon, 9 Mar 2015 11:26:55 +0000 (12:26 +0100)] 
agetty: make sure that reload file exists

agetty monitors /run/agetty.reload file, unfortunately if the file
does not exist when agetty starts up then "agetty" --reload does not
work. This patch forces agetty to create the file before inotify
is enabled.

Reported-by: Sitsofe Wheeler <sitsofe@gmail.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
10 years agobuild-sys: fix typo
Karel Zak [Fri, 6 Mar 2015 13:32:12 +0000 (14:32 +0100)] 
build-sys: fix typo

10 years agoRevert "build-sys: remove static builds from make-check"
Karel Zak [Fri, 6 Mar 2015 13:23:57 +0000 (14:23 +0100)] 
Revert "build-sys: remove static builds from make-check"

The problem should be fixed now.

This reverts commit 948b87581e7f1a430f258e169282a1755bb68edd.

10 years agobuild-sys: cleanup realtime lib usage
Karel Zak [Fri, 6 Mar 2015 13:20:19 +0000 (14:20 +0100)] 
build-sys: cleanup realtime lib usage

* check for timer_create()
* define dependence on timer_create() for flock
* rename CLOCKGETTIME_LIBS to REALTIME_LIBS

Signed-off-by: Karel Zak <kzak@redhat.com>
10 years agolib/timer: use separate file for timers
Karel Zak [Fri, 6 Mar 2015 12:17:20 +0000 (13:17 +0100)] 
lib/timer: use separate file for timers

It seems that static builds require -lpthread for timer_* functions.
It's better to keep it out of our libs (e.g. libmount) to avoid
unnecessary dependence.

Signed-off-by: Karel Zak <kzak@redhat.com>
10 years agoMerge branch 'logger-man-syslog-routine' of https://github.com/rgerhards/util-linux
Karel Zak [Fri, 6 Mar 2015 11:36:17 +0000 (12:36 +0100)] 
Merge branch 'logger-man-syslog-routine' of https://github.com/rgerhards/util-linux

* 'logger-man-syslog-routine' of https://github.com/rgerhards/util-linux:
  logger man page: bump man page date to current
  logger man page: fix some "syslog(3) routine" remnants

10 years agologger man page: bump man page date to current
Rainer Gerhards [Fri, 6 Mar 2015 11:32:12 +0000 (12:32 +0100)] 
logger man page: bump man page date to current

10 years agologger man page: fix some "syslog(3) routine" remnants
Rainer Gerhards [Fri, 6 Mar 2015 11:30:56 +0000 (12:30 +0100)] 
logger man page: fix some "syslog(3) routine" remnants

10 years agoMerge branch 'logger-fix-tcp-framing' of https://github.com/rgerhards/util-linux
Karel Zak [Fri, 6 Mar 2015 11:31:48 +0000 (12:31 +0100)] 
Merge branch 'logger-fix-tcp-framing' of https://github.com/rgerhards/util-linux

* 'logger-fix-tcp-framing' of https://github.com/rgerhards/util-linux:
  logger: bugfix: tcp syslog framing is broken, -T unusable
  logger: refactor the way output is written

10 years agologger: use username as the default tag
Karel Zak [Fri, 6 Mar 2015 11:15:23 +0000 (12:15 +0100)] 
logger: use username as the default tag

Reported-by: Rainer Gerhards <rgerhards@adiscon.com>
Signed-off-by: Karel Zak <kzak@redhat.com>