841db056ae
* Update url to point to github - Remove upstreamed patch: * logrotate-3.7.8-mess_err.patch - Rebase patches: * logrotate-3.7.8-suse.patch * logrotate-addextension.patch * logrotate-autoext.patch * logrotate-fix-test62_with_bash-4.4.patch OBS-URL: https://build.opensuse.org/package/show/Base:System/logrotate?expand=0&rev=48
106 lines
3.4 KiB
Diff
106 lines
3.4 KiB
Diff
Index: config.c
|
|
===================================================================
|
|
--- config.c.orig
|
|
+++ config.c
|
|
@@ -716,6 +716,7 @@ static int readConfigFile(const char *co
|
|
char **scriptDest = NULL;
|
|
struct logInfo *newlog = defConfig;
|
|
char *start, *chptr;
|
|
+ char *compresscmd_base;
|
|
char *dirName;
|
|
struct passwd *pw = NULL;
|
|
int rc;
|
|
@@ -1242,6 +1243,20 @@ static int readConfigFile(const char *co
|
|
message(MESS_DEBUG, "compress_prog is now %s\n",
|
|
newlog->compress_prog);
|
|
|
|
+ compresscmd_base=strdup(basename(newlog->compress_prog));
|
|
+ fprintf(stdout, "compress_ext is %s\n", newlog->compress_prog);
|
|
+ i=0; /* have to check whether we may do this! */
|
|
+ /* we check whether we changed the compress_cmd. In case we use the apropriate extension
|
|
+ as listed in compress_cmd_list */
|
|
+ while ((i>=0)&&(strcmp(compress_cmd_list[i][0], "EOLIST"))){
|
|
+ if (0==strcmp(compress_cmd_list[i][0], compresscmd_base)){
|
|
+ newlog->compress_ext=strdup((char *)compress_cmd_list[i][1]);
|
|
+ message(MESS_DEBUG, "compress_ext was changed to %s\n", newlog->compress_ext);
|
|
+ fprintf(stdout, "compress_ext was changed to %s\n", newlog->compress_ext);
|
|
+ i=-10; /* terminate loop! */
|
|
+ }
|
|
+ i++;
|
|
+ }
|
|
} else if (!strcmp(key, "uncompresscmd")) {
|
|
freeLogItem (uncompress_prog);
|
|
|
|
Index: logrotate.c
|
|
===================================================================
|
|
--- logrotate.c.orig
|
|
+++ logrotate.c
|
|
@@ -104,6 +104,16 @@ unsigned int hashSize;
|
|
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! */
|
|
+const char * compress_cmd_list[][2] = {
|
|
+ {"gzip", ".gz"},
|
|
+ {"bzip2", ".bz2"},
|
|
+ {"xz", ".xz"},
|
|
+ {"compress", ".Z"},
|
|
+ {"zip", "zip"},
|
|
+ {"EOLIST", "EOLIST"} /* end-marker */
|
|
+};
|
|
+
|
|
time_t nowSecs = 0;
|
|
static uid_t save_euid;
|
|
static gid_t save_egid;
|
|
Index: logrotate.h
|
|
===================================================================
|
|
--- logrotate.h.orig
|
|
+++ logrotate.h
|
|
@@ -79,6 +79,9 @@ TAILQ_HEAD(logInfoHead, logInfo) logs;
|
|
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);
|
|
#if !defined(asprintf) && !defined(_FORTIFY_SOURCE)
|
|
int asprintf(char **string_ptr, const char *format, ...);
|
|
Index: test/test
|
|
===================================================================
|
|
--- test/test.orig
|
|
+++ test/test
|
|
@@ -577,32 +577,6 @@ checkoutput <<EOF
|
|
test.log 0 zero
|
|
EOF
|
|
|
|
-cleanup 18
|
|
-
|
|
-# ------------------------------- Test 18 ------------------------------------
|
|
-preptest test.log 18 1
|
|
-$RLR test-config.18 -l syslog --force
|
|
-
|
|
-checkoutput <<EOF
|
|
-test.log 0
|
|
-test.log.1.gz 1 zero
|
|
-EOF
|
|
-
|
|
-(echo "gzip -f -9") | diff -u - compress-args
|
|
-egrep -q '^LOGROTATE_COMPRESSED_FILENAME=.+/test/test.log.1$' compress-env
|
|
-if [ $? != 0 ]; then
|
|
- echo "LOGROTATE_COMPRESSED_FILENAME environment variable not found."
|
|
- cat compress-env++ exit 3
|
|
-fi
|
|
-
|
|
-if [ $SYSLOG_TESTS = 1 ]; then
|
|
- journalctl -n 50 2>/dev/null|grep $PWD/test.log.1 2>/dev/null >/dev/null
|
|
- if [ $? != 0 ]; then
|
|
- echo "syslog message not found"
|
|
- exit 1
|
|
- fi
|
|
-fi
|
|
-
|
|
cleanup 19
|
|
|
|
# ------------------------------- Test 19 ------------------------------------
|