This commit is contained in:
parent
54576b2005
commit
f5d52c0cd9
@ -1,11 +0,0 @@
|
||||
--- logrotate-3.7.5/config.c.cfengine 2007-05-14 14:18:44.000000000 +0200
|
||||
+++ logrotate-3.7.5/config.c 2007-05-14 14:19:06.000000000 +0200
|
||||
@@ -31,7 +31,7 @@
|
||||
#endif
|
||||
|
||||
static char *defTabooExts[] = { ".rpmsave", ".rpmorig", "~", ",v",
|
||||
- ".rpmnew", ".swp"
|
||||
+ ".rpmnew", ".swp", ".cfsaved"
|
||||
};
|
||||
static int defTabooCount = sizeof(defTabooExts) / sizeof(char *);
|
||||
|
@ -1,12 +0,0 @@
|
||||
--- logrotate-3.7.5/examples/logrotate-default.date 2007-05-16 16:36:06.000000000 +0200
|
||||
+++ logrotate-3.7.5/examples/logrotate-default 2007-05-16 16:36:50.000000000 +0200
|
||||
@@ -8,6 +8,9 @@
|
||||
# create new (empty) log files after rotating old ones
|
||||
create
|
||||
|
||||
+# use date as a suffix of rotated file
|
||||
+dateext
|
||||
+
|
||||
# uncomment this if you want your log files compressed
|
||||
#compress
|
||||
|
@ -1,155 +0,0 @@
|
||||
--- logrotate-3.7.5/logrotate.c.errorHandling 2007-03-01 12:05:30.000000000 +0100
|
||||
+++ logrotate-3.7.5/logrotate.c 2007-03-31 12:50:33.000000000 +0200
|
||||
@@ -1043,6 +1043,8 @@
|
||||
message(MESS_ERROR, "error running first action script "
|
||||
"for %s\n", log->pattern);
|
||||
hasErrors = 1;
|
||||
+ /* finish early, firstaction failed, affects all logs in set */
|
||||
+ return hasErrors;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1067,16 +1069,25 @@
|
||||
hasErrors |= logHasErrors[i];
|
||||
}
|
||||
|
||||
- if (log->pre) {
|
||||
+ if (log->pre
|
||||
+ && (! ( (logHasErrors[j] && !(log->flags & LOG_FLAG_SHAREDSCRIPTS))
|
||||
+ || (hasErrors && (log->flags & LOG_FLAG_SHAREDSCRIPTS)) ) )) {
|
||||
if (!numRotated) {
|
||||
message(MESS_DEBUG, "not running prerotate script, "
|
||||
"since no logs will be rotated\n");
|
||||
} else {
|
||||
message(MESS_DEBUG, "running prerotate script\n");
|
||||
if (runScript(log->pattern, log->pre)) {
|
||||
- message(MESS_ERROR,
|
||||
- "error running shared prerotate script "
|
||||
- "for %s\n", log->pattern);
|
||||
+ if (log->flags & LOG_FLAG_SHAREDSCRIPTS)
|
||||
+ message(MESS_ERROR,
|
||||
+ "error running shared prerotate script "
|
||||
+ "for '%s'\n", log->pattern);
|
||||
+ else {
|
||||
+ message(MESS_ERROR,
|
||||
+ "error running non-shared prerotate script "
|
||||
+ "for %s of '%s'\n", log->files[j], log->pattern);
|
||||
+ }
|
||||
+ logHasErrors[j] = 1;
|
||||
hasErrors = 1;
|
||||
}
|
||||
}
|
||||
@@ -1085,22 +1096,33 @@
|
||||
for (i = j;
|
||||
((log->flags & LOG_FLAG_SHAREDSCRIPTS) && i < log->numFiles)
|
||||
|| (!(log->flags & LOG_FLAG_SHAREDSCRIPTS) && i == j); i++) {
|
||||
- if (!logHasErrors[i]) {
|
||||
+ if (! ( (logHasErrors[i] && !(log->flags & LOG_FLAG_SHAREDSCRIPTS))
|
||||
+ || (hasErrors && (log->flags & LOG_FLAG_SHAREDSCRIPTS)) ) ) {
|
||||
logHasErrors[i] |=
|
||||
rotateSingleLog(log, i, state[i], rotNames[i]);
|
||||
hasErrors |= logHasErrors[i];
|
||||
}
|
||||
}
|
||||
|
||||
- if (log->post) {
|
||||
+ if (log->post
|
||||
+ && (! ( (logHasErrors[j] && !(log->flags & LOG_FLAG_SHAREDSCRIPTS))
|
||||
+ || (hasErrors && (log->flags & LOG_FLAG_SHAREDSCRIPTS)) ) )) {
|
||||
if (!numRotated) {
|
||||
message(MESS_DEBUG, "not running postrotate script, "
|
||||
"since no logs were rotated\n");
|
||||
} else {
|
||||
message(MESS_DEBUG, "running postrotate script\n");
|
||||
if (runScript(log->pattern, log->post)) {
|
||||
- message(MESS_ERROR, "error running postrotate script "
|
||||
- "for %s\n", log->pattern);
|
||||
+ if (log->flags & LOG_FLAG_SHAREDSCRIPTS)
|
||||
+ message(MESS_ERROR,
|
||||
+ "error running shared postrotate script "
|
||||
+ "for '%s'\n", log->pattern);
|
||||
+ else {
|
||||
+ message(MESS_ERROR,
|
||||
+ "error running non-shared postrotate script "
|
||||
+ "for %s of '%s'\n", log->files[j], log->pattern);
|
||||
+ }
|
||||
+ logHasErrors[j] = 1;
|
||||
hasErrors = 1;
|
||||
}
|
||||
}
|
||||
@@ -1109,7 +1131,8 @@
|
||||
for (i = j;
|
||||
((log->flags & LOG_FLAG_SHAREDSCRIPTS) && i < log->numFiles)
|
||||
|| (!(log->flags & LOG_FLAG_SHAREDSCRIPTS) && i == j); i++) {
|
||||
- if (!logHasErrors[i]) {
|
||||
+ if (! ( (logHasErrors[i] && !(log->flags & LOG_FLAG_SHAREDSCRIPTS))
|
||||
+ || (hasErrors && (log->flags & LOG_FLAG_SHAREDSCRIPTS)) ) ) {
|
||||
logHasErrors[i] |=
|
||||
postrotateSingleLog(log, i, state[i], rotNames[i]);
|
||||
hasErrors |= logHasErrors[i];
|
||||
--- logrotate-3.7.5/logrotate.8.errorHandling 2006-05-17 16:46:51.000000000 +0200
|
||||
+++ logrotate-3.7.5/logrotate.8 2007-03-31 12:37:06.000000000 +0200
|
||||
@@ -326,7 +326,8 @@
|
||||
\fBnosharedscripts\fR
|
||||
Run \fBprerotate\fR and \fBpostrotate\fR scripts for every log file which
|
||||
is rotated (this is the default, and overrides the \fBsharedscripts\fR
|
||||
-option).
|
||||
+option). If the scripts exit with error, the remaining actions will
|
||||
+not be executed for the affected log only.
|
||||
|
||||
.TP
|
||||
\fBnotifempty\fR
|
||||
@@ -346,7 +347,8 @@
|
||||
The lines between \fBpostrotate\fR and \fBendscript\fR (both of which
|
||||
must appear on lines by themselves) are executed after the log file is
|
||||
rotated. These directives may only appear inside of a log file definition.
|
||||
-See \fBprerotate\fR as well.
|
||||
+See \fBprerotate\fR as well. See \fBsharedscripts\fR and
|
||||
+\fBnosharedscripts\fR for error handling.
|
||||
|
||||
.TP
|
||||
\fBprerotate\fR/\fBendscript\fR
|
||||
@@ -354,7 +356,8 @@
|
||||
must appear on lines by themselves) are executed before the log file is
|
||||
rotated and only if the log will actually be rotated. These directives
|
||||
may only appear inside of a log file definition. See \fBpostrotate\fR
|
||||
-as well.
|
||||
+as well. See \fBsharedscripts\fR and \fBnosharedscripts\fR for error
|
||||
+handling.
|
||||
|
||||
.TP
|
||||
\fBfirstaction\fR/\fBendscript\fR
|
||||
@@ -362,7 +365,8 @@
|
||||
must appear on lines by themselves) are executed once before all log
|
||||
files that match the wildcarded pattern are rotated, before prerotate script
|
||||
is run and only if at least one log will actually be rotated. These directives
|
||||
-may only appear inside of a log file definition. See \fBlastaction\fR as well.
|
||||
+may only appear inside of a log file definition. If the script exits
|
||||
+with error, no further processing is done. See \fBlastaction\fR as well.
|
||||
|
||||
.TP
|
||||
\fBlastaction\fR/\fBendscript\fR
|
||||
@@ -370,7 +374,9 @@
|
||||
must appear on lines by themselves) are executed once after all log
|
||||
files that match the wildcarded pattern are rotated, after postrotate script
|
||||
is run and only if at least one log is rotated. These directives may only
|
||||
-appear inside of a log file definition. See \fBfirstaction\fR as well.
|
||||
+appear inside of a log file definition. If the script exits with
|
||||
+error, just an error message is shown (as this is the last
|
||||
+action). See \fBfirstaction\fR as well.
|
||||
|
||||
.TP
|
||||
\fBrotate \fIcount\fR
|
||||
@@ -393,8 +399,10 @@
|
||||
/var/log/news/* example). If \fBsharedscript\fR is specified, the scripts
|
||||
are only run once, no matter how many logs match the wildcarded pattern.
|
||||
However, if none of the logs in the pattern require rotating, the scripts
|
||||
-will not be run at all. This option overrides the \fBnosharedscripts\fR
|
||||
-option and implies \fBcreate\fR option.
|
||||
+will not be run at all. If the scripts exit with error, the remaining
|
||||
+actions will not be executed for any logs. This option overrides the
|
||||
+\fBnosharedscripts\fR option and implies \fBcreate\fR option.
|
||||
+
|
||||
|
||||
.TP
|
||||
\fBstart \fIcount\fR
|
@ -1,11 +0,0 @@
|
||||
--- logrotate-3.7.5/logrotate.c.logfn 2007-05-30 14:52:21.000000000 +0200
|
||||
+++ logrotate-3.7.5/logrotate.c 2007-05-30 14:53:08.000000000 +0200
|
||||
@@ -151,7 +151,7 @@
|
||||
}
|
||||
|
||||
if (!fork()) {
|
||||
- execl("/bin/sh", "sh", "-c", script, NULL);
|
||||
+ execl("/bin/sh", "sh", "-c", script, script, logfn, NULL);
|
||||
exit(1);
|
||||
}
|
||||
|
@ -1,201 +0,0 @@
|
||||
--- logrotate-3.7.5/logrotate.h.shred 2007-05-14 09:25:50.000000000 +0200
|
||||
+++ logrotate-3.7.5/logrotate.h 2007-05-14 10:27:48.000000000 +0200
|
||||
@@ -16,6 +16,7 @@
|
||||
#define LOG_FLAG_SHAREDSCRIPTS (1 << 7)
|
||||
#define LOG_FLAG_COPY (1 << 8)
|
||||
#define LOG_FLAG_DATEEXT (1 << 9)
|
||||
+#define LOG_FLAG_SHRED (1 << 10)
|
||||
|
||||
#define NO_MODE ((mode_t) -1)
|
||||
#define NO_UID ((uid_t) -1)
|
||||
@@ -44,6 +45,7 @@
|
||||
char *uncompress_prog;
|
||||
char *compress_ext;
|
||||
int flags;
|
||||
+ int shred_cycles; /* if !=0, pass -n shred_cycles to GNU shred */
|
||||
mode_t createMode; /* if any/all of these are -1, we use the */
|
||||
uid_t createUid; /* attributes from the log file just rotated */
|
||||
gid_t createGid;
|
||||
--- logrotate-3.7.5/logrotate.c.shred 2007-05-14 09:25:30.000000000 +0200
|
||||
+++ logrotate-3.7.5/logrotate.c 2007-05-14 10:35:41.000000000 +0200
|
||||
@@ -53,6 +53,8 @@
|
||||
char *mailCommand = DEFAULT_MAIL_COMMAND;
|
||||
time_t nowSecs = 0;
|
||||
|
||||
+static int shred_file(char * filename, logInfo *log);
|
||||
+
|
||||
static int globerr(const char *pathname, int theerr)
|
||||
{
|
||||
message(MESS_ERROR, "error accessing %s: %s\n", pathname,
|
||||
@@ -188,11 +190,54 @@
|
||||
return fd;
|
||||
}
|
||||
|
||||
-static int removeLogFile(char *name)
|
||||
+#define SHRED_CALL "shred -u "
|
||||
+#define SHRED_COUNT_FLAG "-n "
|
||||
+#define DIGITS 10
|
||||
+/* unlink, but try to call shred from GNU fileutils */
|
||||
+static int shred_file(char * filename, logInfo *log)
|
||||
+{
|
||||
+ int len, ret;
|
||||
+ char *cmd;
|
||||
+ char count[DIGITS]; /* that's a lot of shredding :) */
|
||||
+
|
||||
+ if (!(log->flags & LOG_FLAG_SHRED)) {
|
||||
+ return unlink(filename);
|
||||
+ }
|
||||
+
|
||||
+ len = strlen(filename) + strlen(SHRED_CALL);
|
||||
+ len += strlen(SHRED_COUNT_FLAG) + DIGITS;
|
||||
+ cmd = malloc(len);
|
||||
+
|
||||
+ if (!cmd) {
|
||||
+ message(MESS_ERROR, "malloc error while shredding");
|
||||
+ return unlink(filename);
|
||||
+ }
|
||||
+ strcpy(cmd, SHRED_CALL);
|
||||
+ if (log->shred_cycles != 0) {
|
||||
+ strcat(cmd, SHRED_COUNT_FLAG);
|
||||
+ snprintf(count, DIGITS - 1, "%d", log->shred_cycles);
|
||||
+ strcat(count, " ");
|
||||
+ strcat(cmd, count);
|
||||
+ }
|
||||
+ strcat(cmd, filename);
|
||||
+ ret = system(cmd);
|
||||
+ free(cmd);
|
||||
+ if (ret != 0) {
|
||||
+ message(MESS_ERROR, "Failed to shred %s\n, trying unlink", filename);
|
||||
+ if (ret != -1) {
|
||||
+ message(MESS_NORMAL, "Shred returned %d\n", ret);
|
||||
+ }
|
||||
+ return unlink(filename);
|
||||
+ } else {
|
||||
+ return ret;
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
+static int removeLogFile(char *name, logInfo *log)
|
||||
{
|
||||
message(MESS_DEBUG, "removing old log %s\n", name);
|
||||
|
||||
- if (!debug && unlink(name)) {
|
||||
+ if (!debug && shred_file(name, log)) {
|
||||
message(MESS_ERROR, "Failed to remove old log %s: %s\n",
|
||||
name, strerror(errno));
|
||||
return 1;
|
||||
@@ -255,7 +300,7 @@
|
||||
return 1;
|
||||
}
|
||||
|
||||
- unlink(name);
|
||||
+ shred_file(name, log);
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -697,7 +742,7 @@
|
||||
mailCommand, logNum,
|
||||
log);
|
||||
if (!hasErrors)
|
||||
- hasErrors = removeLogFile(mailFilename);
|
||||
+ hasErrors = removeLogFile(mailFilename, log);
|
||||
}
|
||||
mail_out = i;
|
||||
}
|
||||
@@ -737,7 +782,7 @@
|
||||
mailLogWrapper(mailFilename, mailCommand,
|
||||
logNum, log);
|
||||
if (!hasErrors)
|
||||
- hasErrors = removeLogFile(mailFilename);
|
||||
+ hasErrors = removeLogFile(mailFilename, log);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -954,7 +999,7 @@
|
||||
}
|
||||
|
||||
if (!hasErrors && rotNames->disposeName)
|
||||
- hasErrors = removeLogFile(rotNames->disposeName);
|
||||
+ hasErrors = removeLogFile(rotNames->disposeName, log);
|
||||
|
||||
#ifdef WITH_SELINUX
|
||||
if (selinux_enabled) {
|
||||
--- logrotate-3.7.5/logrotate.8.shred 2007-05-14 09:26:02.000000000 +0200
|
||||
+++ logrotate-3.7.5/logrotate.8 2007-05-14 10:42:16.000000000 +0200
|
||||
@@ -330,6 +330,10 @@
|
||||
not be executed for the affected log only.
|
||||
|
||||
.TP
|
||||
+\fBnoshred\fR
|
||||
+Do not use \fBshred\fR when deleting old log files. See also \fBshred\fR.
|
||||
+
|
||||
+.TP
|
||||
\fBnotifempty\fR
|
||||
Do not rotate the log if it is empty (this overrides the \fBifempty\fR option).
|
||||
|
||||
@@ -403,6 +407,16 @@
|
||||
actions will not be executed for any logs. This option overrides the
|
||||
\fBnosharedscripts\fR option and implies \fBcreate\fR option.
|
||||
|
||||
+.TP
|
||||
+\fBshred\fR
|
||||
+Delete log files using \fBshred\fR -u instead of unlink(). This should
|
||||
+ensure that logs are not readable after their scheduled deletion; this is
|
||||
+off by default. See also \fBnoshred\fR.
|
||||
+
|
||||
+.TP
|
||||
+\fBshredcycles\fR \fIcount\fR
|
||||
+Asks GNU \fBshred\fR to overwite log files \fBcount\fR times before
|
||||
+deletion. Without this option, \fBshred\fR's default will be used.
|
||||
|
||||
.TP
|
||||
\fBstart \fIcount\fR
|
||||
--- logrotate-3.7.5/config.c.shred 2007-05-14 09:26:42.000000000 +0200
|
||||
+++ logrotate-3.7.5/config.c 2007-05-14 10:32:37.000000000 +0200
|
||||
@@ -432,6 +432,7 @@
|
||||
/* uncompress_prog */ NULL,
|
||||
/* compress_ext */ NULL,
|
||||
/* flags */ LOG_FLAG_IFEMPTY,
|
||||
+ /* shred_cycles */ 0,
|
||||
/* createMode/Uid/Gid */ NO_MODE, NO_UID, NO_GID,
|
||||
/* compress_options_list/count */ NULL, 0
|
||||
};
|
||||
@@ -638,6 +639,14 @@
|
||||
newlog->flags &= ~LOG_FLAG_DELAYCOMPRESS;
|
||||
|
||||
*endtag = oldchar, start = endtag;
|
||||
+ } else if (!strcmp(start, "shred")) {
|
||||
+ newlog->flags |= LOG_FLAG_SHRED;
|
||||
+
|
||||
+ *endtag = oldchar, start = endtag;
|
||||
+ } else if (!strcmp(start, "noshred")) {
|
||||
+ newlog->flags &= ~LOG_FLAG_SHRED;
|
||||
+
|
||||
+ *endtag = oldchar, start = endtag;
|
||||
} else if (!strcmp(start, "sharedscripts")) {
|
||||
newlog->flags |= LOG_FLAG_SHAREDSCRIPTS;
|
||||
|
||||
@@ -833,7 +842,22 @@
|
||||
*endtag = oldchar, start = endtag;
|
||||
}
|
||||
#endif
|
||||
- } else if (!strcmp(start, "daily")) {
|
||||
+ } else if (!strcmp(start, "shredcycles")) {
|
||||
+ *endtag = oldchar, start = endtag;
|
||||
+
|
||||
+ if (!isolateValue(configFile, lineNum, "shred cycles",
|
||||
+ &start, &endtag)) {
|
||||
+ oldchar = *endtag, *endtag = '\0';
|
||||
+
|
||||
+ newlog->shred_cycles = strtoul(start, &chptr, 0);
|
||||
+ if (*chptr || newlog->shred_cycles < 0) {
|
||||
+ message(MESS_ERROR, "%s:%d bad shred cycles '%s'\n",
|
||||
+ configFile, lineNum, start);
|
||||
+ return 1;
|
||||
+ }
|
||||
+ *endtag = oldchar, start = endtag;
|
||||
+ }
|
||||
+ } else if (!strcmp(start, "daily")) {
|
||||
*endtag = oldchar, start = endtag;
|
||||
|
||||
newlog->criterium = ROT_DAYS;
|
@ -1,3 +0,0 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:8f3df579874bdb2b44bfb72b5b2b2ce257f24de6ffda302693d13e24f0224d3e
|
||||
size 35302
|
@ -1,6 +1,6 @@
|
||||
--- config.c
|
||||
+++ config.c
|
||||
@@ -301,6 +301,7 @@
|
||||
--- ./config.c.orig 2008-09-02 17:28:52.000000000 +0200
|
||||
+++ ./config.c 2008-09-02 17:29:59.000000000 +0200
|
||||
@@ -434,6 +434,7 @@ int readAllConfigPaths(const char **path
|
||||
/* first, last */ NULL, NULL,
|
||||
/* logAddress */ NULL,
|
||||
/* extension */ NULL,
|
||||
@ -8,13 +8,15 @@
|
||||
/* compress_prog */ NULL,
|
||||
/* uncompress_prog */ NULL,
|
||||
/* compress_ext */ NULL,
|
||||
@@ -876,6 +877,22 @@
|
||||
@@ -1151,6 +1152,24 @@ static int readConfigFile(const char *co
|
||||
message(MESS_DEBUG, "extension is now %s\n",
|
||||
newlog->extension);
|
||||
|
||||
+ } else if (!strcmp(start, "addextension")) {
|
||||
+ *endtag = oldchar, start = endtag;
|
||||
+
|
||||
+ freeLogItem (addextension);
|
||||
+
|
||||
+ if (!isolateValue
|
||||
+ (configFile, lineNum, "addextension name", &start,
|
||||
+ &endtag)) {
|
||||
@ -30,10 +32,20 @@
|
||||
+
|
||||
} else if (!strcmp(start, "compresscmd")) {
|
||||
*endtag = oldchar, start = endtag;
|
||||
if (!
|
||||
--- logrotate.8
|
||||
+++ logrotate.8
|
||||
@@ -142,6 +142,15 @@
|
||||
|
||||
--- ./logrotate.h.orig 2008-09-02 17:28:52.000000000 +0200
|
||||
+++ ./logrotate.h 2008-09-02 17:29:59.000000000 +0200
|
||||
@@ -41,6 +41,7 @@ struct logInfo {
|
||||
char *pre, *post, *first, *last;
|
||||
char *logAddress;
|
||||
char *extension;
|
||||
+ char *addextension;
|
||||
char *compress_prog;
|
||||
char *uncompress_prog;
|
||||
char *compress_ext;
|
||||
--- ./logrotate.8.orig 2008-09-02 17:28:52.000000000 +0200
|
||||
+++ ./logrotate.8 2008-09-02 17:29:59.000000000 +0200
|
||||
@@ -142,6 +142,15 @@ Here is more information on the directiv
|
||||
a \fBlogrotate\fR configuration file:
|
||||
|
||||
.TP
|
||||
@ -49,70 +61,41 @@
|
||||
\fBcompress\fR
|
||||
Old versions of log files are compressed with \fBgzip\fR by default. See also
|
||||
\fBnocompress\fR.
|
||||
--- logrotate.c
|
||||
+++ logrotate.c
|
||||
@@ -99,6 +99,7 @@
|
||||
freeLogItem(last);
|
||||
freeLogItem(logAddress);
|
||||
freeLogItem(extension);
|
||||
+ freeLogItem(addextension);
|
||||
freeLogItem(compress_prog);
|
||||
freeLogItem(uncompress_prog);
|
||||
freeLogItem(compress_ext);
|
||||
@@ -591,6 +592,25 @@
|
||||
--- ./logrotate.c.orig 2008-09-02 17:28:52.000000000 +0200
|
||||
+++ ./logrotate.c 2008-09-02 17:29:59.000000000 +0200
|
||||
@@ -618,6 +618,24 @@ int prerotateSingleLog(struct logInfo *l
|
||||
|
||||
rotNames->baseName = strdup(ourBaseName(log->files[logNum]));
|
||||
|
||||
+ if (log->addextension) {
|
||||
+ size_t baseLen = strlen(rotNames->baseName);
|
||||
+ size_t baseLen = strlen(rotNames->baseName);
|
||||
+ size_t extLen = strlen(log->addextension);
|
||||
+ if (baseLen >= extLen &&
|
||||
+ strncmp(&(rotNames->baseName[baseLen - extLen]),
|
||||
+ log->addextension, extLen) == 0) {
|
||||
+ char *tempstr;
|
||||
+ log->addextension, extLen) == 0) {
|
||||
+ char *tempstr;
|
||||
+
|
||||
+ fileext = log->addextension;
|
||||
+ tempstr = calloc(baseLen - extLen + 1, sizeof(char));
|
||||
+ strncat(tempstr, rotNames->baseName, baseLen - extLen);
|
||||
+ free(rotNames->baseName);
|
||||
+ rotNames->baseName = tempstr;
|
||||
+ fileext = log->addextension;
|
||||
+ tempstr = calloc(baseLen - extLen + 1, sizeof(char));
|
||||
+ strncat(tempstr, rotNames->baseName, baseLen - extLen);
|
||||
+ free(rotNames->baseName);
|
||||
+ rotNames->baseName = tempstr;
|
||||
+ } else {
|
||||
+ fileext = log->addextension;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+
|
||||
alloc_size = strlen(rotNames->dirName) + strlen(rotNames->baseName) +
|
||||
strlen(log->files[logNum]) + strlen(fileext) +
|
||||
strlen(compext) + 18;
|
||||
--- logrotate.h
|
||||
+++ logrotate.h
|
||||
@@ -40,6 +40,7 @@
|
||||
char *pre, *post, *first, *last;
|
||||
char *logAddress;
|
||||
char *extension;
|
||||
+ char *addextension;
|
||||
char *compress_prog;
|
||||
char *uncompress_prog;
|
||||
char *compress_ext;
|
||||
--- test/test
|
||||
+++ test/test
|
||||
@@ -354,4 +354,26 @@
|
||||
oldName = alloca(PATH_MAX);
|
||||
newName = alloca(PATH_MAX);
|
||||
rotNames->disposeName = malloc(PATH_MAX);
|
||||
--- test/test.orig 2008-09-03 10:25:58.000000000 +0200
|
||||
+++ test/test 2008-09-03 10:27:06.000000000 +0200
|
||||
@@ -369,4 +369,27 @@
|
||||
EOF
|
||||
|
||||
rm -rf testdir
|
||||
|
||||
+
|
||||
+# check rotation with extension appended to the filename
|
||||
+cleanup 14
|
||||
+
|
||||
+preptest test.log 14 1 0
|
||||
+$RLR test-config.14 --force
|
||||
+
|
||||
+checkoutput <<EOF
|
||||
+test.log 0
|
||||
+test.log.1.newext 0 zero
|
||||
+EOF
|
||||
+
|
||||
+# check rotation with extension moved after the number
|
||||
+cleanup 15
|
||||
+
|
||||
+preptest test.log 15 1 0
|
||||
@ -120,23 +103,24 @@
|
||||
+
|
||||
+checkoutput <<EOF
|
||||
+test.log 0
|
||||
+test.log.1.newext 0 zero
|
||||
+EOF
|
||||
+
|
||||
+# check rotation with extension moved after the number
|
||||
+cleanup 16
|
||||
+
|
||||
+preptest test.log 16 1 0
|
||||
+$RLR test-config.16 --force
|
||||
+
|
||||
+checkoutput <<EOF
|
||||
+test.log 0
|
||||
+test.1.log 0 zero
|
||||
+EOF
|
||||
+
|
||||
cleanup
|
||||
--- test/test-config.14.in
|
||||
+++ test/test-config.14.in
|
||||
@@ -0,0 +1,7 @@
|
||||
+create
|
||||
+
|
||||
+&DIR&/test.log {
|
||||
+ monthly
|
||||
+ rotate 1
|
||||
+ addextension .newext
|
||||
+}
|
||||
--- test/test-config.15.in
|
||||
+++ test/test-config.15.in
|
||||
@@ -0,0 +1,7 @@
|
||||
--- test/test-config.16.in.orig 2008-09-03 10:27:59.000000000 +0200
|
||||
+++ test/test-config.16.in 2008-09-03 10:28:23.000000000 +0200
|
||||
@@ -0,0 +1,8 @@
|
||||
+create
|
||||
+
|
||||
+&DIR&/test.log {
|
||||
@ -144,3 +128,15 @@
|
||||
+ rotate 1
|
||||
+ addextension .log
|
||||
+}
|
||||
+
|
||||
--- test/test-config.15.in.orig 2008-09-03 10:27:59.000000000 +0200
|
||||
+++ test/test-config.15.in 2008-09-03 10:28:23.000000000 +0200
|
||||
@@ -0,0 +1,8 @@
|
||||
+create
|
||||
+
|
||||
+&DIR&/test.log {
|
||||
+ monthly
|
||||
+ rotate 1
|
||||
+ addextension .newext
|
||||
+}
|
||||
+
|
@ -1,15 +1,15 @@
|
||||
--- config.c
|
||||
+++ config.c
|
||||
@@ -343,7 +343,7 @@
|
||||
logInfo ** logsPtr, int *numLogsPtr)
|
||||
--- ./config.c.orig 2008-05-09 09:28:59.000000000 +0200
|
||||
+++ ./config.c 2008-08-22 16:21:35.000000000 +0200
|
||||
@@ -485,7 +485,7 @@
|
||||
static int readConfigFile(const char *configFile, struct logInfo *defConfig)
|
||||
{
|
||||
int fd;
|
||||
- char *buf, *endtag;
|
||||
+ char *buf, *endtag, *compresscmd_base;
|
||||
char oldchar, foo;
|
||||
int length;
|
||||
off_t length;
|
||||
int lineNum = 1;
|
||||
@@ -889,6 +889,18 @@
|
||||
@@ -1182,6 +1182,18 @@
|
||||
message(MESS_DEBUG, "compress_prog is now %s\n",
|
||||
newlog->compress_prog);
|
||||
|
||||
@ -27,11 +27,23 @@
|
||||
+ }
|
||||
} else if (!strcmp(start, "uncompresscmd")) {
|
||||
*endtag = oldchar, start = endtag;
|
||||
if (!
|
||||
--- logrotate.c
|
||||
+++ logrotate.c
|
||||
@@ -50,6 +50,15 @@
|
||||
|
||||
--- ./logrotate.h.orig 2008-05-09 09:28:59.000000000 +0200
|
||||
+++ ./logrotate.h 2008-08-22 16:38:13.000000000 +0200
|
||||
@@ -61,6 +61,9 @@
|
||||
extern int numLogs;
|
||||
extern int debug;
|
||||
|
||||
+/* This is the definition. Note we have to carry the "2" within the declaration (logrotate.c), too! */
|
||||
+extern const char * compress_cmd_list[][2];
|
||||
+
|
||||
int readAllConfigPaths(const char **paths);
|
||||
|
||||
#endif
|
||||
--- ./logrotate.c.orig 2008-05-14 12:31:35.000000000 +0200
|
||||
+++ ./logrotate.c 2008-08-22 16:21:35.000000000 +0200
|
||||
@@ -51,6 +51,15 @@
|
||||
int numLogs = 0;
|
||||
int debug = 0;
|
||||
char *mailCommand = DEFAULT_MAIL_COMMAND;
|
||||
+/* This is the declaration. Note the "2" is needed in the definition (logrotate.h), too! */
|
||||
@ -45,8 +57,8 @@
|
||||
+
|
||||
time_t nowSecs = 0;
|
||||
|
||||
static int globerr(const char *pathname, int theerr)
|
||||
@@ -263,7 +272,7 @@
|
||||
static int shred_file(char *filename, struct logInfo *log);
|
||||
@@ -278,7 +287,7 @@
|
||||
char *uncompressCommand, char *address, char *subject)
|
||||
{
|
||||
int mailInput;
|
||||
@ -55,15 +67,3 @@
|
||||
int mailStatus, uncompressStatus;
|
||||
int uncompressPipe[2];
|
||||
char *mailArgv[] = { mailCommand, "-s", subject, address, NULL };
|
||||
--- logrotate.h
|
||||
+++ logrotate.h
|
||||
@@ -51,6 +51,9 @@
|
||||
int compress_options_count;
|
||||
} logInfo;
|
||||
|
||||
+/* This is the definition. Note we have to carry the "2" within the declaration (logrotate.c), too! */
|
||||
+extern const char * compress_cmd_list[][2];
|
||||
+
|
||||
int readAllConfigPaths(const char **paths, logInfo ** logsPtr,
|
||||
int *numLogsPtr);
|
||||
|
57
logrotate-3.7.7-conf.patch
Normal file
57
logrotate-3.7.7-conf.patch
Normal file
@ -0,0 +1,57 @@
|
||||
--- ./examples/logrotate-default.orig 2007-08-29 09:19:36.000000000 +0200
|
||||
+++ ./examples/logrotate-default 2008-08-22 16:10:24.000000000 +0200
|
||||
@@ -17,19 +17,27 @@
|
||||
# RPM packages drop log rotation information into this directory
|
||||
include /etc/logrotate.d
|
||||
|
||||
-# no packages own wtmp and btmp -- we'll rotate them here
|
||||
-/var/log/wtmp {
|
||||
- monthly
|
||||
- create 0664 root utmp
|
||||
- minsize 1M
|
||||
- rotate 1
|
||||
-}
|
||||
+# comment these to switch compression to use gzip or another
|
||||
+# compression scheme
|
||||
+compresscmd /usr/bin/bzip2
|
||||
+uncompresscmd /usr/bin/bunzip2
|
||||
+
|
||||
+# former versions had to have the compressext set accordingly
|
||||
+#compressext .bz2
|
||||
|
||||
-/var/log/btmp {
|
||||
- missingok
|
||||
- monthly
|
||||
- create 0600 root utmp
|
||||
- rotate 1
|
||||
-}
|
||||
+# no packages own wtmp and btmp -- we'll rotate them here
|
||||
+#/var/log/wtmp {
|
||||
+# monthly
|
||||
+# create 0664 root utmp
|
||||
+# minsize 1M
|
||||
+# rotate 1
|
||||
+#}
|
||||
+#
|
||||
+# /var/log/btmp {
|
||||
+# missingok
|
||||
+# monthly
|
||||
+# create 0600 root utmp
|
||||
+# rotate 1
|
||||
+#}
|
||||
|
||||
# system-specific logs may be also be configured here.
|
||||
--- ./examples/logrotate.wtmp.orig 2008-08-22 16:15:57.000000000 +0200
|
||||
+++ ./examples/logrotate.wtmp 2008-08-22 16:01:12.000000000 +0200
|
||||
@@ -0,0 +1,11 @@
|
||||
+/var/log/wtmp {
|
||||
+ compress
|
||||
+ dateext
|
||||
+ maxage 365
|
||||
+ rotate 99
|
||||
+ size=+400k
|
||||
+ notifempty
|
||||
+ missingok
|
||||
+ copytruncate
|
||||
+}
|
||||
+
|
@ -1,7 +1,7 @@
|
||||
--- logrotate.c
|
||||
+++ logrotate.c
|
||||
@@ -898,7 +898,7 @@
|
||||
now.tm_mon + 1, now.tm_mday, fileext);
|
||||
--- ./logrotate.c.orig 2008-09-03 10:32:34.000000000 +0200
|
||||
+++ ./logrotate.c 2008-09-03 10:32:55.000000000 +0200
|
||||
@@ -930,7 +930,7 @@ int prerotateSingleLog(struct logInfo *l
|
||||
rotNames->dirName, rotNames->baseName, dext_str, fileext);
|
||||
sprintf(destFile, "%s%s", rotNames->finalName, compext);
|
||||
if (!stat(destFile, &fst_buf)) {
|
||||
- message(MESS_DEBUG,
|
@ -1,6 +1,6 @@
|
||||
--- Makefile
|
||||
+++ Makefile
|
||||
@@ -60,7 +60,7 @@
|
||||
--- ./Makefile.orig 2008-05-19 12:25:54.000000000 +0200
|
||||
+++ ./Makefile 2008-08-22 15:28:29.000000000 +0200
|
||||
@@ -61,7 +61,7 @@
|
||||
endif
|
||||
|
||||
BINDIR = $(BASEDIR)/sbin
|
||||
@ -9,8 +9,8 @@
|
||||
|
||||
#--------------------------------------------------------------------------
|
||||
|
||||
--- examples/logrotate.cron
|
||||
+++ examples/logrotate.cron
|
||||
--- ./examples/logrotate.cron.orig 2008-08-22 15:51:39.000000000 +0200
|
||||
+++ ./examples/logrotate.cron 2008-08-22 15:28:29.000000000 +0200
|
||||
@@ -1,8 +1,17 @@
|
||||
#!/bin/sh
|
||||
|
3
logrotate-3.7.7.tar.bz2
Normal file
3
logrotate-3.7.7.tar.bz2
Normal file
@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:d3d9ef3b41e2ba0d0b7f5a3aa2598b89fdaabad177f172452756411729fbb5cb
|
||||
size 37080
|
@ -1,44 +0,0 @@
|
||||
--- examples/logrotate-default
|
||||
+++ examples/logrotate-default
|
||||
@@ -11,14 +11,22 @@
|
||||
# uncomment this if you want your log files compressed
|
||||
#compress
|
||||
|
||||
+# uncomment these to switch compression to use gzip or another
|
||||
+# compression scheme
|
||||
+compresscmd /usr/bin/bzip2
|
||||
+uncompresscmd /usr/bin/bunzip2
|
||||
+
|
||||
+# former versions had to have the compressext set accordingly
|
||||
+#compressext .bz2
|
||||
+
|
||||
# RPM packages drop log rotation information into this directory
|
||||
include /etc/logrotate.d
|
||||
|
||||
# no packages own wtmp -- we'll rotate them here
|
||||
-/var/log/wtmp {
|
||||
- monthly
|
||||
- create 0664 root utmp
|
||||
- rotate 1
|
||||
-}
|
||||
+#/var/log/wtmp {
|
||||
+# monthly
|
||||
+# create 0664 root utmp
|
||||
+# rotate 1
|
||||
+#}
|
||||
|
||||
# system-specific logs may be also be configured here.
|
||||
--- examples/logrotate.wtmp
|
||||
+++ examples/logrotate.wtmp
|
||||
@@ -0,0 +1,11 @@
|
||||
+/var/log/wtmp {
|
||||
+ compress
|
||||
+ dateext
|
||||
+ maxage 365
|
||||
+ rotate 99
|
||||
+ size=+400k
|
||||
+ notifempty
|
||||
+ missingok
|
||||
+ copytruncate
|
||||
+}
|
||||
+
|
@ -1,3 +1,19 @@
|
||||
-------------------------------------------------------------------
|
||||
Wed Sep 3 11:20:54 CEST 2008 - puzel@suse.cz
|
||||
|
||||
- update to 3.7.7
|
||||
- dateformat
|
||||
- fix possible buffer overflows in strings handling
|
||||
- change logInfo handling
|
||||
- fix compile warnings
|
||||
- tabooext honor wildcards
|
||||
- fix selinux support with dateext
|
||||
- various minor bugfixes
|
||||
- removed logrotate-3.7.5-errorHandling.patch, logrotate-3.7.5-shred.patch,
|
||||
logrotate-3.7.5-cfengine.patch, logrotate-3.7.5-date.patch,
|
||||
logrotate-3.7.5-logfn.patch
|
||||
- merged to upstream
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Mon Aug 25 15:08:14 CEST 2008 - prusnak@suse.cz
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
#
|
||||
# spec file for package logrotate (Version 3.7.5)
|
||||
# spec file for package logrotate (Version 3.7.7)
|
||||
#
|
||||
# Copyright (c) 2008 SUSE LINUX Products GmbH, Nuernberg, Germany.
|
||||
#
|
||||
@ -23,22 +23,17 @@ Name: logrotate
|
||||
BuildRequires: popt-devel
|
||||
BuildRequires: libselinux-devel
|
||||
Summary: Rotate, Compress, Remove, and Mail System Log Files
|
||||
Version: 3.7.5
|
||||
Release: 70
|
||||
Version: 3.7.7
|
||||
Release: 1
|
||||
License: GPL v2 or later
|
||||
Group: System/Base
|
||||
Source: ftp://people.redhat.com/sopwith/logrotate-%{version}.tar.bz2
|
||||
Patch: logrotate-suse.dif
|
||||
Patch1: logrotate-conf.dif
|
||||
Patch2: logrotate-autoext.dif
|
||||
Patch3: logrotate-addextension.dif
|
||||
Patch4: logrotate-mess_err.dif
|
||||
Patch11: logrotate-3.7.5-errorHandling.patch
|
||||
Patch12: logrotate-3.7.5-shred.patch
|
||||
Patch13: logrotate-3.7.5-cfengine.patch
|
||||
Patch14: logrotate-3.7.5-date.patch
|
||||
Patch15: logrotate-3.7.5-logfn.patch
|
||||
Patch16: logrotate-3.7.5-cron-check-for-another-instance.patch
|
||||
Source: %{name}-%{version}.tar.bz2
|
||||
Patch: %{name}-%{version}-suse.patch
|
||||
Patch1: %{name}-%{version}-conf.patch
|
||||
Patch2: %{name}-%{version}-autoext.patch
|
||||
Patch3: %{name}-%{version}-addextension.patch
|
||||
Patch4: %{name}-%{version}-mess_err.patch
|
||||
Patch5: %{name}-%{version}-cron-check-for-another-instance.patch
|
||||
BuildRoot: %{_tmppath}/%{name}-%{version}-build
|
||||
PreReq: %fillup_prereq /bin/rm /bin/mv
|
||||
Requires: bzip2 cron
|
||||
@ -66,12 +61,7 @@ Authors:
|
||||
%patch2
|
||||
%patch3
|
||||
%patch4
|
||||
%patch11 -p1
|
||||
%patch12 -p1
|
||||
%patch13 -p1
|
||||
%patch14 -p1
|
||||
%patch15 -p1
|
||||
%patch16
|
||||
%patch5
|
||||
|
||||
%build
|
||||
make RPM_OPT_FLAGS="$RPM_OPT_FLAGS" WITH_SELINUX=yes
|
||||
@ -100,13 +90,26 @@ rm -rf $RPM_BUILD_ROOT
|
||||
%files
|
||||
%defattr(-,root,root)
|
||||
%doc CHANGES
|
||||
/usr/sbin/logrotate
|
||||
%{_sbindir}/logrotate
|
||||
%{_mandir}/man8/logrotate.8*
|
||||
/etc/cron.daily/logrotate
|
||||
%config /etc/logrotate.conf
|
||||
%config(noreplace)/etc/logrotate.d/wtmp
|
||||
|
||||
%changelog
|
||||
* Wed Sep 03 2008 puzel@suse.cz
|
||||
- update to 3.7.7
|
||||
- dateformat
|
||||
- fix possible buffer overflows in strings handling
|
||||
- change logInfo handling
|
||||
- fix compile warnings
|
||||
- tabooext honor wildcards
|
||||
- fix selinux support with dateext
|
||||
- various minor bugfixes
|
||||
- removed logrotate-3.7.5-errorHandling.patch, logrotate-3.7.5-shred.patch,
|
||||
logrotate-3.7.5-cfengine.patch, logrotate-3.7.5-date.patch,
|
||||
logrotate-3.7.5-logfn.patch
|
||||
- merged to upstream
|
||||
* Mon Aug 25 2008 prusnak@suse.cz
|
||||
- enabled SELinux support [Fate#303662]
|
||||
* Wed Aug 20 2008 puzel@suse.cz
|
||||
|
Loading…
x
Reference in New Issue
Block a user