X-Original-To: alpine-aports@lists.alpinelinux.org Received: from mail-yw0-f195.google.com (mail-yw0-f195.google.com [209.85.161.195]) by lists.alpinelinux.org (Postfix) with ESMTP id 6ACAE5C4BDD for ; Mon, 24 Jul 2017 13:06:23 +0000 (GMT) Received: by mail-yw0-f195.google.com with SMTP id u207so1003666ywc.0 for ; Mon, 24 Jul 2017 06:06:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=nywqRaR/1joslc4EZAHWrs8Ee9BBuk6DJFiUalLkHQY=; b=VfmFxL4oxJryNJx0FFrhcdJuLUJew8skLj/V1P6Zpyz6ztyKb5JSzHMHC7fGTuNdxI QEOwfi3WM0StbwFws4KuD+iZOb45dM+K9s/4nWAIt7FwoU7PpAeODYemDTWmTkKAvqaW ZdbgVfc7NSnT7AJP8JqZa9UXMUTjmnxbtU8eTBGoye1iqzTUV6TT1EM2pnKziY1aV0rI 9eoYx20VV/Nd9TDPvfxvphVk75poCSpl2UHhMdz4JX45G2ClgtcO3MGUhDnAxQMMx3YC sX4vvEhCfFXY4Hfcbcl7627y5Se8iRubMBQE//LzTcl4InsrUhceC1YT4zHPqNeMBm5B MfJw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=nywqRaR/1joslc4EZAHWrs8Ee9BBuk6DJFiUalLkHQY=; b=mpHpVP894eJLQVYM8EOMhing+hxMY0CzSlQ8C45LHp6pTudoTF7vteDIv9E51GiPjV r9YxzzdchomENLubHlpzq1lkBZrnF3WDwtVJSsllsW+mbY/jtDs/+5+w7AOGV7I28rvg iUW/1mqycocz7/t704n1yZkM3JWEvRoE40uqrxeFTdrURdbSTQKPZ8yHBk1FmXZZVkDk M9nsPoDOAXAJaiE4UjRIQrlaO3Gu00NzfN3/hEaxA/Fqx8dr1dwDm/GTeIpUfRijkQza ofQakVuG7271jRU103bALC1u51CDOKSOdLJ/kqXTjlpeA+HbWYIG8CoxY871M0mkOSR/ vwDA== X-Gm-Message-State: AIVw112S5/fSzUIov6iQ2O+pUoICrocltMhlv/ukFWULeYes3cohnV1q 2s29xAsWmyyNe06pCEyM2lwhR5wugQ== X-Received: by 10.37.48.139 with SMTP id w133mr13944663ybw.84.1500901582856; Mon, 24 Jul 2017 06:06:22 -0700 (PDT) X-Mailinglist: alpine-aports Precedence: list List-Id: Alpine Development List-Unsubscribe: List-Post: List-Help: List-Subscribe: MIME-Version: 1.0 Received: by 10.37.78.65 with HTTP; Mon, 24 Jul 2017 06:06:22 -0700 (PDT) In-Reply-To: <20170724144937.1a2c8ca7@ncopa-desktop.copa.dup.pw> References: <20170721222342.22201-1-oleg.omelyusik@gmail.com> <20170724144937.1a2c8ca7@ncopa-desktop.copa.dup.pw> From: Oleg Omelyusik Date: Mon, 24 Jul 2017 16:06:22 +0300 Message-ID: Subject: Re: [alpine-aports] [PATCH] main/busybox: fix timezone adjustment in syslogd To: Natanael Copa Cc: alpine-aports@lists.alpinelinux.org Content-Type: text/plain; charset="UTF-8" Hello, No it wasn't, since timezone adjustment is Alpine specific feature. This is about '-Z' option added to syslogd (commit 318c497f003be1645152235d1b08005f7dfde3ee in aports repo). I've also found related open bug in your tracker and updated it: https://bugs.alpinelinux.org/issues/3694 Thanks, Oleg On 24 July 2017 at 15:49, Natanael Copa wrote: > On Sat, 22 Jul 2017 01:23:42 +0300 > Oleg Omelyusik wrote: > >> --- >> ...gd-fix-timezone-adjustment-implementation.patch | 47 ++++++++++++++++++++++ >> main/busybox/APKBUILD | 2 + >> 2 files changed, 49 insertions(+) >> create mode 100644 main/busybox/0012-syslogd-fix-timezone-adjustment-implementation.patch >> >> diff --git a/main/busybox/0012-syslogd-fix-timezone-adjustment-implementation.patch b/main/busybox/0012-syslogd-fix-timezone-adjustment-implementation.patch >> new file mode 100644 >> index 0000000000..f276bc3e57 >> --- /dev/null >> +++ b/main/busybox/0012-syslogd-fix-timezone-adjustment-implementation.patch >> @@ -0,0 +1,47 @@ >> +From b09a292755943b3881aa3525c906989929c19fc8 Mon Sep 17 00:00:00 2001 >> +From: Oleg Omelyusik >> +Date: Fri, 21 Jul 2017 16:29:55 +0300 >> +Subject: [PATCH] syslogd: fix timezone adjustment implementation >> + >> +strptime() does not set year value which is needed for mktime(). >> +Also need to take into account year value when operating with timestamps >> +to prevent invalid convertions for leap years (e.g. Feb 28 23:00:00 UTC to GMT+2). > > Was this patch sent upstream? > > -nc > >> +--- >> + sysklogd/syslogd.c | 14 +++++++++++--- >> + 1 file changed, 11 insertions(+), 3 deletions(-) >> + >> +diff --git a/sysklogd/syslogd.c b/sysklogd/syslogd.c >> +index 1c67d1379..5ad50acd0 100644 >> +--- a/sysklogd/syslogd.c >> ++++ b/sysklogd/syslogd.c >> +@@ -820,7 +820,8 @@ static void timestamp_and_log(int pri, char *msg, int len) >> + { >> + char *timestamp; >> + time_t now; >> +- struct tm nowtm = { .tm_isdst = 0 }; >> ++ struct tm msgtm = { .tm_isdst = 0 }; >> ++ struct tm nowtm = { 0 }; >> + >> + /* Jan 18 00:11:22 msg... */ >> + /* 01234567890123456 */ >> +@@ -830,8 +831,15 @@ static void timestamp_and_log(int pri, char *msg, int len) >> + now = time(NULL); >> + timestamp = ctime(&now) + 4; /* skip day of week */ >> + } else { >> +- if (G.adjustTimezone && strptime(msg, "%b %e %T", &nowtm)) { >> +- now = mktime(&nowtm) - timezone; >> ++ if (G.adjustTimezone && strptime(msg, "%b %e %T", &msgtm)) { >> ++ /* set message year as current or previous year */ >> ++ now = time(NULL); >> ++ gmtime_r(&now, &nowtm); >> ++ msgtm.tm_year = nowtm.tm_year; >> ++ if (nowtm.tm_mon < msgtm.tm_mon) >> ++ --msgtm.tm_year; >> ++ /* adjust message timestamp */ >> ++ now = mktime(&msgtm) - timezone; >> + timestamp = ctime(&now) + 4; /* skip day of week */ >> + } else { >> + now = 0; >> +-- >> +2.13.0 >> + >> diff --git a/main/busybox/APKBUILD b/main/busybox/APKBUILD >> index 0010854105..e2d61f8799 100644 >> --- a/main/busybox/APKBUILD >> +++ b/main/busybox/APKBUILD >> @@ -29,6 +29,7 @@ source="http://busybox.net/downloads/$pkgname-$pkgver.tar.bz2 >> 0009-sysklogd-add-Z-option-to-adjust-message-timezones.patch >> 0010-udhcpc-Don-t-background-if-n-is-given.patch >> 0011-testsuite-fix-cpio-tests.patch >> + 0012-syslogd-fix-timezone-adjustment-implementation.patch >> >> top-buffer-overflow.patch >> >> @@ -179,6 +180,7 @@ baac796f8aa96fbeab19f96eea7787ace5737b182f49e02f1b1e911d0a927ae14f3c334daad42418 >> d1c375184f806f7550bac5c82ab5471bdb8085d845172c973724b22af05ab3759b3ce982e088b4c45815ade56b9adfb7a677d0c180e077545ac7ec003c8aa7c4 0009-sysklogd-add-Z-option-to-adjust-message-timezones.patch >> 9b5143d0be615b1604d82007628d59a62721f1e61a63cca7a4ffa5e60fa8da102bfc21fa20cc35c2f5a0a24bc8013598f8eff5888f9d0f3bcfa796343b5f5a91 0010-udhcpc-Don-t-background-if-n-is-given.patch >> f4e00eb13fda752df13f300a7ed9b1320ca9f573c4309247f292c8710464d7be8740148f42e4aff16312335eadabce5a629dce4af58334b9199faf2fd658e4f9 0011-testsuite-fix-cpio-tests.patch >> +e6774045441a88bf6b1edb83865cac33ee1a51c2da510b190cf6d790f1d2e6f13dc386c992ef414810dad7b80686f772b28adc5c25171bdc14cddc256344cdff 0012-syslogd-fix-timezone-adjustment-implementation.patch >> 524e858b52cb31fb8d24e8c7f18606fff349aeab6a14da9cca3902641f6127980daed73c53586c6e8b41eecda06cdb29c40ff1dde2dc82a318c2649680458921 top-buffer-overflow.patch >> a9b1403c844c51934637215307dd9e2adb9458921047acff0d86dcf229b6e0027f4b2c6cdaa25a58407aad9d098fb5685d58eb5ff8d2aa3de4912cdea21fe54c acpid.logrotate >> 857dece10267a065e0e8c16dd6190656f890a5aff774e96321715673dda23e75a8e61148e81d6286b7bdfe737a0b99104f9b04deeb4f392c72b63d8e3d00e556 busyboxconfig > --- Unsubscribe: alpine-aports+unsubscribe@lists.alpinelinux.org Help: alpine-aports+help@lists.alpinelinux.org ---