diff options
author | Alexander Kanavin <alex.kanavin@gmail.com> | 2022-01-19 11:40:48 +0100 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2022-01-20 11:57:29 +0000 |
commit | c87a3b92ace07edb4ab46432523e96e22f7c166d (patch) | |
tree | 9f9c11419b5e3b4e8edbe2877ed54ff8740978c4 /meta | |
parent | 0b1dc4e3d437fb9cde75604a5881e0fdb98ebdd6 (diff) | |
download | poky-c87a3b92ace07edb4ab46432523e96e22f7c166d.tar.gz |
logrotate: update 3.18.1 -> 3.19.0, drop rotate-across-filesystems patches
Upstream review and request to address it got no reaction
from the author, and the patches are an ongoing rebase burden,
so if someone needs this feature, please complete
the upstreaming work first.
(From OE-Core rev: c748945e9c91eb2b83b8a44828f35579bcd09146)
Signed-off-by: Alexander Kanavin <alex@linutronix.de>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta')
-rw-r--r-- | meta/lib/oeqa/runtime/cases/logrotate.py | 14 | ||||
-rw-r--r-- | meta/recipes-extended/logrotate/logrotate/0001-Update-the-manual.patch | 39 | ||||
-rw-r--r-- | meta/recipes-extended/logrotate/logrotate/act-as-mv-when-rotate.patch | 149 | ||||
-rw-r--r-- | meta/recipes-extended/logrotate/logrotate/disable-check-different-filesystems.patch | 36 | ||||
-rw-r--r-- | meta/recipes-extended/logrotate/logrotate_3.19.0.bb (renamed from meta/recipes-extended/logrotate/logrotate_3.18.1.bb) | 8 |
5 files changed, 9 insertions, 237 deletions
diff --git a/meta/lib/oeqa/runtime/cases/logrotate.py b/meta/lib/oeqa/runtime/cases/logrotate.py index a4efcd07c0..2bff08f9da 100644 --- a/meta/lib/oeqa/runtime/cases/logrotate.py +++ b/meta/lib/oeqa/runtime/cases/logrotate.py | |||
@@ -17,7 +17,7 @@ class LogrotateTest(OERuntimeTestCase): | |||
17 | 17 | ||
18 | @classmethod | 18 | @classmethod |
19 | def tearDownClass(cls): | 19 | def tearDownClass(cls): |
20 | cls.tc.target.run('mv -f $HOME/wtmp.oeqabak /etc/logrotate.d/wtmp && rm -rf $HOME/logrotate_dir') | 20 | cls.tc.target.run('mv -f $HOME/wtmp.oeqabak /etc/logrotate.d/wtmp && rm -rf /var/log//logrotate_dir') |
21 | cls.tc.target.run('rm -rf /var/log/logrotate_testfile && rm -rf /etc/logrotate.d/logrotate_testfile') | 21 | cls.tc.target.run('rm -rf /var/log/logrotate_testfile && rm -rf /etc/logrotate.d/logrotate_testfile') |
22 | 22 | ||
23 | @OETestDepends(['ssh.SSHTest.test_ssh']) | 23 | @OETestDepends(['ssh.SSHTest.test_ssh']) |
@@ -29,17 +29,17 @@ class LogrotateTest(OERuntimeTestCase): | |||
29 | msg = ('Could not create/update /var/log/wtmp with touch') | 29 | msg = ('Could not create/update /var/log/wtmp with touch') |
30 | self.assertEqual(status, 0, msg = msg) | 30 | self.assertEqual(status, 0, msg = msg) |
31 | 31 | ||
32 | status, output = self.target.run('mkdir $HOME/logrotate_dir') | 32 | status, output = self.target.run('mkdir /var/log//logrotate_dir') |
33 | msg = ('Could not create logrotate_dir. Output: %s' % output) | 33 | msg = ('Could not create logrotate_dir. Output: %s' % output) |
34 | self.assertEqual(status, 0, msg = msg) | 34 | self.assertEqual(status, 0, msg = msg) |
35 | 35 | ||
36 | status, output = self.target.run('echo "create \n olddir $HOME/logrotate_dir \n include /etc/logrotate.d/wtmp" > /tmp/logrotate-test.conf') | 36 | status, output = self.target.run('echo "create \n olddir /var/log//logrotate_dir \n include /etc/logrotate.d/wtmp" > /tmp/logrotate-test.conf') |
37 | msg = ('Could not write to /tmp/logrotate-test.conf') | 37 | msg = ('Could not write to /tmp/logrotate-test.conf') |
38 | self.assertEqual(status, 0, msg = msg) | 38 | self.assertEqual(status, 0, msg = msg) |
39 | 39 | ||
40 | # If logrotate fails to rotate the log, view the verbose output of logrotate to see what prevented it | 40 | # If logrotate fails to rotate the log, view the verbose output of logrotate to see what prevented it |
41 | _, logrotate_output = self.target.run('logrotate -vf /tmp/logrotate-test.conf') | 41 | _, logrotate_output = self.target.run('logrotate -vf /tmp/logrotate-test.conf') |
42 | status, _ = self.target.run('find $HOME/logrotate_dir -type f | grep wtmp.1') | 42 | status, _ = self.target.run('find /var/log//logrotate_dir -type f | grep wtmp.1') |
43 | msg = ("logrotate did not successfully rotate the wtmp log. Output from logrotate -vf: \n%s" % (logrotate_output)) | 43 | msg = ("logrotate did not successfully rotate the wtmp log. Output from logrotate -vf: \n%s" % (logrotate_output)) |
44 | self.assertEqual(status, 0, msg = msg) | 44 | self.assertEqual(status, 0, msg = msg) |
45 | 45 | ||
@@ -54,17 +54,17 @@ class LogrotateTest(OERuntimeTestCase): | |||
54 | msg = ('Could not write to /etc/logrotate.d/logrotate_testfile') | 54 | msg = ('Could not write to /etc/logrotate.d/logrotate_testfile') |
55 | self.assertEqual(status, 0, msg = msg) | 55 | self.assertEqual(status, 0, msg = msg) |
56 | 56 | ||
57 | status, output = self.target.run('echo "create \n olddir $HOME/logrotate_dir \n include /etc/logrotate.d/logrotate_testfile" > /tmp/logrotate-test2.conf') | 57 | status, output = self.target.run('echo "create \n olddir /var/log//logrotate_dir \n include /etc/logrotate.d/logrotate_testfile" > /tmp/logrotate-test2.conf') |
58 | msg = ('Could not write to /tmp/logrotate_test2.conf') | 58 | msg = ('Could not write to /tmp/logrotate_test2.conf') |
59 | self.assertEqual(status, 0, msg = msg) | 59 | self.assertEqual(status, 0, msg = msg) |
60 | 60 | ||
61 | status, output = self.target.run('find $HOME/logrotate_dir -type f | grep logrotate_testfile.1') | 61 | status, output = self.target.run('find /var/log//logrotate_dir -type f | grep logrotate_testfile.1') |
62 | msg = ('A rotated log for logrotate_testfile is already present in logrotate_dir') | 62 | msg = ('A rotated log for logrotate_testfile is already present in logrotate_dir') |
63 | self.assertEqual(status, 1, msg = msg) | 63 | self.assertEqual(status, 1, msg = msg) |
64 | 64 | ||
65 | # If logrotate fails to rotate the log, view the verbose output of logrotate instead of just listing the files in olddir | 65 | # If logrotate fails to rotate the log, view the verbose output of logrotate instead of just listing the files in olddir |
66 | _, logrotate_output = self.target.run('logrotate -vf /tmp/logrotate-test2.conf') | 66 | _, logrotate_output = self.target.run('logrotate -vf /tmp/logrotate-test2.conf') |
67 | status, _ = self.target.run('find $HOME/logrotate_dir -type f | grep logrotate_testfile.1') | 67 | status, _ = self.target.run('find /var/log//logrotate_dir -type f | grep logrotate_testfile.1') |
68 | msg = ('logrotate did not successfully rotate the logrotate_test log. Output from logrotate -vf: \n%s' % (logrotate_output)) | 68 | msg = ('logrotate did not successfully rotate the logrotate_test log. Output from logrotate -vf: \n%s' % (logrotate_output)) |
69 | self.assertEqual(status, 0, msg = msg) | 69 | self.assertEqual(status, 0, msg = msg) |
70 | 70 | ||
diff --git a/meta/recipes-extended/logrotate/logrotate/0001-Update-the-manual.patch b/meta/recipes-extended/logrotate/logrotate/0001-Update-the-manual.patch deleted file mode 100644 index 50a3852078..0000000000 --- a/meta/recipes-extended/logrotate/logrotate/0001-Update-the-manual.patch +++ /dev/null | |||
@@ -1,39 +0,0 @@ | |||
1 | From 3e2cfa88b6538bb0fee3d9a6e99622055d05ac4a Mon Sep 17 00:00:00 2001 | ||
2 | From: Robert Yang <liezhi.yang@windriver.com> | ||
3 | Date: Tue, 17 Feb 2015 21:14:37 -0800 | ||
4 | Subject: [PATCH] Update the manual | ||
5 | |||
6 | Update the manual for rotating on different filesystems. | ||
7 | |||
8 | Upstream-Status: Pending | ||
9 | |||
10 | Signed-off-by: Robert Yang <liezhi.yang@windriver.com> | ||
11 | |||
12 | --- | ||
13 | logrotate.8.in | 10 ++++------ | ||
14 | 1 file changed, 4 insertions(+), 6 deletions(-) | ||
15 | |||
16 | diff --git a/logrotate.8.in b/logrotate.8.in | ||
17 | index 98fea91..70b4c44 100644 | ||
18 | --- a/logrotate.8.in | ||
19 | +++ b/logrotate.8.in | ||
20 | @@ -202,12 +202,10 @@ at all (use with caution, may waste performance and disk space). Default is 0. | ||
21 | |||
22 | .TP | ||
23 | \fBolddir \fIdirectory\fR | ||
24 | -Logs are moved into \fIdirectory\fR for rotation. The \fIdirectory\fR must be | ||
25 | -on the same physical device as the log file being rotated, unless \fBcopy\fR, | ||
26 | -\fBcopytruncate\fR or \fBrenamecopy\fR option is used. The \fIdirectory\fR | ||
27 | -is assumed to be relative to the directory holding the log file | ||
28 | -unless an absolute path name is specified. When this option is used all | ||
29 | -old versions of the log end up in \fIdirectory\fR. This option may be | ||
30 | +Logs are moved into \fIdirectory\fR for rotation. The \fIdirectory\fR | ||
31 | +is assumed to be relative to the directory holding the log file unless | ||
32 | +an absolute path name is specified. When this option is used all old | ||
33 | +versions of the log end up in \fIdirectory\fR. This option may be | ||
34 | overridden by the \fBnoolddir\fR option. | ||
35 | |||
36 | .TP | ||
37 | -- | ||
38 | 2.24.0 | ||
39 | |||
diff --git a/meta/recipes-extended/logrotate/logrotate/act-as-mv-when-rotate.patch b/meta/recipes-extended/logrotate/logrotate/act-as-mv-when-rotate.patch deleted file mode 100644 index 4efd471906..0000000000 --- a/meta/recipes-extended/logrotate/logrotate/act-as-mv-when-rotate.patch +++ /dev/null | |||
@@ -1,149 +0,0 @@ | |||
1 | From 17d57a2a923a4af53c8910a9999aebeab3f5d83a Mon Sep 17 00:00:00 2001 | ||
2 | From: Robert Yang <liezhi.yang@windriver.com> | ||
3 | Date: Tue, 17 Feb 2015 21:08:07 -0800 | ||
4 | Subject: [PATCH] Act as the "mv" command when rotate log | ||
5 | |||
6 | Act as the "mv" command when rotate log, first rename, if failed, then | ||
7 | read and write. | ||
8 | |||
9 | Upstream-Status: Inappropriate [needs a rework according to https://github.com/logrotate/logrotate/pull/429] | ||
10 | |||
11 | Signed-off-by: Robert Yang <liezhi.yang@windriver.com> | ||
12 | |||
13 | --- | ||
14 | logrotate.c | 71 ++++++++++++++++++++++++++++++++++++++++++++--------- | ||
15 | 1 file changed, 59 insertions(+), 12 deletions(-) | ||
16 | |||
17 | diff --git a/logrotate.c b/logrotate.c | ||
18 | index 45b3eb6..231371a 100644 | ||
19 | --- a/logrotate.c | ||
20 | +++ b/logrotate.c | ||
21 | @@ -1463,6 +1463,53 @@ static int findNeedRotating(const struct logInfo *log, unsigned logNum, int forc | ||
22 | return 0; | ||
23 | } | ||
24 | |||
25 | +/* Act as the "mv" command, if rename failed, then read the old file and | ||
26 | + * write to new file. The function which invokes the mvFile will use | ||
27 | + * the strerror(errorno) to handle the error message, so we don't have | ||
28 | + * to print the error message here */ | ||
29 | + | ||
30 | +int mvFile (char *oldName, char *newName, struct logInfo *log, acl_type acl) | ||
31 | +{ | ||
32 | + struct stat sbprev; | ||
33 | + int fd_old, fd_new, n; | ||
34 | + char buf[BUFSIZ]; | ||
35 | + | ||
36 | + /* Do the rename first */ | ||
37 | + if (!rename(oldName, newName)) | ||
38 | + return 0; | ||
39 | + | ||
40 | + /* If the errno is EXDEV, then read old file, write newfile and | ||
41 | + * remove the oldfile */ | ||
42 | + if (errno == EXDEV) { | ||
43 | + /* Open the old file to read */ | ||
44 | + if ((fd_old = open(oldName, O_RDONLY)) < 0) | ||
45 | + return 1; | ||
46 | + | ||
47 | + /* Create the file to write, keep the same attribute as the old file */ | ||
48 | + if (stat(oldName, &sbprev)) | ||
49 | + return 1; | ||
50 | + else { | ||
51 | + if ((fd_new = createOutputFile(newName, | ||
52 | + O_WRONLY | O_CREAT | O_TRUNC, &sbprev, acl, 0)) < 0 ) | ||
53 | + return 1; | ||
54 | + } | ||
55 | + | ||
56 | + /* Read and write */ | ||
57 | + while ((n = read(fd_old, buf, BUFSIZ)) > 0) | ||
58 | + if (write(fd_new, buf, n) != n) | ||
59 | + return 1; | ||
60 | + | ||
61 | + if ((close(fd_old) < 0) || | ||
62 | + removeLogFile(oldName, log) || | ||
63 | + (close(fd_new) < 0)) | ||
64 | + return 1; | ||
65 | + | ||
66 | + return 0; | ||
67 | + } | ||
68 | + | ||
69 | + return 1; | ||
70 | +} | ||
71 | + | ||
72 | /* find the rotated file with the highest index */ | ||
73 | static int findLastRotated(const struct logNames *rotNames, | ||
74 | const char *fileext, const char *compext) | ||
75 | @@ -1958,15 +2005,15 @@ static int prerotateSingleLog(const struct logInfo *log, unsigned logNum, | ||
76 | } | ||
77 | |||
78 | message(MESS_DEBUG, | ||
79 | - "renaming %s to %s (rotatecount %d, logstart %d, i %d), \n", | ||
80 | + "moving %s to %s (rotatecount %d, logstart %d, i %d), \n", | ||
81 | oldName, newName, rotateCount, logStart, i); | ||
82 | |||
83 | - if (!debug && rename(oldName, newName)) { | ||
84 | + if (!debug && mvFile(oldName, newName, log, prev_acl)) { | ||
85 | if (errno == ENOENT) { | ||
86 | message(MESS_DEBUG, "old log %s does not exist\n", | ||
87 | oldName); | ||
88 | } else { | ||
89 | - message(MESS_ERROR, "error renaming %s to %s: %s\n", | ||
90 | + message(MESS_ERROR, "error moving %s to %s: %s\n", | ||
91 | oldName, newName, strerror(errno)); | ||
92 | hasErrors = 1; | ||
93 | } | ||
94 | @@ -2051,10 +2098,10 @@ static int rotateSingleLog(const struct logInfo *log, unsigned logNum, | ||
95 | return 1; | ||
96 | } | ||
97 | |||
98 | - message(MESS_DEBUG, "renaming %s to %s\n", log->files[logNum], | ||
99 | + message(MESS_DEBUG, "moving %s to %s\n", log->files[logNum], | ||
100 | tmpFilename); | ||
101 | - if (!debug && !hasErrors && rename(log->files[logNum], tmpFilename)) { | ||
102 | - message(MESS_ERROR, "failed to rename %s to %s: %s\n", | ||
103 | + if (!debug && !hasErrors && mvFile(log->files[logNum], rotNames->finalName, log, prev_acl)) { | ||
104 | + message(MESS_ERROR, "failed to move %s to %s: %s\n", | ||
105 | log->files[logNum], tmpFilename, | ||
106 | strerror(errno)); | ||
107 | hasErrors = 1; | ||
108 | @@ -2063,11 +2110,11 @@ static int rotateSingleLog(const struct logInfo *log, unsigned logNum, | ||
109 | free(tmpFilename); | ||
110 | } | ||
111 | else { | ||
112 | - message(MESS_DEBUG, "renaming %s to %s\n", log->files[logNum], | ||
113 | + message(MESS_DEBUG, "moving %s to %s\n", log->files[logNum], | ||
114 | rotNames->finalName); | ||
115 | if (!debug && !hasErrors && | ||
116 | - rename(log->files[logNum], rotNames->finalName)) { | ||
117 | - message(MESS_ERROR, "failed to rename %s to %s: %s\n", | ||
118 | + mvFile(log->files[logNum], rotNames->finalName, log, prev_acl)) { | ||
119 | + message(MESS_ERROR, "failed to move %s to %s: %s\n", | ||
120 | log->files[logNum], rotNames->finalName, | ||
121 | strerror(errno)); | ||
122 | hasErrors = 1; | ||
123 | @@ -2480,7 +2527,7 @@ static int rotateLogSet(const struct logInfo *log, int force) | ||
124 | return hasErrors; | ||
125 | } | ||
126 | |||
127 | -static int writeState(const char *stateFilename) | ||
128 | +static int writeState(struct logInfo *log, char *stateFilename) | ||
129 | { | ||
130 | struct logState *p; | ||
131 | FILE *f; | ||
132 | @@ -2659,7 +2706,7 @@ static int writeState(const char *stateFilename) | ||
133 | fclose(f); | ||
134 | |||
135 | if (error == 0) { | ||
136 | - if (rename(tmpFilename, stateFilename)) { | ||
137 | + if (mvFile(tmpFilename, stateFilename, log, prev_acl)) { | ||
138 | message(MESS_ERROR, "error renaming temp state file %s to %s: %s\n", | ||
139 | tmpFilename, stateFilename, strerror(errno)); | ||
140 | unlink(tmpFilename); | ||
141 | @@ -3073,7 +3120,7 @@ int main(int argc, const char **argv) | ||
142 | rc |= rotateLogSet(log, force); | ||
143 | |||
144 | if (!debug) | ||
145 | - rc |= writeState(stateFile); | ||
146 | + rc |= writeState(log, stateFile); | ||
147 | |||
148 | return (rc != 0); | ||
149 | } | ||
diff --git a/meta/recipes-extended/logrotate/logrotate/disable-check-different-filesystems.patch b/meta/recipes-extended/logrotate/logrotate/disable-check-different-filesystems.patch deleted file mode 100644 index d7f9a02cc8..0000000000 --- a/meta/recipes-extended/logrotate/logrotate/disable-check-different-filesystems.patch +++ /dev/null | |||
@@ -1,36 +0,0 @@ | |||
1 | From 16c1833ade4c036b30b8761d2c4a5bd85cc65c44 Mon Sep 17 00:00:00 2001 | ||
2 | From: Robert Yang <liezhi.yang@windriver.com> | ||
3 | Date: Tue, 8 Jan 2019 06:27:06 +0000 | ||
4 | Subject: [PATCH] Disable the check for different filesystems | ||
5 | |||
6 | The logrotate supports rotate log across different filesystems now, so | ||
7 | disable the check for different filesystems. | ||
8 | |||
9 | Upstream-Status: Pending | ||
10 | |||
11 | Signed-off-by: Robert Yang <liezhi.yang@windriver.com> | ||
12 | |||
13 | --- | ||
14 | config.c | 9 --------- | ||
15 | 1 file changed, 9 deletions(-) | ||
16 | |||
17 | diff --git a/config.c b/config.c | ||
18 | index d2488f1..1de3745 100644 | ||
19 | --- a/config.c | ||
20 | +++ b/config.c | ||
21 | @@ -1902,15 +1902,6 @@ duperror: | ||
22 | } | ||
23 | |||
24 | free(ld); | ||
25 | - | ||
26 | - if (sb.st_dev != sb2.st_dev | ||
27 | - && !(newlog->flags & (LOG_FLAG_COPYTRUNCATE | LOG_FLAG_COPY | LOG_FLAG_TMPFILENAME))) { | ||
28 | - message(MESS_ERROR, | ||
29 | - "%s:%d olddir %s and log file %s " | ||
30 | - "are on different devices\n", configFile, | ||
31 | - lineNum, newlog->oldDir, newlog->files[j]); | ||
32 | - goto error; | ||
33 | - } | ||
34 | } | ||
35 | } | ||
36 | |||
diff --git a/meta/recipes-extended/logrotate/logrotate_3.18.1.bb b/meta/recipes-extended/logrotate/logrotate_3.19.0.bb index bca47872c5..67c071833c 100644 --- a/meta/recipes-extended/logrotate/logrotate_3.18.1.bb +++ b/meta/recipes-extended/logrotate/logrotate_3.19.0.bb | |||
@@ -13,13 +13,9 @@ LIC_FILES_CHKSUM = "file://COPYING;md5=b234ee4d69f5fce4486a80fdaf4a4263" | |||
13 | UPSTREAM_CHECK_URI = "https://github.com/${BPN}/${BPN}/releases" | 13 | UPSTREAM_CHECK_URI = "https://github.com/${BPN}/${BPN}/releases" |
14 | UPSTREAM_CHECK_REGEX = "logrotate-(?P<pver>\d+(\.\d+)+).tar" | 14 | UPSTREAM_CHECK_REGEX = "logrotate-(?P<pver>\d+(\.\d+)+).tar" |
15 | 15 | ||
16 | SRC_URI = "https://github.com/${BPN}/${BPN}/releases/download/${PV}/${BP}.tar.xz \ | 16 | SRC_URI = "https://github.com/${BPN}/${BPN}/releases/download/${PV}/${BP}.tar.xz" |
17 | file://act-as-mv-when-rotate.patch \ | ||
18 | file://0001-Update-the-manual.patch \ | ||
19 | file://disable-check-different-filesystems.patch \ | ||
20 | " | ||
21 | 17 | ||
22 | SRC_URI[sha256sum] = "14a924e4804b3974e85019a9f9352c2a69726702e6656155c48bcdeace68a5dc" | 18 | SRC_URI[sha256sum] = "ddd5274d684c5c99ca724e8069329f343ebe376e07493d537d9effdc501214ba" |
23 | 19 | ||
24 | # These CVEs are debian, gentoo or SUSE specific on the way logrotate was installed/used | 20 | # These CVEs are debian, gentoo or SUSE specific on the way logrotate was installed/used |
25 | CVE_CHECK_WHITELIST += "CVE-2011-1548 CVE-2011-1549 CVE-2011-1550" | 21 | CVE_CHECK_WHITELIST += "CVE-2011-1548 CVE-2011-1549 CVE-2011-1550" |