mirror of
https://git.yoctoproject.org/poky
synced 2026-06-02 13:29:49 +00:00
upgrade logrotate: split the old patch into 3
Split the old patch into 3 during upgrading, this makes it easier for the future's upgrade. (From OE-Core rev: 2ec5f1eab1f3d2eeff9f3984654a3fb4d87679e7) Signed-off-by: Robert Yang <liezhi.yang@windriver.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
committed by
Richard Purdie
parent
3f23b2f1b0
commit
a163d2168f
+13
-60
@@ -1,67 +1,20 @@
|
|||||||
Allow rotate log across different filesystems
|
Act as the "mv" command when rotate log
|
||||||
|
|
||||||
* Remove the check for different filesystems
|
Act as the "mv" command when rotate log, first rename, if failed, then
|
||||||
* Act as the "mv" command when rotate log
|
read and write.
|
||||||
* Update the mannual
|
|
||||||
* Fix a bug in the mannual(\f should be \fR)
|
|
||||||
|
|
||||||
Upstream-Status: Pending
|
Upstream-Status: Pending
|
||||||
|
|
||||||
Signed-off-by: Robert Yang <liezhi.yang@windriver.com>
|
Signed-off-by: Robert Yang <liezhi.yang@windriver.com>
|
||||||
---
|
---
|
||||||
config.c | 8 --------
|
|
||||||
logrotate.8 | 9 ++++-----
|
|
||||||
logrotate.c | 59 +++++++++++++++++++++++++++++++++++++++++++++++++++++------
|
logrotate.c | 59 +++++++++++++++++++++++++++++++++++++++++++++++++++++------
|
||||||
3 files changed, 57 insertions(+), 19 deletions(-)
|
1 files changed, 53 insertions(+), 6 deletions(-)
|
||||||
|
|
||||||
diff --git a/config.c b/config.c
|
|
||||||
--- a/config.c
|
|
||||||
+++ b/config.c
|
|
||||||
@@ -1482,14 +1482,6 @@ duperror:
|
|
||||||
dirName, strerror(errno));
|
|
||||||
goto error;
|
|
||||||
}
|
|
||||||
-
|
|
||||||
- if (sb.st_dev != sb2.st_dev) {
|
|
||||||
- message(MESS_ERROR,
|
|
||||||
- "%s:%d olddir %s and log file %s "
|
|
||||||
- "are on different devices\n", configFile,
|
|
||||||
- lineNum, newlog->oldDir, newlog->files[i]);
|
|
||||||
- goto error;
|
|
||||||
- }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
diff --git a/logrotate.8 b/logrotate.8
|
|
||||||
--- a/logrotate.8
|
|
||||||
+++ b/logrotate.8
|
|
||||||
@@ -354,10 +354,9 @@ Do not rotate the log if it is empty (this overrides the \fBifempty\fR option).
|
|
||||||
.TP
|
|
||||||
\fBolddir \fIdirectory\fR
|
|
||||||
Logs are moved into \fIdirectory\fR for rotation. The \fIdirectory\fR
|
|
||||||
-must be on the same physical device as the log file being rotated,
|
|
||||||
-and is assumed to be relative to the directory holding the log file
|
|
||||||
-unless an absolute path name is specified. When this option is used all
|
|
||||||
-old versions of the log end up in \fIdirectory\fR. This option may be
|
|
||||||
+is assumed to be relative to the directory holding the log file unless
|
|
||||||
+an absolute path name is specified. When this option is used all old
|
|
||||||
+versions of the log end up in \fIdirectory\fR. This option may be
|
|
||||||
overridden by the \fBnoolddir\fR option.
|
|
||||||
|
|
||||||
.TP
|
|
||||||
@@ -415,7 +414,7 @@ Log files are rotated when they grow bigger than \fIsize\fR bytes. If
|
|
||||||
\fIsize\fR is followed by \fIk\fR, the size is assumed to be in kilobytes.
|
|
||||||
If the \fIM\fR is used, the size is in megabytes, and if \fIG\fR is used, the
|
|
||||||
size is in gigabytes. So \fBsize 100\fR, \fIsize 100k\fR, \fIsize 100M\fR and
|
|
||||||
-\fIsize 100G\f are all valid.
|
|
||||||
+\fIsize 100G\fR are all valid.
|
|
||||||
|
|
||||||
.TP
|
|
||||||
\fBsharedscripts\fR
|
|
||||||
diff --git a/logrotate.c b/logrotate.c
|
diff --git a/logrotate.c b/logrotate.c
|
||||||
|
index 537e8d6..b04482f 100644
|
||||||
--- a/logrotate.c
|
--- a/logrotate.c
|
||||||
+++ b/logrotate.c
|
+++ b/logrotate.c
|
||||||
@@ -625,6 +625,53 @@ int findNeedRotating(struct logInfo *log, int logNum)
|
@@ -808,6 +808,53 @@ int findNeedRotating(struct logInfo *log, int logNum)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -115,7 +68,7 @@ diff --git a/logrotate.c b/logrotate.c
|
|||||||
int prerotateSingleLog(struct logInfo *log, int logNum, struct logState *state,
|
int prerotateSingleLog(struct logInfo *log, int logNum, struct logState *state,
|
||||||
struct logNames *rotNames)
|
struct logNames *rotNames)
|
||||||
{
|
{
|
||||||
@@ -958,15 +1005,15 @@ int prerotateSingleLog(struct logInfo *log, int logNum, struct logState *state,
|
@@ -1148,15 +1195,15 @@ int prerotateSingleLog(struct logInfo *log, int logNum, struct logState *state,
|
||||||
rotNames->baseName, i, fileext, compext);
|
rotNames->baseName, i, fileext, compext);
|
||||||
|
|
||||||
message(MESS_DEBUG,
|
message(MESS_DEBUG,
|
||||||
@@ -134,18 +87,18 @@ diff --git a/logrotate.c b/logrotate.c
|
|||||||
oldName, newName, strerror(errno));
|
oldName, newName, strerror(errno));
|
||||||
hasErrors = 1;
|
hasErrors = 1;
|
||||||
}
|
}
|
||||||
@@ -1082,11 +1129,11 @@ int rotateSingleLog(struct logInfo *log, int logNum, struct logState *state,
|
@@ -1286,11 +1333,11 @@ int rotateSingleLog(struct logInfo *log, int logNum, struct logState *state,
|
||||||
log->files[logNum]);
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif /* WITH_ACL */
|
||||||
- message(MESS_DEBUG, "renaming %s to %s\n", log->files[logNum],
|
- message(MESS_DEBUG, "renaming %s to %s\n", log->files[logNum],
|
||||||
+ message(MESS_DEBUG, "moving %s to %s\n", log->files[logNum],
|
+ message(MESS_DEBUG, "moving %s to %s\n", log->files[logNum],
|
||||||
rotNames->finalName);
|
rotNames->finalName);
|
||||||
if (!debug && !hasErrors &&
|
if (!debug && !hasErrors &&
|
||||||
- rename(log->files[logNum], rotNames->finalName)) {
|
- rename(log->files[logNum], rotNames->finalName)) {
|
||||||
- message(MESS_ERROR, "failed to rename %s to %s: %s\n",
|
- message(MESS_ERROR, "failed to rename %s to %s: %s\n",
|
||||||
+ mvFile(log->files[logNum], rotNames->finalName, log)) {
|
+ mvFile(log->files[logNum], rotNames->finalName, log)) {
|
||||||
+ message(MESS_ERROR, "failed to move %s to %s: %s\n",
|
+ message(MESS_ERROR, "failed to move %s to %s: %s\n",
|
||||||
log->files[logNum], rotNames->finalName,
|
log->files[logNum], rotNames->finalName,
|
||||||
strerror(errno));
|
strerror(errno));
|
||||||
hasErrors = 1;
|
hasErrors = 1;
|
||||||
+34
@@ -0,0 +1,34 @@
|
|||||||
|
Disable the check for different filesystems
|
||||||
|
|
||||||
|
The logrotate supports rotate log across different filesystems now, so
|
||||||
|
disable the check for different filesystems.
|
||||||
|
|
||||||
|
Upstream-Status: Pending
|
||||||
|
|
||||||
|
Signed-off-by: Robert Yang <liezhi.yang@windriver.com>
|
||||||
|
---
|
||||||
|
config.c | 8 --------
|
||||||
|
1 files changed, 0 insertions(+), 8 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/config.c b/config.c
|
||||||
|
index a85d1df..24575b3 100644
|
||||||
|
--- a/config.c
|
||||||
|
+++ b/config.c
|
||||||
|
@@ -1453,14 +1453,6 @@ static int readConfigFile(const char *configFile, struct logInfo *defConfig)
|
||||||
|
dirName, strerror(errno));
|
||||||
|
goto error;
|
||||||
|
}
|
||||||
|
-
|
||||||
|
- if (sb.st_dev != sb2.st_dev) {
|
||||||
|
- message(MESS_ERROR,
|
||||||
|
- "%s:%d olddir %s and log file %s "
|
||||||
|
- "are on different devices\n", configFile,
|
||||||
|
- lineNum, newlog->oldDir, newlog->files[i]);
|
||||||
|
- goto error;
|
||||||
|
- }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
--
|
||||||
|
1.7.4.1
|
||||||
|
|
||||||
@@ -0,0 +1,42 @@
|
|||||||
|
Update the manual
|
||||||
|
|
||||||
|
* Update the mannual
|
||||||
|
* Fix a bug in the mannual(\f should be \fR)
|
||||||
|
|
||||||
|
Upstream-Status: Pending
|
||||||
|
|
||||||
|
Signed-off-by: Robert Yang <liezhi.yang@windriver.com>
|
||||||
|
---
|
||||||
|
logrotate.8 | 9 ++++-----
|
||||||
|
1 files changed, 4 insertions(+), 5 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/logrotate.8 b/logrotate.8
|
||||||
|
index 8b34167..5f15432 100644
|
||||||
|
--- a/logrotate.8
|
||||||
|
+++ b/logrotate.8
|
||||||
|
@@ -374,10 +374,9 @@ Do not rotate the log if it is empty (this overrides the \fBifempty\fR option).
|
||||||
|
.TP
|
||||||
|
\fBolddir \fIdirectory\fR
|
||||||
|
Logs are moved into \fIdirectory\fR for rotation. The \fIdirectory\fR
|
||||||
|
-must be on the same physical device as the log file being rotated,
|
||||||
|
-and is assumed to be relative to the directory holding the log file
|
||||||
|
-unless an absolute path name is specified. When this option is used all
|
||||||
|
-old versions of the log end up in \fIdirectory\fR. This option may be
|
||||||
|
+is assumed to be relative to the directory holding the log file unless
|
||||||
|
+an absolute path name is specified. When this option is used all old
|
||||||
|
+versions of the log end up in \fIdirectory\fR. This option may be
|
||||||
|
overridden by the \fBnoolddir\fR option.
|
||||||
|
|
||||||
|
.TP
|
||||||
|
@@ -435,7 +434,7 @@ Log files are rotated only if they grow bigger then \fIsize\fR bytes. If
|
||||||
|
\fIsize\fR is followed by \fIk\fR, the size is assumed to be in kilobytes.
|
||||||
|
If the \fIM\fR is used, the size is in megabytes, and if \fIG\fR is used, the
|
||||||
|
size is in gigabytes. So \fBsize 100\fR, \fIsize 100k\fR, \fIsize 100M\fR and
|
||||||
|
-\fIsize 100G\f are all valid.
|
||||||
|
+\fIsize 100G\fR are all valid.
|
||||||
|
|
||||||
|
.TP
|
||||||
|
\fBsharedscripts\fR
|
||||||
|
--
|
||||||
|
1.7.4.1
|
||||||
|
|
||||||
Reference in New Issue
Block a user