summaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
* tailf: deprecatedRuediger Meier2015-03-164-4/+22
| | | | | | | | | | | | 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>
* tests: use --no-act for logger testsKarel Zak2015-03-161-9/+9
| | | | | | and also use --stderr on one place only. Signed-off-by: Karel Zak <kzak@redhat.com>
* tests: add logger(1) command line options testsSami Kerola2015-03-1614-0/+79
| | | | | | | [kzak@redhat.com: - use LOGGER_TEST_* env] Signed-off-by: Sami Kerola <kerolasa@iki.fi> Signed-off-by: Karel Zak <kzak@redhat.com>
* logger: add -DTEST_LOGGERKarel Zak2015-03-163-6/+56
| | | | | | | | | | | | | | | | | | | | | | "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>
* logger: add --no-act for testingKarel Zak2015-03-162-14/+37
| | | | | | | | | | * 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>
* logger: fix rfc5424 format crashKarel Zak2015-03-161-1/+2
| | | | | | | | $ logger --rfc5424=notq message Segmentation fault (core dumped) Reported-by: Sami Kerola <kerolasa@iki.fi> Signed-off-by: Karel Zak <kzak@redhat.com>
* logger: use errx() when checking user inputSami Kerola2015-03-161-2/+2
| | | | | | Additionally inform in usage() the --msgid requires an argument. Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* logger: check xgethostname() return valueSami Kerola2015-03-161-7/+10
| | | | Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* logger: tidy few indentation issuesSami Kerola2015-03-161-57/+58
| | | | Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* logger: Fix use of errno after strtol() without zeroing firstStef Walter2015-03-161-0/+1
| | | | | References: https://bugzilla.redhat.com/show_bug.cgi?id=1202104 Signed-off-by: Karel Zak <kzak@redhat.com>
* logger: use xstrdup()Karel Zak2015-03-131-4/+4
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* tests: fix fdisk/bsd for ppc64leRuediger Meier2015-03-131-2/+2
| | | | | | | | | | | | 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>
* tests: improve readability for fdisk/bsdRuediger Meier2015-03-131-6/+10
| | | | Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
* last: keep array of files in main()Karel Zak2015-03-131-32/+22Star
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* last: fix utmplist usageKarel Zak2015-03-131-16/+21
| | | | | | | | | | | | | 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>
* cal: care about setuprterm() resultKarel Zak2015-03-121-21/+38
| | | | | References: https://bugzilla.suse.com/show_bug.cgi?id=903440 Signed-off-by: Karel Zak <kzak@redhat.com>
* libmount: mark overlay as pseudo-FSKarel Zak2015-03-111-0/+1
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* libmount: add mnt_table_get_fs_root() to header fileKarel Zak2015-03-111-0/+4
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* Merge branch 'master-silence-format-printf-warning' of ↵Karel Zak2015-03-111-1/+2
|\ | | | | | | https://github.com/rgerhards/util-linux
| * silence compiler warningRainer Gerhards2015-03-101-1/+2
| | | | | | | | | | This is primarily cosmetic, albeit it also provides an only very slight improvement in compile time error checking.
* | tests: update sfdisk --dump testKarel Zak2015-03-111-0/+2
| | | | | | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* | logger: small change in usage()Karel Zak2015-03-111-1/+1
| | | | | | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* | logger man page: fix typoRainer Gerhards2015-03-101-1/+1
| |
* | logger: add --msgid option, permits to set RFC5424 MSGID fieldRainer Gerhards2015-03-102-4/+19
| |
* | logger: fix multiple format bugs in rfc5424 formatterRainer Gerhards2015-03-101-21/+57
|/ | | | | | 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.
* libmount: cleanup fs root detection codeKarel Zak2015-03-107-60/+26Star
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* findmnt: don't rely on st_dev for --targetKarel Zak2015-03-103-10/+20
| | | | | | | | | | | | 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>
* logger: check for ntp_gettime() rather than for timex.hKarel Zak2015-03-102-4/+4
| | | | | | | | 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>
* logger: add --skip-empty-lines to prevent logging empty linesRainer Gerhards2015-03-103-4/+20
| | | | | | | | | | | 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>
* logger man page: update --size docRainer Gerhards2015-03-101-4/+7
| | | | | | now we have strict sizes Signed-off-by: Karel Zak <kzak@redhat.com>
* logger: bugfix: missing sanity checks with --prio-prefix optionRainer Gerhards2015-03-101-37/+48
| | | | | | | | | | | | | | | | | | | | | | | | 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>
* logger: refactor message generationRainer Gerhards2015-03-101-44/+47
| | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* logger: permit to send messages larger than 1024 charactersRainer Gerhards2015-03-103-8/+32
| | | | | | | | | | | | | | | | | | 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>
* agetty: reload issue on --autologin --login-pause tooKarel Zak2015-03-091-79/+92
| | | | | | | | 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>
* agetty: make sure that reload file existsKarel Zak2015-03-091-5/+16
| | | | | | | | | | 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>
* build-sys: fix typoKarel Zak2015-03-061-1/+1
|
* Revert "build-sys: remove static builds from make-check"Karel Zak2015-03-061-0/+1
| | | | | | The problem should be fixed now. This reverts commit 948b87581e7f1a430f258e169282a1755bb68edd.
* build-sys: cleanup realtime lib usageKarel Zak2015-03-065-21/+22
| | | | | | | | * 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>
* lib/timer: use separate file for timersKarel Zak2015-03-067-60/+76
| | | | | | | | 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>
* Merge branch 'logger-man-syslog-routine' of ↵Karel Zak2015-03-061-3/+3
|\ | | | | | | | | | | | | | | 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
| * logger man page: bump man page date to currentRainer Gerhards2015-03-061-1/+1
| |
| * logger man page: fix some "syslog(3) routine" remnantsRainer Gerhards2015-03-061-2/+2
| |
* | Merge branch 'logger-fix-tcp-framing' of https://github.com/rgerhards/util-linuxKarel Zak2015-03-061-13/+27
|\ \ | |/ |/| | | | | | | * '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
| * logger: bugfix: tcp syslog framing is broken, -T unusableRainer Gerhards2015-03-061-0/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
| * logger: refactor the way output is writtenRainer Gerhards2015-03-061-13/+12Star
| | | | | | | | | | | | 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.
* | logger: use username as the default tagKarel Zak2015-03-061-1/+1
| | | | | | | | | | Reported-by: Rainer Gerhards <rgerhards@adiscon.com> Signed-off-by: Karel Zak <kzak@redhat.com>
* | logger: remove "interface to syslog(3)" from man pageKarel Zak2015-03-061-5/+1Star
|/ | | | | | | 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>
* Merge branch 'logger-kernel-regression' of ↵Karel Zak2015-03-061-1/+3
|\ | | | | | | | | | | | | | | 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
| * logger: fix -p kern.* priority is accepted regressionRainer Gerhards2015-03-051-0/+2
| | | | | | | | | | Pre 2.26, syslog(3) was used for local logging, and it did not accept kern.* priorities. This is re-enabled by the patch.
| * logger: messages are logged with kern.* priority by defaultRainer Gerhards2015-03-051-1/+1
| | | | | | | | | | | | | | | | | | | | | | 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