diff options
author | Shiz <hi@shiz.me> | 2017-05-09 00:37:32 +0200 |
---|---|---|
committer | William Pitcock <nenolod@dereferenced.org> | 2017-05-11 04:02:28 +0000 |
commit | 318c497f003be1645152235d1b08005f7dfde3ee (patch) | |
tree | 32510e5fcd371b224fbe629708a9169c2ee8e06c | |
parent | 5246e1f211639aed5320fa8f954bd06c83157a80 (diff) | |
download | aports-318c497f003be1645152235d1b08005f7dfde3ee.tar.bz2 aports-318c497f003be1645152235d1b08005f7dfde3ee.tar.xz |
main/busybox: add -Z option to syslogd and enable it by default
-rw-r--r-- | main/busybox-initscripts/APKBUILD | 54 | ||||
-rw-r--r-- | main/busybox-initscripts/syslog.confd | 2 | ||||
-rw-r--r-- | main/busybox/0015-syslogd-adjust-timezone-option.patch | 105 | ||||
-rw-r--r-- | main/busybox/APKBUILD | 4 |
4 files changed, 111 insertions, 54 deletions
diff --git a/main/busybox-initscripts/APKBUILD b/main/busybox-initscripts/APKBUILD index 4a15bc503b..47234b8010 100644 --- a/main/busybox-initscripts/APKBUILD +++ b/main/busybox-initscripts/APKBUILD @@ -2,7 +2,7 @@ # Maintainer: Natanael Copa <ncopa@alpinelinux.org> pkgname=busybox-initscripts pkgver=3.1 -pkgrel=0 +pkgrel=1 pkgdesc="Init scripts for busybox daemons" url="http://git.alpinelinux.org/cgit/aports/tree/core/busybox-initscripts" arch="noarch" @@ -52,56 +52,6 @@ EOF } -md5sums="22c4509243f68873c2c89505cbb509a4 acpid.initd -629c36d84be6ba8c7f1a46411e8617af crond.initd -47f2931fdf09558a5cc0fdb1cde2f814 dnsd.initd -bdb6830041b77db4a3de3b35ed326d5e httpd.initd -12fffa82b698267240acd4bdaa4861da inetd.initd -96d5eb83477a8adc007a0ac4aedc0e61 klogd.initd -b86749a0a4167e0a6178a217b264d0f6 mdev.initd -88ac156aa6cc3999805d526498765d07 ntpd.initd -e70b6427fb7b52f49801bcdfb99db3a2 rdate.initd -916cb1b94996269cade9eb88b6eab59e syslog.initd -9c6b8973cb8407eb5ac32a9b6fc78e64 udhcpd.initd -4894514fb7e4485d6520290c9fa11a30 watchdog.initd -83bf1e56c1454634f6d2b9e7945e6a0f crond.confd -60bc14cc3163d76f41bcc93dc0f9984b klogd.confd -779058fe16d8a476c165b6d0928408b3 ntpd.confd -22adbf155ffc4595206ded6daad07812 rdate.confd -77fb31a75511247bf4e3430565a276bc syslog.confd -0bb55dde32f5e119111fa4938daaef3d watchdog.confd -b5eaf81581bd575056ef59a00b57f405 mdev.conf -ad1556961294e4aa2abca6be52138b7c dvbdev -5c8725b4cbdeda23b00f08124a0d20bf ide_links -daf57f3d0372f825ddc05b00973e5afe usbdev -30b0c85956b6701caf55309a17e537f6 usbdisk_link -826d85313ca7a4a0205d63bd58b7d01f xvd_links -a53918e4deaabe97b47c3aea431ef960 default.script" -sha256sums="c92c6f91d56de0e7ac7189a85c6bb0f054199acc2b18258f4c7e0939d352b8b0 acpid.initd -182bddd5097daf3995c4eceec38cf9ab758f271b3e65d6b0f8a67f1281c8de19 crond.initd -26b7af7288089e8462db062c0644c8a66855d6bd0eaa7edd2a3a43b3655c7da8 dnsd.initd -010542f0718fcbc42273068dfc88d3518c919a73576b9ffab4795a6d36ce3f40 httpd.initd -53ddd392736957d6a36157c190e0428fbb0c3a27925c63df8188f3461e74410d inetd.initd -9b90176cb12a1b3a7a558ac3c03ba445409979c04e142c6f5aba8a5f10ea0c83 klogd.initd -e08f595cb22ad4aef4d48deabb933067407a4b94be131d078ebd715fd7e380d3 mdev.initd -4a32eea4da1e9eaf6c5ecfce20a297b55de3a1d479bc0578286d769be0114a7b ntpd.initd -0c6eb4dc269386472f475cf9c549ba53b73aa33f044fbfb3b6bc6dd2574bb341 rdate.initd -f8bb5df1464aa7680efe6bd4acd1f9c99cb0b0f3aed978b441c132ba799dd3c1 syslog.initd -3a2c7b3a7b3fa6aa68096a0c978c6cd3e068f0f67ce4905a143fad5eb3c9b3c8 udhcpd.initd -03c1a6312598aeea5d10195ff5473ecc8ee89182b8115a8b5ad529259c0ea564 watchdog.initd -d058d9ed0824f877b4e88158fe25d71ad76fca4b71542c4c6d7991ee2ecd20f8 crond.confd -f6cd63d6e5f384dcb01a4906c9a0b6c5923794380235dfe0d79b48a686b03c5d klogd.confd -4224e5c6b5ffeb815c15f3e9f17ddaa169d4e6b7da169dbd0939fe06dbe8914d ntpd.confd -791d49802395861a5f788dc7436c1260ec2cd3bdea0c790952ae1b2dd518e811 rdate.confd -8a2362d6b5b1ec1d754878726392119f2cc7416c748ee4f2ab134f731d6e6198 syslog.confd -77f6f9069afdbb477a7e822aa2c7265d64fd22fdd9338bb3beb0cee901d202ce watchdog.confd -fa682e6d776c362892748640b00fb90661cc2966d61606f881142e223bc60220 mdev.conf -ef091bb4c8943a99b9a97b556cdc15ddd20275f5afa8287e201419b08c4e71de dvbdev -3fccc9ee437e3dcc8ac73bfe3713334a7156a112fe442e052fff4f26ff0f6a88 ide_links -dcb0c37590019bccb4c31a5372cbf7728eae6f1174d56bf0708d7504243a5fbb usbdev -4957f6991e0cb988b263b5276b582f1757deecad19cddebe3c615b381df9f858 usbdisk_link -86ed99205050a5dcca8a27c7e8658df8c55dc85ed810db0d64b51f7c63aa140e xvd_links -f555b07c4934dd59c7ab0c71080d97491afd17b7222631a49ccba3c95c6eea91 default.script" sha512sums="dd548670114a92404b8e35fb915fdbe5994498b05b0a418583271c3dd72fb7800950e42c095c902a014eb198c046b8a346d43dccd8e7a158048ae33767c572ed acpid.initd c9d0fb0f8cc27d661d3b4e58c56eb598ca368890576e18ffffd42efdf68ba35537656be9be319b2e2818aa0152d3ca8611bece2433512fbfcd4eed7988765549 crond.initd 82c70082fa6e00c389982e16b0ef92f8f137941517a2b74de57150f4645d8b8b2a91abaa22d5aede8f7d08e0749ef14a07860cf16f96058b96f4246a6c39222a dnsd.initd @@ -118,7 +68,7 @@ a95d03564712803fc58c48534f2fbbf23dd8418ffd3a6a06f840e969627892eea518b4fe17f05985 f9bf43b72142bbb4c0665c1268a3d91586ef8a057dfe64c53b6923815d2db1f669b8080a38311ad89cda0b783a8628700fc5414d834a21d8e48515760bb910f7 klogd.confd b0ba67585f39d83320ed6de183d7463a0e163807b9f3dc6f0baa212236056f22aeb2c5399dfdcd54929eb5ae06a15714c2fed133b5888869ed9d9cf589cef843 ntpd.confd 3d6c4d358e226e0c0462f2003bcf0b6787f91a53f4d6b6db5bfe7748bb0dd392d7cc454058ea8a9b649e8dd2629963a5ad1257c36af04367caeb1923f954daf7 rdate.confd -330c6e6808dfdf05c75dcdec1048f17052f79b285e11513a64a97bf28fb60e023840966abe03a74fa146eb6b842c4e0e78df82918528e0b6e8f546f7f0a4e323 syslog.confd +f650bafb8cc9e30743249b2baefd9d0b7f4a93cc96afc5608cc24dfb0dc9a3e4cbfe554eb5a09662339630231d4636a8e76236cb2351955e109ad542e8a5a8f3 syslog.confd 359af0a4a1841dd6557eaf3e71d39f0d7a2687bad6a8fc6ef436eccf72a40f85c6400a3b7880c7f64d8e460b6af8a0ff3dd5ffc3a4b1aa8eb0d8f7eaf99ee3e4 watchdog.confd 4f7734f5c0ca0ad87ff945b41eabeb4d0694d08317852e76ddf90dcabfab665b1f4c6d24a315c496ac667b0aebdd032756cec093999ca1e71b9acea9390bc3ca mdev.conf ebd82f935da2ca89097234dd8a8f47e179a423652c151123a1f3343f3e1e7bfaba2b8800380e988d4e8f4294545d3a9ab6708ae2e77c5b108b5f091bbce8f94a dvbdev diff --git a/main/busybox-initscripts/syslog.confd b/main/busybox-initscripts/syslog.confd index 5f23b819d5..ce2bdd066d 100644 --- a/main/busybox-initscripts/syslog.confd +++ b/main/busybox-initscripts/syslog.confd @@ -1 +1 @@ -SYSLOGD_OPTS="" +SYSLOGD_OPTS="-Z" diff --git a/main/busybox/0015-syslogd-adjust-timezone-option.patch b/main/busybox/0015-syslogd-adjust-timezone-option.patch new file mode 100644 index 0000000000..ba2b9aae42 --- /dev/null +++ b/main/busybox/0015-syslogd-adjust-timezone-option.patch @@ -0,0 +1,105 @@ +From 97577835169acc9ee8ef25b0561cbfaa78463f5c Mon Sep 17 00:00:00 2001 +From: Shiz <hi@shiz.me> +Date: Mon, 8 May 2017 23:09:13 +0200 +Subject: [PATCH] sysklogd: add -Z option to adjust message timezones + +Some syslog() implementations like musl's[1] always send timestamps in UTC. +This change adds a new option to syslogd, -Z, to assume incoming timestamps +are always UTC and adjust them to the local timezone (of the syslogd) before +logging. + +[1]: http://www.openwall.com/lists/musl/2014/01/29/1 + +Signed-off-by: Shiz <hi@shiz.me> +--- + sysklogd/syslogd.c | 23 +++++++++++++++++++---- + 1 file changed, 19 insertions(+), 4 deletions(-) + +diff --git a/sysklogd/syslogd.c b/sysklogd/syslogd.c +index d64ff27..159336e 100644 +--- a/sysklogd/syslogd.c ++++ b/sysklogd/syslogd.c +@@ -122,6 +122,7 @@ + //usage: "(this version of syslogd ignores /etc/syslog.conf)\n" + //usage: ) + //usage: "\n -n Run in foreground" ++//usage: "\n -Z Adjust incoming UTC times to local time" + //usage: IF_FEATURE_REMOTE_LOG( + //usage: "\n -R HOST[:PORT] Log to HOST:PORT (default PORT:514)" + //usage: "\n -L Log locally and via network (default is network only if -R)" +@@ -233,6 +234,8 @@ typedef struct logRule_t { + /*int markInterval;*/ \ + /* level of messages to be logged */ \ + int logLevel; \ ++ /* whether to adjust message timezone */\ ++ int adjustTimezone; \ + IF_FEATURE_ROTATE_LOGFILE( \ + /* max size of file before rotation */ \ + unsigned logFileSize; \ +@@ -316,6 +319,7 @@ enum { + OPTBIT_outfile, // -O + OPTBIT_loglevel, // -l + OPTBIT_small, // -S ++ OPTBIT_adjusttz, // -Z + IF_FEATURE_ROTATE_LOGFILE(OPTBIT_filesize ,) // -s + IF_FEATURE_ROTATE_LOGFILE(OPTBIT_rotatecnt ,) // -b + IF_FEATURE_REMOTE_LOG( OPTBIT_remotelog ,) // -R +@@ -330,6 +334,7 @@ enum { + OPT_outfile = 1 << OPTBIT_outfile , + OPT_loglevel = 1 << OPTBIT_loglevel, + OPT_small = 1 << OPTBIT_small , ++ OPT_adjusttz = 1 << OPTBIT_adjusttz, + OPT_filesize = IF_FEATURE_ROTATE_LOGFILE((1 << OPTBIT_filesize )) + 0, + OPT_rotatecnt = IF_FEATURE_ROTATE_LOGFILE((1 << OPTBIT_rotatecnt )) + 0, + OPT_remotelog = IF_FEATURE_REMOTE_LOG( (1 << OPTBIT_remotelog )) + 0, +@@ -339,7 +344,7 @@ enum { + OPT_cfg = IF_FEATURE_SYSLOGD_CFG( (1 << OPTBIT_cfg )) + 0, + OPT_kmsg = IF_FEATURE_KMSG_SYSLOG( (1 << OPTBIT_kmsg )) + 0, + }; +-#define OPTION_STR "m:nO:l:S" \ ++#define OPTION_STR "m:nO:l:SZ" \ + IF_FEATURE_ROTATE_LOGFILE("s:" ) \ + IF_FEATURE_ROTATE_LOGFILE("b:" ) \ + IF_FEATURE_REMOTE_LOG( "R:*") \ +@@ -815,17 +820,23 @@ static void timestamp_and_log(int pri, char *msg, int len) + { + char *timestamp; + time_t now; ++ struct tm nowtm = { .tm_isdst = 0 }; + + /* Jan 18 00:11:22 msg... */ + /* 01234567890123456 */ + if (len < 16 || msg[3] != ' ' || msg[6] != ' ' + || msg[9] != ':' || msg[12] != ':' || msg[15] != ' ' + ) { +- time(&now); ++ now = time(NULL); + timestamp = ctime(&now) + 4; /* skip day of week */ + } else { +- now = 0; +- timestamp = msg; ++ if (G.adjustTimezone && strptime(msg, "%b %e %T", &nowtm)) { ++ now = mktime(&nowtm) - timezone; ++ timestamp = ctime(&now) + 4; /* skip day of week */ ++ } else { ++ now = 0; ++ timestamp = msg; ++ } + msg += 16; + } + timestamp[15] = '\0'; +@@ -1130,6 +1141,10 @@ int syslogd_main(int argc UNUSED_PARAM, char **argv) + if (opts & OPT_loglevel) // -l + G.logLevel = xatou_range(opt_l, 1, 8); + //if (opts & OPT_small) // -S ++ if (opts & OPT_adjusttz) { // -Z ++ G.adjustTimezone = 1; ++ tzset(); ++ } + #if ENABLE_FEATURE_ROTATE_LOGFILE + if (opts & OPT_filesize) // -s + G.logFileSize = xatou_range(opt_s, 0, INT_MAX/1024) * 1024; +-- +2.10.0 + + diff --git a/main/busybox/APKBUILD b/main/busybox/APKBUILD index 10897726a0..2667b273f7 100644 --- a/main/busybox/APKBUILD +++ b/main/busybox/APKBUILD @@ -2,7 +2,7 @@ # Maintainer: Natanael Copa <ncopa@alpinelinux.org> pkgname=busybox pkgver=1.26.2 -pkgrel=2 +pkgrel=3 pkgdesc="Size optimized toolbox of many common UNIX utilities" url=http://busybox.net arch="all" @@ -30,6 +30,7 @@ source="http://busybox.net/downloads/$pkgname-$pkgver.tar.bz2 0012-diff-add-support-for-no-dereference.patch 0013-ash-make-shellexec-capable-of-using-separate-argv-0-.patch 0014-ash-implement-exec-a-ARGV0-CMD-ARGV1.patch + 0015-syslogd-adjust-timezone-option.patch fix-tests.patch location-for-cpio.patch @@ -162,6 +163,7 @@ f82caa1dc4395f266b024a7face267a916a80ead95f3d392b10fd397d0fdf62703e3078357bc7196 361959788bc11b7f20d4029bb0f561759d270983b09c44fe2a01817378c4eb1c98cd8ef73e7ef8c168b7540170f58ddb36b9e4f80a97565f3fe3ba85b593a471 0012-diff-add-support-for-no-dereference.patch bf3e7c400e718fbc19fda19d7304ed938e5c59f45d5d1ba6eafd8f62a984d40419dbefd9f6840ac7f220d00abfae67e8f31be78b4c2e25310b265bca8beb91a2 0013-ash-make-shellexec-capable-of-using-separate-argv-0-.patch cb7aa4d5d22596bc8c6510cb653599dd8cf4c3a5312e93adfc6411d811376db2ad3b506a111322f46aa9929a5337e22a169da4ea250fd4b39e703adbc8792a2d 0014-ash-implement-exec-a-ARGV0-CMD-ARGV1.patch +c37d1583cfb32e7aa077e7f4ea121dd3b2e3cf989a3dca2793126bcd89eb6d8eb6fae948085565807c2fb98d8dc92a2907cc03d988d1a47305d3e588ac268c5b 0015-syslogd-adjust-timezone-option.patch 2adfc6c71cfcc5df12edef13228c92b34c7782615e60effc97e6e7a9aa7e015c24c7b3950a8a9a2bf3ba5efd43a08ad45b16b35b03c90275807380e0600cb70d fix-tests.patch f26e090f5de0096ba5c4d46989ebe0ab5fa64c8bf54cd37ddec302fddfde23eac914858d86cc52bf3b5780a8e81ea2612ef6e713df2828e52c606f86a6816f39 location-for-cpio.patch a9b1403c844c51934637215307dd9e2adb9458921047acff0d86dcf229b6e0027f4b2c6cdaa25a58407aad9d098fb5685d58eb5ff8d2aa3de4912cdea21fe54c acpid.logrotate |