]> git.ipfire.org Git - thirdparty/util-linux.git/log
thirdparty/util-linux.git
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>
10 years agologger: bugfix: tcp syslog framing is broken, -T unusable
Rainer Gerhards [Fri, 6 Mar 2015 11:12:15 +0000 (12:12 +0100)] 
logger: bugfix: tcp syslog framing is broken, -T unusable

Logger can send via plain tcp syslog if -n -T options are given.
However, the framing is broken so that a syslog receiver can not
know where the first message ends and the next one starts. It
actually looks like no framing at all is used. Plain TCP syslog
framing is described in RFC6587.

This patch adds RFC6587 octet-stuffed framing to TCP syslog. For
local logging, this is always fine, for remote logging this is
NOT recommended by the IETF (the RFC is historic). However, a
full blown RFC5425 TLS sender seems to be out of scope for a tool
like logger IMO.

This patch also refactors the way output is written, seperating
the message format generators from the output writer.

10 years agologger: refactor the way output is written
Rainer Gerhards [Fri, 6 Mar 2015 10:51:31 +0000 (11:51 +0100)] 
logger: refactor the way output is written

Previously, output was written in exactly the same way in three
different places. This is now combined into a single function. This
hopefully makes it easier to adapt to changing output needs.

10 years agologger: remove "interface to syslog(3)" from man page
Karel Zak [Fri, 6 Mar 2015 10:48:23 +0000 (11:48 +0100)] 
logger: remove "interface to syslog(3)" from man page

since v2.26 logger does not use syslog(3) anymore

Reported-by: Rainer Gerhards <rgerhards@adiscon.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
10 years agoMerge branch 'logger-kernel-regression' of https://github.com/rgerhards/util-linux
Karel Zak [Fri, 6 Mar 2015 10:32:17 +0000 (11:32 +0100)] 
Merge branch 'logger-kernel-regression' of https://github.com/rgerhards/util-linux

* 'logger-kernel-regression' of https://github.com/rgerhards/util-linux:
  logger: fix -p kern.* priority is accepted regression
  logger: messages are logged with kern.* priority by default

10 years agologger: fix whitespace and compiler warning [-Wunused-variable]
Karel Zak [Fri, 6 Mar 2015 10:27:16 +0000 (11:27 +0100)] 
logger: fix whitespace and compiler warning [-Wunused-variable]

misc-utils/logger.c: In function ‘syslog_rfc3164’:
misc-utils/logger.c:336:9: warning: unused variable ‘now’ [-Wunused-variable]

Signed-off-by: Karel Zak <kzak@redhat.com>
10 years agoMerge branch 'logger-fix-local-timestamp' of https://github.com/rgerhards/util-linux
Karel Zak [Fri, 6 Mar 2015 10:25:56 +0000 (11:25 +0100)] 
Merge branch 'logger-fix-local-timestamp' of https://github.com/rgerhards/util-linux

* 'logger-fix-local-timestamp' of https://github.com/rgerhards/util-linux:
  logger: fix invalid timestamp regression in local format

10 years agologger: add comment
Karel Zak [Fri, 6 Mar 2015 10:05:30 +0000 (11:05 +0100)] 
logger: add comment

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

* 'logger-format-fix' of https://github.com/rgerhards/util-linux:
  logger: fix inconsistent format regression when logging locally

10 years agolibblkid: fix compiler warning [-Wunused-variable]
Karel Zak [Fri, 6 Mar 2015 09:57:12 +0000 (10:57 +0100)] 
libblkid: fix compiler warning [-Wunused-variable]

libblkid/src/superblocks/zfs.c: In function 'probe_zfs':
libblkid/src/superblocks/zfs.c:199:11: warning: unused variable 'swab_magic' [-Wunused-variable]

Signed-off-by: Karel Zak <kzak@redhat.com>
10 years agoMerge branch 'zfs' of https://github.com/mihu/util-linux
Karel Zak [Fri, 6 Mar 2015 09:53:22 +0000 (10:53 +0100)] 
Merge branch 'zfs' of https://github.com/mihu/util-linux

