logrotate/logrotate-3.7.8-autoext.patch
Marcus Meissner 4495f5c112 Accepting request 184333 from home:vitezslav_cizek:branches:Base:System
- update to 3.8.5
  * dropped logrotate-3.7.9-compressoptions.patch (upstream)
  * refreshed other patches
  Changelog:
  - Improved rotation during daylight saving time and between timezone
    changes.
  - Fixed ACL setting problem caused by ext3 erroneously reporting ENOSYS
    instead of ENOSUP.
  - Do not continue with rotation if state file is corrupted.
  - Make logrotate.status creation atomic.
  - Allow "hourly" rotation. See manpage for more information.
  - Use "/bin/echo" in tests. Fixes tests execution in Dash.
  - Do no try to parse config files bigger than 16MB.
  - Improved manpage consistency and formatting.
  - Fix race condition between acl_set_fd() and fchmod().
  - Added --version command line option
  - Disable ACL tests if logrotate is not compiled WITH_ACL support or if 
    ACLs are not supported by the system running tests
  - Disable SELinux tests if logrotate is not compiled WITH_SELINUX support
    or if SELinux is not supported by the system running tests
  - Fixed bug which prevented skipping particular log file config
    if the config contained errors.
  - Fixed skipping of configs containing firstaction/lastaction scripts
    with '}' character in case of error before these scripts.
  - Support also 'K' unit for *size directives.
  - Added preremove option to let admin to do something with the old logs
    before they are removed by logrotate.
  - Fixed possible loop in tabooext parsing.
  - Move code to set SELinux context before compressLogFile calls to create
    compressed log files with the proper context.

OBS-URL: https://build.opensuse.org/request/show/184333
OBS-URL: https://build.opensuse.org/package/show/Base:System/logrotate?expand=0&rev=24
2013-07-25 15:40:16 +00:00

93 lines
3.3 KiB
Diff

Index: config.c
===================================================================
--- config.c.orig 2013-06-10 14:02:36.000000000 +0200
+++ config.c 2013-07-25 15:42:42.465060702 +0200
@@ -594,6 +594,7 @@ static int readConfigFile(const char *co
char **scriptDest = NULL;
struct logInfo *newlog = defConfig;
char *start, *chptr;
+ char *compresscmd_base;
char *dirName;
struct group *group;
struct passwd *pw = NULL;
@@ -1245,6 +1246,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 2013-06-10 14:02:36.000000000 +0200
+++ logrotate.c 2013-07-25 15:30:36.687434418 +0200
@@ -85,6 +85,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 2013-06-10 14:02:36.000000000 +0200
+++ logrotate.h 2013-07-25 15:30:36.687434418 +0200
@@ -66,6 +66,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 2013-07-25 15:30:36.687434418 +0200
+++ test/test 2013-07-25 16:16:11.992044805 +0200
@@ -536,19 +536,6 @@ checkoutput <<EOF
test.log 0 zero
EOF
-cleanup 18
-
-# ------------------------------- Test 18 ------------------------------------
-preptest test.log 18 1
-$RLR test-config.18 --force
-
-checkoutput <<EOF
-test.log 0
-test.log.1.gz 1 zero
-EOF
-
-(echo "gzip -f -9") | diff -u - compress-args
-
cleanup 19
# ------------------------------- Test 19 ------------------------------------