diff options
-rw-r--r-- | meta/recipes-extended/logrotate/logrotate/act-as-mv-when-rotate.patch | 141 | ||||
-rw-r--r-- | meta/recipes-extended/logrotate/logrotate/disable-check-different-filesystems.patch | 40 | ||||
-rw-r--r-- | meta/recipes-extended/logrotate/logrotate_3.15.0.bb (renamed from meta/recipes-extended/logrotate/logrotate_3.14.0.bb) | 6 |
3 files changed, 96 insertions, 91 deletions
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 index 04cb588db1..79805b5148 100644 --- a/meta/recipes-extended/logrotate/logrotate/act-as-mv-when-rotate.patch +++ b/meta/recipes-extended/logrotate/logrotate/act-as-mv-when-rotate.patch | |||
@@ -1,4 +1,4 @@ | |||
1 | From 517cbff66c8bdbf455bc3b7c1a85a4f990d0f9a6 Mon Sep 17 00:00:00 2001 | 1 | From c637948ebab5aff5641700c5cf613321ca0a6e6b Mon Sep 17 00:00:00 2001 |
2 | From: Robert Yang <liezhi.yang@windriver.com> | 2 | From: Robert Yang <liezhi.yang@windriver.com> |
3 | Date: Tue, 17 Feb 2015 21:08:07 -0800 | 3 | Date: Tue, 17 Feb 2015 21:08:07 -0800 |
4 | Subject: [PATCH] Act as the "mv" command when rotate log | 4 | Subject: [PATCH] Act as the "mv" command when rotate log |
@@ -10,14 +10,14 @@ Upstream-Status: Pending | |||
10 | 10 | ||
11 | Signed-off-by: Robert Yang <liezhi.yang@windriver.com> | 11 | Signed-off-by: Robert Yang <liezhi.yang@windriver.com> |
12 | --- | 12 | --- |
13 | logrotate.c | 72 ++++++++++++++++++++++++++++++++++++++++++++++++++----------- | 13 | logrotate.c | 71 ++++++++++++++++++++++++++++++++++++++++++++--------- |
14 | 1 file changed, 60 insertions(+), 12 deletions(-) | 14 | 1 file changed, 59 insertions(+), 12 deletions(-) |
15 | 15 | ||
16 | diff --git a/logrotate.c b/logrotate.c | 16 | diff --git a/logrotate.c b/logrotate.c |
17 | index 4ad58d4..ba05884 100644 | 17 | index 54dac90..bf3ec23 100644 |
18 | --- a/logrotate.c | 18 | --- a/logrotate.c |
19 | +++ b/logrotate.c | 19 | +++ b/logrotate.c |
20 | @@ -1315,6 +1315,54 @@ static int findNeedRotating(struct logInfo *log, int logNum, int force) | 20 | @@ -1360,6 +1360,53 @@ static int findNeedRotating(struct logInfo *log, int logNum, int force) |
21 | return 0; | 21 | return 0; |
22 | } | 22 | } |
23 | 23 | ||
@@ -68,84 +68,83 @@ index 4ad58d4..ba05884 100644 | |||
68 | + return 1; | 68 | + return 1; |
69 | +} | 69 | +} |
70 | + | 70 | + |
71 | + | 71 | /* find the rotated file with the highest index */ |
72 | static int prerotateSingleLog(struct logInfo *log, int logNum, | 72 | static int findLastRotated(const struct logNames *rotNames, |
73 | struct logState *state, struct logNames *rotNames) | 73 | const char *fileext, const char *compext) |
74 | { | 74 | @@ -1800,15 +1847,15 @@ static int prerotateSingleLog(struct logInfo *log, int logNum, |
75 | @@ -1674,15 +1722,15 @@ static int prerotateSingleLog(struct logInfo *log, int logNum, | 75 | } |
76 | } | ||
77 | 76 | ||
78 | message(MESS_DEBUG, | 77 | message(MESS_DEBUG, |
79 | - "renaming %s to %s (rotatecount %d, logstart %d, i %d), \n", | 78 | - "renaming %s to %s (rotatecount %d, logstart %d, i %d), \n", |
80 | + "moving %s to %s (rotatecount %d, logstart %d, i %d), \n", | 79 | + "moving %s to %s (rotatecount %d, logstart %d, i %d), \n", |
81 | oldName, newName, rotateCount, logStart, i); | 80 | oldName, newName, rotateCount, logStart, i); |
82 | 81 | ||
83 | - if (!debug && rename(oldName, newName)) { | 82 | - if (!debug && rename(oldName, newName)) { |
84 | + if (!debug && mvFile(oldName, newName, log, prev_acl)) { | 83 | + if (!debug && mvFile(oldName, newName, log, prev_acl)) { |
85 | if (errno == ENOENT) { | 84 | if (errno == ENOENT) { |
86 | message(MESS_DEBUG, "old log %s does not exist\n", | 85 | message(MESS_DEBUG, "old log %s does not exist\n", |
87 | oldName); | 86 | oldName); |
88 | } else { | 87 | } else { |
89 | - message(MESS_ERROR, "error renaming %s to %s: %s\n", | 88 | - message(MESS_ERROR, "error renaming %s to %s: %s\n", |
90 | + message(MESS_ERROR, "error moving %s to %s: %s\n", | 89 | + message(MESS_ERROR, "error moving %s to %s: %s\n", |
91 | oldName, newName, strerror(errno)); | 90 | oldName, newName, strerror(errno)); |
92 | hasErrors = 1; | 91 | hasErrors = 1; |
93 | } | 92 | } |
94 | @@ -1767,21 +1815,21 @@ static int rotateSingleLog(struct logInfo *log, int logNum, | 93 | @@ -1891,21 +1938,21 @@ static int rotateSingleLog(struct logInfo *log, int logNum, |
95 | return 1; | 94 | return 1; |
96 | } | 95 | } |
97 | 96 | ||
98 | - message(MESS_DEBUG, "renaming %s to %s\n", log->files[logNum], | 97 | - message(MESS_DEBUG, "renaming %s to %s\n", log->files[logNum], |
99 | + message(MESS_DEBUG, "moving %s to %s\n", log->files[logNum], | 98 | + message(MESS_DEBUG, "moving %s to %s\n", log->files[logNum], |
100 | tmpFilename); | 99 | tmpFilename); |
101 | - if (!debug && !hasErrors && rename(log->files[logNum], tmpFilename)) { | 100 | - if (!debug && !hasErrors && rename(log->files[logNum], tmpFilename)) { |
102 | - message(MESS_ERROR, "failed to rename %s to %s: %s\n", | 101 | - message(MESS_ERROR, "failed to rename %s to %s: %s\n", |
103 | + if (!debug && !hasErrors && mvFile(log->files[logNum], rotNames->finalName, log, prev_acl)) { | 102 | + if (!debug && !hasErrors && mvFile(log->files[logNum], rotNames->finalName, log, prev_acl)) { |
104 | + message(MESS_ERROR, "failed to move %s to %s: %s\n", | 103 | + message(MESS_ERROR, "failed to move %s to %s: %s\n", |
105 | log->files[logNum], tmpFilename, | 104 | log->files[logNum], tmpFilename, |
106 | strerror(errno)); | 105 | strerror(errno)); |
107 | hasErrors = 1; | 106 | hasErrors = 1; |
108 | } | 107 | } |
109 | } | 108 | } |
110 | else { | 109 | else { |
111 | - message(MESS_DEBUG, "renaming %s to %s\n", log->files[logNum], | 110 | - message(MESS_DEBUG, "renaming %s to %s\n", log->files[logNum], |
112 | + message(MESS_DEBUG, "moving %s to %s\n", log->files[logNum], | 111 | + message(MESS_DEBUG, "moving %s to %s\n", log->files[logNum], |
113 | rotNames->finalName); | 112 | rotNames->finalName); |
114 | if (!debug && !hasErrors && | 113 | if (!debug && !hasErrors && |
115 | - rename(log->files[logNum], rotNames->finalName)) { | 114 | - rename(log->files[logNum], rotNames->finalName)) { |
116 | - message(MESS_ERROR, "failed to rename %s to %s: %s\n", | 115 | - message(MESS_ERROR, "failed to rename %s to %s: %s\n", |
117 | + mvFile(log->files[logNum], rotNames->finalName, log, prev_acl)) { | 116 | + mvFile(log->files[logNum], rotNames->finalName, log, prev_acl)) { |
118 | + message(MESS_ERROR, "failed to move %s to %s: %s\n", | 117 | + message(MESS_ERROR, "failed to move %s to %s: %s\n", |
119 | log->files[logNum], rotNames->finalName, | 118 | log->files[logNum], rotNames->finalName, |
120 | strerror(errno)); | 119 | strerror(errno)); |
121 | hasErrors = 1; | 120 | hasErrors = 1; |
122 | @@ -2170,7 +2218,7 @@ static int rotateLogSet(struct logInfo *log, int force) | 121 | @@ -2297,7 +2344,7 @@ static int rotateLogSet(struct logInfo *log, int force) |
123 | return hasErrors; | 122 | return hasErrors; |
124 | } | 123 | } |
125 | 124 | ||
126 | -static int writeState(const char *stateFilename) | 125 | -static int writeState(const char *stateFilename) |
127 | +static int writeState(struct logInfo *log, char *stateFilename) | 126 | +static int writeState(struct logInfo *log, char *stateFilename) |
128 | { | 127 | { |
129 | struct logState *p; | 128 | struct logState *p; |
130 | FILE *f; | 129 | FILE *f; |
131 | @@ -2322,7 +2370,7 @@ static int writeState(const char *stateFilename) | 130 | @@ -2460,7 +2507,7 @@ static int writeState(const char *stateFilename) |
132 | fclose(f); | 131 | fclose(f); |
133 | 132 | ||
134 | if (error == 0) { | 133 | if (error == 0) { |
135 | - if (rename(tmpFilename, stateFilename)) { | 134 | - if (rename(tmpFilename, stateFilename)) { |
136 | + if (mvFile(tmpFilename, stateFilename, log, prev_acl)) { | 135 | + if (mvFile(tmpFilename, stateFilename, log, prev_acl)) { |
137 | unlink(tmpFilename); | 136 | unlink(tmpFilename); |
138 | error = 1; | 137 | error = 1; |
139 | message(MESS_ERROR, "error renaming temp state file %s\n", | 138 | message(MESS_ERROR, "error renaming temp state file %s\n", |
140 | @@ -2648,7 +2696,7 @@ int main(int argc, const char **argv) | 139 | @@ -2805,7 +2852,7 @@ int main(int argc, const char **argv) |
141 | rc |= rotateLogSet(log, force); | 140 | rc |= rotateLogSet(log, force); |
142 | 141 | ||
143 | if (!debug) | 142 | if (!debug) |
144 | - rc |= writeState(stateFile); | 143 | - rc |= writeState(stateFile); |
145 | + rc |= writeState(log, stateFile); | 144 | + rc |= writeState(log, stateFile); |
146 | 145 | ||
147 | return (rc != 0); | 146 | return (rc != 0); |
148 | } | 147 | } |
149 | -- | 148 | -- |
150 | 1.8.3.1 | 149 | 2.18.1 |
151 | 150 | ||
diff --git a/meta/recipes-extended/logrotate/logrotate/disable-check-different-filesystems.patch b/meta/recipes-extended/logrotate/logrotate/disable-check-different-filesystems.patch index 793d702598..96ff098a3f 100644 --- a/meta/recipes-extended/logrotate/logrotate/disable-check-different-filesystems.patch +++ b/meta/recipes-extended/logrotate/logrotate/disable-check-different-filesystems.patch | |||
@@ -1,4 +1,7 @@ | |||
1 | Disable the check for different filesystems | 1 | From e47796c8e8270a3d14f0b06af8a9e916c2225514 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 | ||
2 | 5 | ||
3 | The logrotate supports rotate log across different filesystems now, so | 6 | The logrotate supports rotate log across different filesystems now, so |
4 | disable the check for different filesystems. | 7 | disable the check for different filesystems. |
@@ -7,26 +10,29 @@ Upstream-Status: Pending | |||
7 | 10 | ||
8 | Signed-off-by: Robert Yang <liezhi.yang@windriver.com> | 11 | Signed-off-by: Robert Yang <liezhi.yang@windriver.com> |
9 | --- | 12 | --- |
10 | config.c | 9 --------- | 13 | config.c | 9 --------- |
11 | 1 file changed, 9 deletions(-) | 14 | 1 file changed, 9 deletions(-) |
12 | 15 | ||
13 | diff --git a/config.c b/config.c | 16 | diff --git a/config.c b/config.c |
14 | index dbbf563..64e66f6 100644 | 17 | index 633b843..99a4a3b 100644 |
15 | --- a/config.c | 18 | --- a/config.c |
16 | +++ b/config.c | 19 | +++ b/config.c |
17 | @@ -1493,15 +1493,6 @@ static int readConfigFile(const char *configFile, struct logInfo *defConfig) | 20 | @@ -1765,15 +1765,6 @@ duperror: |
18 | goto error; | 21 | goto error; |
19 | } | 22 | } |
20 | } | 23 | } |
21 | - | 24 | - |
22 | - if (sb.st_dev != sb2.st_dev | 25 | - if (sb.st_dev != sb2.st_dev |
23 | - && !(newlog->flags & (LOG_FLAG_COPYTRUNCATE | LOG_FLAG_COPY | LOG_FLAG_TMPFILENAME))) { | 26 | - && !(newlog->flags & (LOG_FLAG_COPYTRUNCATE | LOG_FLAG_COPY | LOG_FLAG_TMPFILENAME))) { |
24 | - message(MESS_ERROR, | 27 | - message(MESS_ERROR, |
25 | - "%s:%d olddir %s and log file %s " | 28 | - "%s:%d olddir %s and log file %s " |
26 | - "are on different devices\n", configFile, | 29 | - "are on different devices\n", configFile, |
27 | - lineNum, newlog->oldDir, newlog->files[i]); | 30 | - lineNum, newlog->oldDir, newlog->files[i]); |
28 | - goto error; | 31 | - goto error; |
29 | - } | 32 | - } |
30 | } | 33 | } |
31 | } | 34 | } |
32 | 35 | ||
36 | -- | ||
37 | 2.18.1 | ||
38 | |||
diff --git a/meta/recipes-extended/logrotate/logrotate_3.14.0.bb b/meta/recipes-extended/logrotate/logrotate_3.15.0.bb index ccc68ad3ac..0f3da2b94b 100644 --- a/meta/recipes-extended/logrotate/logrotate_3.14.0.bb +++ b/meta/recipes-extended/logrotate/logrotate_3.15.0.bb | |||
@@ -25,8 +25,8 @@ SRC_URI = "https://github.com/${BPN}/${BPN}/releases/download/${PV}/${BP}.tar.xz | |||
25 | file://disable-check-different-filesystems.patch \ | 25 | file://disable-check-different-filesystems.patch \ |
26 | " | 26 | " |
27 | 27 | ||
28 | SRC_URI[md5sum] = "1c0f6e6e490c4bcac0a1e77ad1310683" | 28 | SRC_URI[md5sum] = "320046f0b9fc38337e8827d4c5a866a0" |
29 | SRC_URI[sha256sum] = "4703bdc0e2df3b322f9dff0aafc99aa9172c9e4acae28b7c924cc7d4e5b29d55" | 29 | SRC_URI[sha256sum] = "313612c4776a305393454c874ef590d8acf84c9ffa648717731dfe902284ff8f" |
30 | 30 | ||
31 | PACKAGECONFIG ?= "${@bb.utils.filter('DISTRO_FEATURES', 'acl selinux', d)}" | 31 | PACKAGECONFIG ?= "${@bb.utils.filter('DISTRO_FEATURES', 'acl selinux', d)}" |
32 | 32 | ||
@@ -72,7 +72,7 @@ do_install(){ | |||
72 | oe_runmake install DESTDIR=${D} PREFIX=${D} MANDIR=${mandir} | 72 | oe_runmake install DESTDIR=${D} PREFIX=${D} MANDIR=${mandir} |
73 | mkdir -p ${D}${sysconfdir}/logrotate.d | 73 | mkdir -p ${D}${sysconfdir}/logrotate.d |
74 | mkdir -p ${D}${localstatedir}/lib | 74 | mkdir -p ${D}${localstatedir}/lib |
75 | install -p -m 644 ${S}/examples/logrotate-default ${D}${sysconfdir}/logrotate.conf | 75 | install -p -m 644 ${S}/examples/logrotate.conf ${D}${sysconfdir}/logrotate.conf |
76 | install -p -m 644 ${S}/examples/btmp ${D}${sysconfdir}/logrotate.d/btmp | 76 | install -p -m 644 ${S}/examples/btmp ${D}${sysconfdir}/logrotate.d/btmp |
77 | install -p -m 644 ${S}/examples/wtmp ${D}${sysconfdir}/logrotate.d/wtmp | 77 | install -p -m 644 ${S}/examples/wtmp ${D}${sysconfdir}/logrotate.d/wtmp |
78 | touch ${D}${localstatedir}/lib/logrotate.status | 78 | touch ${D}${localstatedir}/lib/logrotate.status |