* 'zfs' of https://github.com/mihu/util-linux:
  zfs: make less syscalls
  blkid: make zfs detection more robust

10 years agologger: fix -p kern.* priority is accepted regression
Rainer Gerhards [Thu, 5 Mar 2015 15:54:34 +0000 (16:54 +0100)] 
logger: fix -p kern.* priority is accepted regression

Pre 2.26, syslog(3) was used for local logging, and it did not
accept kern.* priorities. This is re-enabled by the patch.

10 years agologger: messages are logged with kern.* priority by default
Rainer Gerhards [Thu, 5 Mar 2015 15:44:03 +0000 (16:44 +0100)] 
logger: messages are logged with kern.* priority by default

The default should be user.notice and kern.* should never be used
(syslog(3) forbids this).

This is a severe regression, as messages are now logged to the wrong
bin or not at all. So they get lost and may confuse readers of the
kernel bin.

regression from 2.25.2 to 2.26

10 years agobuild-sys: remove static builds from make-check
Karel Zak [Thu, 5 Mar 2015 14:34:42 +0000 (15:34 +0100)] 
build-sys: remove static builds from make-check

.. temporary, the final solution has to cleanup timer_* functions
usage. The function are unnecessary for libmount, but we use
lib/monotme.c in the library and it probably requires -lrt and *also*
-lpthread for static builds.

Signed-off-by: Karel Zak <kzak@redhat.com>
10 years agologger: fix invalid timestamp regression in local format
Rainer Gerhards [Thu, 5 Mar 2015 14:20:50 +0000 (15:20 +0100)] 
logger: fix invalid timestamp regression in local format

Since 1d57503378bdcd838365d625f6d2d0a09da9c29d logger no longer uses
the syslog(3) call. The way the local timestamp is generated did not
match the syslog(3) format. Most importantly, the month name is
formatted based on the user's local. For example:

$ ./logger --stderr  test with logger 2.26.39-eb651-dirty
<5>Mär  5 14:17:47 logger: test with logger 2.26.39-eb651-dirty

"Mär" like in German "März" for "March".

previously:
$ logger --stderr  test with logger 2.25.2
rger: test with logger 2.25.2

In the system log file, this results to the following:

Mar  5 14:17:47 host Mär  5 14:17:47 logger: test with logger 2.26.39-eb651-dirty
Mar  5 14:18:01 host rger: test with logger 2.25.2

This local naming is invalid as of RFC3164. One may argue that
the local log socket traditionally does not have RFC3164 format,
but the timestamp always was as defined in RFC3164 (and along
the lines of the ctime() call). Anything else would also be impractical,
as a syslog parser would otherwise need to know about all
potential locale-specific representations of month names.

This patch corrects the problem and also refactors the timestamp
handling a bit. The same timestamp is needed in local and rfc3164
processing, so there now is a new function to create that stamp.

10 years agologger: fix inconsistent format regression when logging locally
Rainer Gerhards [Wed, 4 Mar 2015 10:17:20 +0000 (11:17 +0100)] 
logger: fix inconsistent format regression when logging locally

The message format when writing to local sockets is inconsistent. Example:

$ ./logger --stderr test
<5>Mär  4 11:03:30 logger: test
$ ./logger -u /dev/log --stderr test
<5>1 2015-03-04T11:03:31.699841+0100 ubuntu1404esp rger - [timeQuality tzKnown="1" isSynced="1" syncAccuracy="29000"] test

The regression was introduced with 4de2e8a03859aaab2c25dc98f33409cd28de6acc
As far as the commit comments and man page indicates, this was meant to affect
remote system logging only, but it also affects local logging when the -u
option is given.

This causes problems with receivers who do not expect full-blown RFC format
on the log socket, like rsyslog. In consequence, this can also affect
log analysis programs and invalidate some of their results.

The patch corrects the behaviour so that the same old-style format is used for
any type of local logging. New-style can always be selected by command line-options.
RFC5424 is still the default for remote logging, as intended in the orignal
commit.

