All of lore.kernel.org
 help / color / mirror / Atom feed
From: Zhenbo Gao <zhenbo.gao@windriver.com>
To: <ross.burton@intel.com>, <openembedded-core@lists.openembedded.org>
Subject: [PATCH] logrotate: Support system dates back to the year 1970
Date: Mon, 5 Jun 2017 15:38:04 +0800	[thread overview]
Message-ID: <1496648284-206244-1-git-send-email-zhenbo.gao@windriver.com> (raw)

backport commit bdbfea3 from logrotate upstream.

Signed-off-by: Zhenbo Gao <zhenbo.gao@windriver.com>
---
 ...upport-system-dates-back-to-the-year-1970.patch | 27 ++++++++++++++++++++++
 meta/recipes-extended/logrotate/logrotate_3.9.1.bb |  1 +
 2 files changed, 28 insertions(+)
 create mode 100644 meta/recipes-extended/logrotate/logrotate/0001-Support-system-dates-back-to-the-year-1970.patch

diff --git a/meta/recipes-extended/logrotate/logrotate/0001-Support-system-dates-back-to-the-year-1970.patch b/meta/recipes-extended/logrotate/logrotate/0001-Support-system-dates-back-to-the-year-1970.patch
new file mode 100644
index 0000000..b544ec6
--- /dev/null
+++ b/meta/recipes-extended/logrotate/logrotate/0001-Support-system-dates-back-to-the-year-1970.patch
@@ -0,0 +1,27 @@
+Support system dates back to the year 1970
+
+The system time on Linux can be set back as far as 1970 (the epoch time).
+Currently logrotate stops working correctly if the time goes before 1996.
+This value (1996) appears to have been hard coded since the code was written
+back in 1996. Testing and code analysis shows this can simply be modified
+to 1970.
+
+The patch is provided by Matt Bennett <matt.bennett@alliedtelesis.co.nz>
+
+Upstream-Status: Backport +
+Signed-off-by: Zhenbo Gao <zhenbo.gao@windriver.com>
+
+diff --git a/logrotate.c.orig b/logrotate.c
+index cf8bf2c..a7dadfb 100644
+--- a/logrotate.c.orig
++++ b/logrotate.c
+@@ -2381,7 +2381,7 @@ static int readState(char *stateFilename)
+ 	}
+ 
+ 	/* Hack to hide earlier bug */
+-	if ((year != 1900) && (year < 1996 || year > 2100)) {
++	if ((year != 1900) && (year < 1970 || year > 2100)) {
+ 	    message(MESS_ERROR,
+ 		    "bad year %d for file %s in state file %s\n", year,
+ 		    argv[0], stateFilename);
+
diff --git a/meta/recipes-extended/logrotate/logrotate_3.9.1.bb b/meta/recipes-extended/logrotate/logrotate_3.9.1.bb
index c938d9f..4246231 100644
--- a/meta/recipes-extended/logrotate/logrotate_3.9.1.bb
+++ b/meta/recipes-extended/logrotate/logrotate_3.9.1.bb
@@ -23,6 +23,7 @@ SRC_URI = "https://github.com/${BPN}/${BPN}/archive/r3-9-1.tar.gz \
            file://act-as-mv-when-rotate.patch \
            file://update-the-manual.patch \
            file://disable-check-different-filesystems.patch \
+           file://0001-Support-system-dates-back-to-the-year-1970.patch \
             "
 
 SRC_URI[md5sum] = "8572b7c2cf9ade09a8a8e10098500fb3"
-- 
1.9.1



                 reply	other threads:[~2017-06-05  7:38 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1496648284-206244-1-git-send-email-zhenbo.gao@windriver.com \
    --to=zhenbo.gao@windriver.com \
    --cc=openembedded-core@lists.openembedded.org \
    --cc=ross.burton@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.