]> git.ipfire.org Git - thirdparty/util-linux.git/commit
logger: fix invalid timestamp regression in local format
authorRainer Gerhards <rgerhards@adiscon.com>
Thu, 5 Mar 2015 14:20:50 +0000 (15:20 +0100)
committerKarel Zak <kzak@redhat.com>
Thu, 12 Mar 2015 09:16:07 +0000 (10:16 +0100)
commitc330264bd9ed2d5d92542302d98266b9919d16d9
tree3fb2003448d807875dbb7c41a3f340a49de7f159
parentd9074f191e4a6057f51f3a0d4bd0973366e245e2
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.
misc-utils/logger.c