Result with the patch:
$ ./logger --stderr test
<5>Mär  4 11:15:35 logger: test
$ ./logger -u /dev/log --stderr test
<5>Mär  4 11:15:40 logger: test
$ ./logger -u /dev/log --rfc5424 --stderr test
<5>1 2015-03-04T11:21:28.796170+0100 ubuntu1404esp rger - [timeQuality tzKnown="1" isSynced="1" syncAccuracy="27500"] test

10 years agolib/monotonic: fix compiler warnings
Karel Zak [Thu, 5 Mar 2015 12:32:53 +0000 (13:32 +0100)] 
lib/monotonic: fix compiler warnings

Signed-off-by: Karel Zak <kzak@redhat.com>
10 years agoagetty: support /usr/lib/os-release too
Karel Zak [Thu, 5 Mar 2015 11:25:28 +0000 (12:25 +0100)] 
agetty: support /usr/lib/os-release too

http://www.freedesktop.org/software/systemd/man/os-release.html

The file /etc/os-release takes precedence over /usr/lib/os-release.
Applications should check for the former, and exclusively use its data
if it exists, and only fall back to /usr/lib/os-release if it is
missing.

Reported-by: Dimitri John Ledkov <dimitri.j.ledkov@intel.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
10 years agoMerge branch 'logger-fix-rfc5424-timestamp' of https://github.com/rgerhards/util...
Karel Zak [Thu, 5 Mar 2015 10:52:00 +0000 (11:52 +0100)] 
Merge branch 'logger-fix-rfc5424-timestamp' of https://github.com/rgerhards/util-linux

* 'logger-fix-rfc5424-timestamp' of https://github.com/rgerhards/util-linux:
  logger: fix invalid timestamp in rfc5425 format

10 years agotailf: use size_t and fwrite()
Karel Zak [Thu, 5 Mar 2015 10:11:53 +0000 (11:11 +0100)] 
tailf: use size_t and fwrite()

Let's use size_t for number of output lines and use fwrite() rather
than while() { putchar() };

Signed-off-by: Karel Zak <kzak@redhat.com>
10 years agoflock: fix timeout handler pointer usage
Karel Zak [Thu, 5 Mar 2015 09:47:59 +0000 (10:47 +0100)] 
flock: fix timeout handler pointer usage

Signed-off-by: Karel Zak <kzak@redhat.com>
10 years agowhereis: make "-BMS <dir> -f" more obvious in usage()
Karel Zak [Thu, 5 Mar 2015 09:29:10 +0000 (10:29 +0100)] 
whereis: make "-BMS <dir> -f" more obvious in usage()

Signed-off-by: Karel Zak <kzak@redhat.com>
10 years agologger: fix -i argument parsing regression
Sami Kerola [Fri, 20 Feb 2015 19:42:34 +0000 (19:42 +0000)] 
logger: fix -i argument parsing regression

With earlier logger it's possible to combine the option -i with other
options, such as -s.  But currently:

$:~> logger -is
logger: failed to parse id: 's'

The changed behaviour breaks existing scripts like dhcpcd-run-hooks from
dhcpcd.

Broken-since: aab5b44405b9a6ada92e419e5a84cc0d1d4afee9
Reference: http://comments.gmane.org/gmane.linux.utilities.util-linux-ng/9683
Reported-by: Juergen Daubert <jue@jue.li>
Reviewed-by: Benno Schulenberg <bensberg@justemail.net>
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
10 years agotailf: ensure file argument really is a file
Sami Kerola [Tue, 17 Feb 2015 21:41:46 +0000 (21:41 +0000)] 
tailf: ensure file argument really is a file

The tailf(1) never worked very well with block or character devices,
sockets, fifos and such.  Now after mmap() is used to find last lines
even the little command used to work for example pipes is broken, so test
the tailf is asked to follow a file and when not fail.  That said
symlinks are OK, as long they point to a file.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
10 years agotailf: do not allow minus signed last lines argument
Sami Kerola [Sun, 15 Feb 2015 17:12:03 +0000 (17:12 +0000)] 
tailf: do not allow minus signed last lines argument

