diff options
Diffstat (limited to 'meta/recipes-extended/logrotate/logrotate')
4 files changed, 5 insertions, 224 deletions
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 @@ -From 3e2cfa88b6538bb0fee3d9a6e99622055d05ac4a Mon Sep 17 00:00:00 2001 -From: Robert Yang <liezhi.yang@windriver.com> -Date: Tue, 17 Feb 2015 21:14:37 -0800 -Subject: [PATCH] Update the manual - -Update the manual for rotating on different filesystems. - -Upstream-Status: Pending - -Signed-off-by: Robert Yang <liezhi.yang@windriver.com> - ---- - logrotate.8.in | 10 ++++------ - 1 file changed, 4 insertions(+), 6 deletions(-) - -diff --git a/logrotate.8.in b/logrotate.8.in -index 98fea91..70b4c44 100644 ---- a/logrotate.8.in -+++ b/logrotate.8.in -@@ -202,12 +202,10 @@ at all (use with caution, may waste performance and disk space). Default is 0. - - .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, unless \fBcopy\fR, --\fBcopytruncate\fR or \fBrenamecopy\fR option is used. The \fIdirectory\fR --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 -+Logs are moved into \fIdirectory\fR for rotation. The \fIdirectory\fR -+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 --- -2.24.0 - 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 acef5ccbe9..0000000000 --- a/meta/recipes-extended/logrotate/logrotate/act-as-mv-when-rotate.patch +++ /dev/null @@ -1,149 +0,0 @@ -From ef1ea905831c5bcd63e04149571c10d75ff8f028 Mon Sep 17 00:00:00 2001 -From: Robert Yang <liezhi.yang@windriver.com> -Date: Tue, 17 Feb 2015 21:08:07 -0800 -Subject: [PATCH] Act as the "mv" command when rotate log - -Act as the "mv" command when rotate log, first rename, if failed, then -read and write. - -Upstream-Status: Pending - -Signed-off-by: Robert Yang <liezhi.yang@windriver.com> - ---- - logrotate.c | 71 ++++++++++++++++++++++++++++++++++++++++++++--------- - 1 file changed, 59 insertions(+), 12 deletions(-) - -diff --git a/logrotate.c b/logrotate.c -index 25902bc..afa1a90 100644 ---- a/logrotate.c -+++ b/logrotate.c -@@ -1434,6 +1434,53 @@ static int findNeedRotating(struct logInfo *log, int logNum, int force) - return 0; - } - -+/* Act as the "mv" command, if rename failed, then read the old file and -+ * write to new file. The function which invokes the mvFile will use -+ * the strerror(errorno) to handle the error message, so we don't have -+ * to print the error message here */ -+ -+int mvFile (char *oldName, char *newName, struct logInfo *log, acl_type acl) -+{ -+ struct stat sbprev; -+ int fd_old, fd_new, n; -+ char buf[BUFSIZ]; -+ -+ /* Do the rename first */ -+ if (!rename(oldName, newName)) -+ return 0; -+ -+ /* If the errno is EXDEV, then read old file, write newfile and -+ * remove the oldfile */ -+ if (errno == EXDEV) { -+ /* Open the old file to read */ -+ if ((fd_old = open(oldName, O_RDONLY)) < 0) -+ return 1; -+ -+ /* Create the file to write, keep the same attribute as the old file */ -+ if (stat(oldName, &sbprev)) -+ return 1; -+ else { -+ if ((fd_new = createOutputFile(newName, -+ O_WRONLY | O_CREAT | O_TRUNC, &sbprev, acl, 0)) < 0 ) -+ return 1; -+ } -+ -+ /* Read and write */ -+ while ((n = read(fd_old, buf, BUFSIZ)) > 0) -+ if (write(fd_new, buf, n) != n) -+ return 1; -+ -+ if ((close(fd_old) < 0) || -+ removeLogFile(oldName, log) || -+ (close(fd_new) < 0)) -+ return 1; -+ -+ return 0; -+ } -+ -+ return 1; -+} -+ - /* find the rotated file with the highest index */ - static int findLastRotated(const struct logNames *rotNames, - const char *fileext, const char *compext) -@@ -1911,15 +1958,15 @@ static int prerotateSingleLog(struct logInfo *log, int logNum, - } - - message(MESS_DEBUG, -- "renaming %s to %s (rotatecount %d, logstart %d, i %d), \n", -+ "moving %s to %s (rotatecount %d, logstart %d, i %d), \n", - oldName, newName, rotateCount, logStart, i); - -- if (!debug && rename(oldName, newName)) { -+ if (!debug && mvFile(oldName, newName, log, prev_acl)) { - if (errno == ENOENT) { - message(MESS_DEBUG, "old log %s does not exist\n", - oldName); - } else { -- message(MESS_ERROR, "error renaming %s to %s: %s\n", -+ message(MESS_ERROR, "error moving %s to %s: %s\n", - oldName, newName, strerror(errno)); - hasErrors = 1; - } -@@ -2002,10 +2049,10 @@ static int rotateSingleLog(struct logInfo *log, int logNum, - return 1; - } - -- message(MESS_DEBUG, "renaming %s to %s\n", log->files[logNum], -+ message(MESS_DEBUG, "moving %s to %s\n", log->files[logNum], - tmpFilename); -- if (!debug && !hasErrors && rename(log->files[logNum], tmpFilename)) { -- message(MESS_ERROR, "failed to rename %s to %s: %s\n", -+ if (!debug && !hasErrors && mvFile(log->files[logNum], rotNames->finalName, log, prev_acl)) { -+ message(MESS_ERROR, "failed to move %s to %s: %s\n", - log->files[logNum], tmpFilename, - strerror(errno)); - hasErrors = 1; -@@ -2014,11 +2061,11 @@ static int rotateSingleLog(struct logInfo *log, int logNum, - free(tmpFilename); - } - else { -- message(MESS_DEBUG, "renaming %s to %s\n", log->files[logNum], -+ message(MESS_DEBUG, "moving %s to %s\n", log->files[logNum], - rotNames->finalName); - if (!debug && !hasErrors && -- rename(log->files[logNum], rotNames->finalName)) { -- message(MESS_ERROR, "failed to rename %s to %s: %s\n", -+ mvFile(log->files[logNum], rotNames->finalName, log, prev_acl)) { -+ message(MESS_ERROR, "failed to move %s to %s: %s\n", - log->files[logNum], rotNames->finalName, - strerror(errno)); - hasErrors = 1; -@@ -2424,7 +2471,7 @@ static int rotateLogSet(struct logInfo *log, int force) - return hasErrors; - } - --static int writeState(const char *stateFilename) -+static int writeState(struct logInfo *log, char *stateFilename) - { - struct logState *p; - FILE *f; -@@ -2629,7 +2676,7 @@ static int writeState(const char *stateFilename) - fclose(f); - - if (error == 0) { -- if (rename(tmpFilename, stateFilename)) { -+ if (mvFile(tmpFilename, stateFilename, log, prev_acl)) { - unlink(tmpFilename); - error = 1; - message(MESS_ERROR, "error renaming temp state file %s to %s\n", -@@ -2987,7 +3034,7 @@ int main(int argc, const char **argv) - rc |= rotateLogSet(log, force); - - if (!debug) -- rc |= writeState(stateFile); -+ rc |= writeState(log, stateFile); - - return (rc != 0); - } 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 9ba531f815..0000000000 --- a/meta/recipes-extended/logrotate/logrotate/disable-check-different-filesystems.patch +++ /dev/null @@ -1,36 +0,0 @@ -From a3fdf3dbdd6ecc0f2550a765dcb9bb274bce8ea8 Mon Sep 17 00:00:00 2001 -From: Robert Yang <liezhi.yang@windriver.com> -Date: Tue, 8 Jan 2019 06:27:06 +0000 -Subject: [PATCH] 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 | 9 --------- - 1 file changed, 9 deletions(-) - -diff --git a/config.c b/config.c -index f027c7e..026136c 100644 ---- a/config.c -+++ b/config.c -@@ -1873,15 +1873,6 @@ duperror: - } - - free(ld); -- -- if (sb.st_dev != sb2.st_dev -- && !(newlog->flags & (LOG_FLAG_COPYTRUNCATE | LOG_FLAG_COPY | LOG_FLAG_TMPFILENAME))) { -- 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/meta/recipes-extended/logrotate/logrotate/run-ptest b/meta/recipes-extended/logrotate/logrotate/run-ptest new file mode 100755 index 0000000000..b272def65f --- /dev/null +++ b/meta/recipes-extended/logrotate/logrotate/run-ptest @@ -0,0 +1,5 @@ +#!/bin/sh + +set -u + +make -k check |