Before mmap() the command behavior was not completely correct, as
demonstrated below, and after the mmap() it tried to print some eighteen
quintillion lines.

$ tailf -n-1 x
tailf: cannot allocate 18446744073709543424 bytes: Cannot allocate memory

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
10 years agotailf: count last lines correctly at initial print out
Sami Kerola [Sun, 15 Feb 2015 16:52:39 +0000 (16:52 +0000)] 
tailf: count last lines correctly at initial print out

When last lines happen to be greater than string buffer size for fgets()
the number of printed lines resulted to too few.  To avoid miscounts due
insufficient buffer size use mmap() to map the whole file and rewind
until requested number of new lines is found.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
10 years agotunelp: use parse_switch()
Sami Kerola [Sat, 10 Jan 2015 15:04:27 +0000 (15:04 +0000)] 
tunelp: use parse_switch()

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
10 years agoflock: improve timeout handling
Sami Kerola [Mon, 9 Feb 2015 23:18:09 +0000 (23:18 +0000)] 
flock: improve timeout handling

Signal ALRM raised by the timer, and the timer only, will be considered
as a timeout criteria.

Secondly time interval is made to use monotonic clock.  Documentation of
ITIMER_REAL is unclear whether that time is affected various sources of
clock skew, or does it even tick when system is suspended.

Reviewed-by: Karel Zak <kzak@redhat.com>
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
10 years agologger: fix invalid timestamp in rfc5425 format
Rainer Gerhards [Wed, 4 Mar 2015 17:50:30 +0000 (18:50 +0100)] 
logger: fix invalid timestamp in rfc5425 format

The timestamp is written as

2015-03-04T15:02:02.566782+0100

unfortunately, this is not an RFC3339 timestamp as demanded by rfc5424.
The colon in the time offset field is missing. The correct timestamp is

2015-03-04T15:02:02.566782+01:00

(Note "+0100" vs. "+01:00")

10 years agoflock: add --verbose option
Sami Kerola [Sat, 7 Feb 2015 23:45:24 +0000 (23:45 +0000)] 
flock: add --verbose option

Jenkins script jobs using flock are a great example of a situation in
which one may want an automation to be verbose, so that when unexpected
events happen there is more hints in logs.

Reviewed-by: Benno Schulenberg <bensberg@justemail.net>
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
10 years agowhereis: tell when mandatory option is missing
Sami Kerola [Sat, 7 Feb 2015 21:10:51 +0000 (21:10 +0000)] 
whereis: tell when mandatory option is missing

The <dirs> list is terminated by any arbitrary option, but to be simple
when none is specified complain about -f being missing.

Reviewed-by: Benno Schulenberg <bensberg@justemail.net>
Reviewed-by: Karel Zak <kzak@redhat.com>
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
10 years agobuild-sys: add --enable-usrdir-path
Karel Zak [Tue, 3 Mar 2015 10:36:59 +0000 (11:36 +0100)] 
build-sys: add --enable-usrdir-path

The directories /{sbin,bin} are symliks to /usr/{sbin,bin} on many
systems. This patch add new ./configure option to remove the non-usr
paths from the default $PATH environment variable.

The default $PATH is hardcoded in login(1) and can be overwritten
by /etc/login.defs.

default:

./test_pathnames | grep DEFPATH
       _PATH_DEFPATH /usr/local/bin:/bin:/usr/bin
  _PATH_DEFPATH_ROOT /usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin

--enable-usrdir-path:

./test_pathnames | grep DEFPATH
       _PATH_DEFPATH /usr/local/bin:/usr/bin
  _PATH_DEFPATH_ROOT /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin

This patch does not modify install paths, you still have to care about
--{bin,lib}dir configure options.

Signed-off-by: Karel Zak <kzak@redhat.com>
10 years agolibfdisk: add {first,last}-lba header to sfdisk scritps
Karel Zak [Mon, 2 Mar 2015 12:58:23 +0000 (13:58 +0100)] 
libfdisk: add {first,last}-lba header to sfdisk scritps

The current sfdisk does not allow to create partition that
starts before the default libfdisk First LBA (~1MiB). It
means that

 # sfdisk --dump /dev/sda > foo
 # sfdisk /dev/sdb < foo

does not work on systems where 1st partition does not start at offset
2048.

This patch add new headers to scripts to inform libfdisk about different
First/Last LBA ranges. For example:

 label: gpt
 first-lba: 34

allows to override the library default.

Signed-off-by: Karel Zak <kzak@redhat.com>
10 years agozfs: make less syscalls
Michal Humpula [Sat, 28 Feb 2015 20:19:42 +0000 (21:19 +0100)] 
zfs: make less syscalls

10 years agodocs: fstab(5) grammar / English fixes, and some other updates
Peter Cordes [Wed, 25 Feb 2015 02:40:41 +0000 (22:40 -0400)] 
docs: fstab(5) grammar / English fixes, and some other updates

I proofread the whole thing.  I fixed everything that I thought could use
improvement.

various grammar and man page style-guide fixes (commas, word order, etc.).

Reworded a couple things to hopefully make it clear to someone that
didn't already know about fstab.  Re-ordered the intro paragraphs
for easier skimming.  And added an example line.

Expanded on a couple things other things.

Tightened up the wording in some other places to get the point across
faster and in less space.

Thanks to Benno Schulenberg <bensberg@justemail.net>
for several improvements.

Signed-off-by: Peter Cordes <peter@cordes.ca>
10 years agodocs: fix some spelling errors and typos in man pages
Bill Pemberton [Wed, 25 Feb 2015 14:07:59 +0000 (09:07 -0500)] 
docs: fix some spelling errors and typos in man pages

runuser.1: fix spelling implemenation -> implementation
scriptreplay.1: fix spelling overide -> override
unshare.1: fix spelling permamently -> permanently
last.1: fix spelling preferrable -> preferable
lslogins.1: fix spelling priviliges -> privileges
hwclock.8.in: fix spelling transfered -> transferred
prlimit.1: fix typo umlimited -> unlimited
agetty.8: fix typo unnsupported -> unsupported

Signed-off-by: Bill Pemberton <wfp5p@worldbroken.com>
10 years agodocs: update TODO
Karel Zak [Fri, 27 Feb 2015 13:46:43 +0000 (14:46 +0100)] 
docs: update TODO

Signed-off-by: Karel Zak <kzak@redhat.com>
10 years agolib/colors: use libtinfo to check terminal capability
Karel Zak [Fri, 27 Feb 2015 12:57:34 +0000 (13:57 +0100)] 
lib/colors: use libtinfo to check terminal capability

The current implementation assumes that all terminals supports colors
and users are forcet to use terminal-colors.d/ to disable colors for
some terminals.

This patch checks for maximal supported colors for the current
terminal and colors are automatically disabled for terminals like
vt100.

The patch moves lib/colors.c from libcommon.la to libtcolors.la to
avoid collisions with another utils.

Signed-off-by: Karel Zak <kzak@redhat.com>
10 years agoMerge branch 'fixes' of https://github.com/rudimeier/util-linux
Karel Zak [Thu, 26 Feb 2015 09:43:36 +0000 (10:43 +0100)] 
Merge branch 'fixes' of https://github.com/rudimeier/util-linux

* 'fixes' of https://github.com/rudimeier/util-linux:
  logger: link libsystemd-daemon.so

10 years agoblkid: make zfs detection more robust
Michal Humpula [Wed, 25 Feb 2015 19:25:05 +0000 (20:25 +0100)] 
blkid: make zfs detection more robust

Try to use all the possible uberblock locations.

10 years agocolors: cleanup man pages, add hint to usage()
Karel Zak [Wed, 25 Feb 2015 11:37:55 +0000 (12:37 +0100)] 
colors: cleanup man pages, add hint to usage()

 cfdisk, fdisk, calm dmesg and hexdump

Signed-off-by: Karel Zak <kzak@redhat.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
10 years agosfdisk: add missing --color
Karel Zak [Wed, 25 Feb 2015 11:35:45 +0000 (12:35 +0100)] 
sfdisk: add missing --color

The util already support lib/colors.c stuff, but without command line
option.

Signed-off-by: Karel Zak <kzak@redhat.com>
10 years agolib/colors: add USAGE_COLORS_DEFAULT
Karel Zak [Wed, 25 Feb 2015 11:35:05 +0000 (12:35 +0100)] 
lib/colors: add USAGE_COLORS_DEFAULT

Signed-off-by: Karel Zak <kzak@redhat.com>
10 years agobuild-sys: add --disable-colors-default
Karel Zak [Wed, 25 Feb 2015 09:06:40 +0000 (10:06 +0100)] 
build-sys: add --disable-colors-default

The current util-linux is to have enabled colorized outputs by
default, this default behavior is possible to change by new configure
option --disable-colors-default.

Signed-off-by: Karel Zak <kzak@redhat.com>
10 years agologger: link libsystemd-daemon.so
Ruediger Meier [Tue, 24 Feb 2015 15:26:00 +0000 (16:26 +0100)] 
logger: link libsystemd-daemon.so

Noticed on openSUSE 13.1:
util-linux-2.26/misc-utils/logger.c:735: undefined reference to `sd_booted'

Introduced in d77dc29e.

CC: Sami Kerola <kerolasa@iki.fi>
Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
10 years agologger: move /dev/log to pathnames.h
Sami Kerola [Sun, 22 Feb 2015 14:41:45 +0000 (14:41 +0000)] 
logger: move /dev/log to pathnames.h

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
10 years agorpmatch: use symbolic value when evaluation return codes
Sami Kerola [Sun, 22 Feb 2015 14:41:40 +0000 (14:41 +0000)] 
rpmatch: use symbolic value when evaluation return codes

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
10 years agoeject: use parse_switch()
Sami Kerola [Sun, 22 Feb 2015 14:41:39 +0000 (14:41 +0000)] 
eject: use parse_switch()

[kzak@redhat.com: - use extended parse_switch()]

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
Signed-off-by: Karel Zak <kzak@redhat.com>
10 years agolib/strutils: extend parse_switch() to accept more options
Karel Zak [Tue, 24 Feb 2015 11:04:22 +0000 (12:04 +0100)] 
lib/strutils: extend parse_switch() to accept more options

* allow to specify more 0|1 pairs
* allow to specify error message

Signed-off-by: Karel Zak <kzak@redhat.com>
10 years agolib/strutils: move parse_switch() from setterm(1) to library
Sami Kerola [Sun, 22 Feb 2015 14:41:37 +0000 (14:41 +0000)] 
lib/strutils: move parse_switch() from setterm(1) to library

To allow sharing the code with other utilities.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
Signed-off-by: Karel Zak <kzak@redhat.com>
10 years agotunelp: remove unnecessary preprocessor directives
Sami Kerola [Sun, 22 Feb 2015 14:41:36 +0000 (14:41 +0000)] 
tunelp: remove unnecessary preprocessor directives

The lp.h included earlier in the tunelp.c has the definitions that were
checked, so these statements could have not been false and such
impossible conditions does not need to be checked.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
10 years agotunelp: remove get_val() in favour of strtol_or_err()
Sami Kerola [Sun, 22 Feb 2015 14:41:35 +0000 (14:41 +0000)] 
tunelp: remove get_val() in favour of strtol_or_err()

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
10 years agoprlimit: tell in --verbose output which pid got the new limit
Sami Kerola [Sun, 22 Feb 2015 14:41:34 +0000 (14:41 +0000)] 
prlimit: tell in --verbose output which pid got the new limit

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
10 years agolibblkid: cleanup names, don't copy probing results
Karel Zak [Mon, 23 Feb 2015 14:45:41 +0000 (15:45 +0100)] 
libblkid: cleanup names, don't copy probing results

* cleanup function and variable names (s/vals/values/)
* in "safe probe" mode libblkid copies probing result from the first
  attempt, this is unnecessary, with values list we can just move
  values to another list rather than copy all.
* add new debug messages

Signed-off-by: Karel Zak <kzak@redhat.com>
10 years agolibblkid: make probing data structures more dynamic
Ondrej Oprala [Tue, 3 Feb 2015 15:30:15 +0000 (16:30 +0100)] 
libblkid: make probing data structures more dynamic

* replace static probing result array with list
* use allocated buffers for probing result variables

[kzak@redhat.com: - rename some functions
                  - clean up \0 terminator usage in variables
                  - remove never used code to convert UUID to lower-case
                  - remove possible memory leaks on errors]

Signed-off-by: Ondrej Oprala <ooprala@redhat.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
10 years agodocs: add terminal-colors requests to TODO
Karel Zak [Thu, 19 Feb 2015 13:31:02 +0000 (14:31 +0100)] 
docs: add terminal-colors requests to TODO

Signed-off-by: Karel Zak <kzak@redhat.com>
10 years agotools: add libfdisk docs to kernel.org release generator
Karel Zak [Thu, 19 Feb 2015 12:43:42 +0000 (13:43 +0100)] 
tools: add libfdisk docs to kernel.org release generator

Signed-off-by: Karel Zak <kzak@redhat.com>
10 years agobuild-sys: release++ (v2.26) v2.26
Karel Zak [Thu, 19 Feb 2015 12:11:24 +0000 (13:11 +0100)] 
build-sys: release++ (v2.26)

Signed-off-by: Karel Zak <kzak@redhat.com>
10 years agodocs: update v2.26-ReleaseNotes
Karel Zak [Thu, 19 Feb 2015 12:10:10 +0000 (13:10 +0100)] 
docs: update v2.26-ReleaseNotes

Signed-off-by: Karel Zak <kzak@redhat.com>
10 years agodocs: update AUTHORS file
Karel Zak [Thu, 19 Feb 2015 12:07:55 +0000 (13:07 +0100)] 
docs: update AUTHORS file

Signed-off-by: Karel Zak <kzak@redhat.com>
10 years agopo: merge changes
Karel Zak [Thu, 19 Feb 2015 12:06:10 +0000 (13:06 +0100)] 
po: merge changes

Signed-off-by: Karel Zak <kzak@redhat.com>
10 years agopo: update vi.po (from translationproject.org)
Trần Ngọc Quân [Thu, 19 Feb 2015 12:02:28 +0000 (13:02 +0100)] 
po: update vi.po (from translationproject.org)

10 years agopo: update uk.po (from translationproject.org)
Yuri Chornoivan [Thu, 19 Feb 2015 12:02:28 +0000 (13:02 +0100)] 
po: update uk.po (from translationproject.org)

10 years agopo: update pl.po (from translationproject.org)
Jakub Bogusz [Thu, 19 Feb 2015 12:02:28 +0000 (13:02 +0100)] 
po: update pl.po (from translationproject.org)

10 years agopo: update nl.po (from translationproject.org)
Benno Schulenberg [Thu, 19 Feb 2015 12:02:28 +0000 (13:02 +0100)] 
po: update nl.po (from translationproject.org)

10 years agopo: update fr.po (from translationproject.org)
David Prévot [Thu, 19 Feb 2015 12:02:28 +0000 (13:02 +0100)] 
po: update fr.po (from translationproject.org)

10 years agopo: update es.po (from translationproject.org)
Antonio Ceballos Roa [Thu, 19 Feb 2015 12:02:28 +0000 (13:02 +0100)] 
po: update es.po (from translationproject.org)

10 years agopo: update de.po (from translationproject.org)
Mario Blättermann [Thu, 19 Feb 2015 12:02:28 +0000 (13:02 +0100)] 
po: update de.po (from translationproject.org)