aboutsummaryrefslogtreecommitdiffstats
path: root/main
diff options
context:
space:
mode:
Diffstat (limited to 'main')
-rw-r--r--main/logrotate/APKBUILD38
-rw-r--r--main/logrotate/logrotate-3.7.9-atomic-create.patch70
-rw-r--r--main/logrotate/logrotate-3.7.9-shred.patch151
-rw-r--r--main/logrotate/logrotate-3.7.9-statefile.patch96
-rw-r--r--main/logrotate/qsort.patch32
5 files changed, 52 insertions, 335 deletions
diff --git a/main/logrotate/APKBUILD b/main/logrotate/APKBUILD
index eab8b814d9..c02dc0c50a 100644
--- a/main/logrotate/APKBUILD
+++ b/main/logrotate/APKBUILD
@@ -1,7 +1,7 @@
# Contributor: Carlo Landmeter <clandmeter@gmail.com>
# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
pkgname=logrotate
-pkgver=3.8.7
+pkgver=3.8.8
pkgrel=0
pkgdesc="Tool to rotate logfiles"
url="https://fedorahosted.org/logrotate/"
@@ -11,20 +11,28 @@ depends=
makedepends="popt-dev"
subpackages="$pkgname-doc"
source="https://fedorahosted.org/releases/l/o/logrotate/logrotate-$pkgver.tar.gz
- logrotate-3.7.9-atomic-create.patch
- logrotate-3.7.9-shred.patch
- logrotate-3.7.9-statefile.patch
+ qsort.patch
logrotate.cron
logrotate.conf
logrotate.confd"
+_builddir="$srcdir/$pkgname-$pkgver"
+prepare() {
+ cd "$_builddir"
+ for i in $source; do
+ case $i in
+ *.patch) msg $i; patch -p1 -i "$srcdir"/$i || return 1;;
+ esac
+ done
+}
+
build() {
- cd "$srcdir/$pkgname-$pkgver"
+ cd "$_builddir"
make || return 1
}
package() {
- cd "$srcdir/$pkgname-$pkgver"
+ cd "$_builddir"
install -d "$pkgdir"/etc/logrotate.d
install -Dm755 logrotate "$pkgdir"/usr/sbin/logrotate
install -Dm644 logrotate.8 "$pkgdir"/usr/share/man/man8/logrotate.8
@@ -35,24 +43,18 @@ package() {
"$pkgdir"/etc/conf.d/logrotate
}
-md5sums="99e08503ef24c3e2e3ff74cc5f3be213 logrotate-3.8.7.tar.gz
-0273f868dc4208eed0a442759d86e77c logrotate-3.7.9-atomic-create.patch
-74216579397b03c44d1d85dd233306d8 logrotate-3.7.9-shred.patch
-82ebd23da8a7f0650a4c80577dbdc739 logrotate-3.7.9-statefile.patch
+md5sums="49846e873dddea15964cd0355b9943ca logrotate-3.8.8.tar.gz
+7db9ae27e3589ee2c42a58546c7bd819 qsort.patch
7e9fad2c9b382a2370c11ef0c89f61c7 logrotate.cron
fef6415a79a6fede8cf9b9b6b8410090 logrotate.conf
e7e4b67d5c4bda49ff3c041834180c1e logrotate.confd"
-sha256sums="f6ba691f40e30e640efa2752c1f9499a3f9738257660994de70a45fe00d12b64 logrotate-3.8.7.tar.gz
-6a4f4a325c49c9a7eaa4a5a9fb4a049cad5b3b7864a55135b42ed624d2a7cbdf logrotate-3.7.9-atomic-create.patch
-4c19c29b9be6bef70a34dd3af4903b2c901edd635f4b42be93731ac17ed8b38f logrotate-3.7.9-shred.patch
-014dd543785ccdd74e47084be3c77c78b22d240252197f88caa680a32e397549 logrotate-3.7.9-statefile.patch
+sha256sums="46a1510ef4a1f4359edd5f361112cfd1523942e85ff28e6cbb0c81bad1829d0f logrotate-3.8.8.tar.gz
+03293a5dd559e8b828b25bee2f0cde5766967a9b6238bc4bcd2b421fe53405f5 qsort.patch
ccbcf1785c754ce07a55b81223ae5b0c2caec1ccf9cdf865debb140052f9b363 logrotate.cron
c8fbf89e4f3afee4fc59ed5dff246eda9d1ea1cbce38bf9dbabfc3af2f01e951 logrotate.conf
814bea9082cfa3a9446e25f4f4fe4fe205130cea6ba15dc8286409c3d01a3973 logrotate.confd"
-sha512sums="6c0dc106e2a9e9d2cd7ac12af869bc152db7d046a1c6d1b75810fb2fc7a7f382b3c3f1dc54b9fb9a9eee248c1c66a9f5ce86804f15b49ac0210313c231b49e7f logrotate-3.8.7.tar.gz
-9e75b33526d07fd83e3d2e636f656270366f67b164189d869b5bd35ef2ca7a78758bbcef5d2ccc841fc061df2b95624bd68d6c195177bc8ab30980f4c8ee407c logrotate-3.7.9-atomic-create.patch
-10ee86943466fbafa6736609330c00df51edaf13b278fc9a4a2ab7067d888d174d16b356bb7c17a24a421cb4047ed3f2beeeef66ee857af72dc13a2ed05c4b24 logrotate-3.7.9-shred.patch
-5a7d3f84549cb7b3ceab034ea34fd425cbc0d3fe20f08298444f5569d608de086cd1a0fb243166e32cd99e54f56c4aa211b4444dff2a5efa8b97e8bbad8d542d logrotate-3.7.9-statefile.patch
+sha512sums="2b7b5fe587b3a5cbe98b8035a541b5e272e6e4c40669f65ff6c43d1524b686eca9abc0b93bc00c8eb6da4d189f14a9b79905fcc0fadb914276d884ad7493bb4b logrotate-3.8.8.tar.gz
+83af35130bac93e18c1117080903879eaa466dd0a52001c8f32f4815bcb900472728880b367cbf35f94bf47abdf1561f218988be88b6ba732caad01935488b7a qsort.patch
f4d708594fb2b240cfc2928f38a180d27c2cecb9867e048dc29a32c0147244db4d2f6d92e7bff27e1f2623537587db87b2f8fc9bb988f98eff0c98f79f5a5bf2 logrotate.cron
8d49880f2477c8e18b8ea4f6c17410635e761a819b0463c3e73447ee06d3f3649ae9ad16f239451ef5d8e308e74102ef8cf2da6a4c5890e8968dd4ecbf6d1e3b logrotate.conf
be9f0043b594d26b4f64e07a2188d19c3c43af75ef726305e4d98f744fc16cee9f280227116858e2f5b781c0a7b58e0209d7e9ab1285dfa7ba55a9dfda700229 logrotate.confd"
diff --git a/main/logrotate/logrotate-3.7.9-atomic-create.patch b/main/logrotate/logrotate-3.7.9-atomic-create.patch
deleted file mode 100644
index b888dc0231..0000000000
--- a/main/logrotate/logrotate-3.7.9-atomic-create.patch
+++ /dev/null
@@ -1,70 +0,0 @@
-diff --git a/logrotate.c b/logrotate.c
-index 3748918..fbe232a 100644
---- a/logrotate.c
-+++ b/logrotate.c
-@@ -194,31 +194,41 @@ static int runScript(char *logfn, char *script)
- int createOutputFile(char *fileName, int flags, struct stat *sb)
- {
- int fd;
-+ char template[PATH_MAX + 1];
-+ mode_t umask_value;
-+ snprintf(template, PATH_MAX, "%s/logrotate_temp.XXXXXX", ourDirName(fileName));
-+
-+ umask_value = umask(0000);
-+ fd = mkstemp(template);
-+ umask(umask_value);
-+
-+ if (fd < 0) {
-+ message(MESS_ERROR, "error creating unique temp file: %s\n",
-+ strerror(errno));
-+ return -1;
-+ }
-+
-+ if (fchown(fd, sb->st_uid, sb->st_gid)) {
-+ message(MESS_ERROR, "error setting owner of %s: %s\n",
-+ fileName, strerror(errno));
-+ close(fd);
-+ return -1;
-+ }
-+
-+ if (fchmod(fd, sb->st_mode)) {
-+ message(MESS_ERROR, "error setting mode of %s: %s\n",
-+ fileName, strerror(errno));
-+ close(fd);
-+ return -1;
-+ }
-+
-+ if (rename(template, fileName)) {
-+ message(MESS_ERROR, "error renaming temp file to %s: %s\n",
-+ fileName, strerror(errno));
-+ close(fd);
-+ return -1;
-+ }
-
-- fd = open(fileName, flags, sb->st_mode);
-- if (fd < 0) {
-- message(MESS_ERROR, "error creating output file %s: %s\n",
-- fileName, strerror(errno));
-- return -1;
-- }
-- if (fchmod(fd, (S_IRUSR | S_IWUSR) & sb->st_mode)) {
-- message(MESS_ERROR, "error setting mode of %s: %s\n",
-- fileName, strerror(errno));
-- close(fd);
-- return -1;
-- }
-- if (fchown(fd, sb->st_uid, sb->st_gid)) {
-- message(MESS_ERROR, "error setting owner of %s: %s\n",
-- fileName, strerror(errno));
-- close(fd);
-- return -1;
-- }
-- if (fchmod(fd, sb->st_mode)) {
-- message(MESS_ERROR, "error setting mode of %s: %s\n",
-- fileName, strerror(errno));
-- close(fd);
-- return -1;
-- }
- return fd;
- }
-
diff --git a/main/logrotate/logrotate-3.7.9-shred.patch b/main/logrotate/logrotate-3.7.9-shred.patch
deleted file mode 100644
index d9780007f3..0000000000
--- a/main/logrotate/logrotate-3.7.9-shred.patch
+++ /dev/null
@@ -1,151 +0,0 @@
-Index: logrotate.c
-===================================================================
---- logrotate.c (revision 310)
-+++ logrotate.c (working copy)
-@@ -71,7 +71,7 @@
- char *mailCommand = DEFAULT_MAIL_COMMAND;
- time_t nowSecs = 0;
-
--static int shred_file(char *filename, struct logInfo *log);
-+static int shred_file(int fd, char *filename, struct logInfo *log);
-
- static int globerr(const char *pathname, int theerr)
- {
-@@ -231,59 +231,79 @@
- return fd;
- }
-
--#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, struct logInfo *log)
-+static int shred_file(int fd, char *filename, struct logInfo *log)
- {
-- int len, ret;
-- char *cmd;
- char count[DIGITS]; /* that's a lot of shredding :) */
-+ const char **fullCommand;
-+ int id = 0;
-+ int status;
-
- if (!(log->flags & LOG_FLAG_SHRED)) {
- return unlink(filename);
- }
-
-- len = strlen(filename) + strlen(SHRED_CALL);
-- len += strlen(SHRED_COUNT_FLAG) + DIGITS;
-- cmd = malloc(len);
-+ message(MESS_DEBUG, "Using shred to remove the file %s\n", filename);
-
-- if (!cmd) {
-- message(MESS_ERROR, "malloc error while shredding");
-- return unlink(filename);
-+ if (log->shred_cycles != 0) {
-+ fullCommand = alloca(sizeof(*fullCommand) * 6);
- }
-- strcpy(cmd, SHRED_CALL);
-+ else {
-+ fullCommand = alloca(sizeof(*fullCommand) * 4);
-+ }
-+ fullCommand[id++] = "shred";
-+ fullCommand[id++] = "-u";
-+
- if (log->shred_cycles != 0) {
-- strcat(cmd, SHRED_COUNT_FLAG);
-+ fullCommand[id++] = "-n";
- snprintf(count, DIGITS - 1, "%d", log->shred_cycles);
-- strcat(count, " ");
-- strcat(cmd, count);
-+ fullCommand[id++] = count;
- }
-- strcat(cmd, filename);
-- ret = system(cmd);
-- free(cmd);
-- if (ret != 0) {
-+ fullCommand[id++] = "-";
-+ fullCommand[id++] = NULL;
-+
-+ if (!fork()) {
-+ dup2(fd, 1);
-+ close(fd);
-+
-+ execvp(fullCommand[0], (void *) fullCommand);
-+ exit(1);
-+ }
-+
-+ wait(&status);
-+
-+ if (!WIFEXITED(status) || WEXITSTATUS(status)) {
- 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;
- }
-+
-+ /* We have to unlink it after shred anyway,
-+ * because it doesn't remove the file itself */
-+ return unlink(filename);
- }
-
- static int removeLogFile(char *name, struct logInfo *log)
- {
-- message(MESS_DEBUG, "removing old log %s\n", name);
-+ int fd;
-+ message(MESS_DEBUG, "removing old log %s\n", name);
-
-- if (!debug && shred_file(name, log)) {
-- message(MESS_ERROR, "Failed to remove old log %s: %s\n",
-- name, strerror(errno));
-- return 1;
-- }
-- return 0;
-+ if ((fd = open(name, O_RDWR)) < 0) {
-+ message(MESS_ERROR, "error opening %s: %s\n",
-+ name, strerror(errno));
-+ return 1;
-+ }
-+
-+ if (!debug && shred_file(fd, name, log)) {
-+ message(MESS_ERROR, "Failed to remove old log %s: %s\n",
-+ name, strerror(errno));
-+ close(fd);
-+ return 1;
-+ }
-+
-+ close(fd);
-+ return 0;
- }
-
- static int compressLogFile(char *name, struct logInfo *log, struct stat *sb)
-@@ -310,7 +330,7 @@
- compressedName = alloca(strlen(name) + strlen(log->compress_ext) + 2);
- sprintf(compressedName, "%s%s", name, log->compress_ext);
-
-- if ((inFile = open(name, O_RDONLY)) < 0) {
-+ if ((inFile = open(name, O_RDWR)) < 0) {
- message(MESS_ERROR, "unable to open %s for compression\n", name);
- return 1;
- }
-@@ -357,7 +377,6 @@
- exit(1);
- }
-
-- close(inFile);
- close(outFile);
-
- wait(&status);
-@@ -373,7 +392,8 @@
- /* If we can't change atime/mtime, it's not a disaster.
- It might possibly fail under SELinux. */
-
-- shred_file(name, log);
-+ shred_file(inFile, name, log);
-+ close(inFile);
-
- return 0;
- }
diff --git a/main/logrotate/logrotate-3.7.9-statefile.patch b/main/logrotate/logrotate-3.7.9-statefile.patch
deleted file mode 100644
index daa02402fa..0000000000
--- a/main/logrotate/logrotate-3.7.9-statefile.patch
+++ /dev/null
@@ -1,96 +0,0 @@
-Index: logrotate.c
-===================================================================
---- logrotate.c (revision 314)
-+++ logrotate.c (working copy)
-@@ -45,6 +45,12 @@
- #define GLOB_ABORTED GLOB_ABEND
- #endif
-
-+#ifdef PATH_MAX
-+#define STATEFILE_BUFFER_SIZE 2 * PATH_MAX + 16
-+#else
-+#define STATEFILE_BUFFER_SIZE 4096
-+#endif
-+
- struct logState {
- char *fn;
- struct tm lastRotated; /* only tm.mon, tm_mday, tm_year are good! */
-@@ -82,6 +88,34 @@
- return 1;
- }
-
-+static void unescape(char *arg)
-+{
-+ char *p = arg;
-+ char *next;
-+ char escaped;
-+ while ((next = strchr(p, '\\')) != NULL) {
-+
-+ p = next;
-+
-+ switch (p[1]) {
-+ case 'n':
-+ escaped = '\n';
-+ break;
-+ case '\\':
-+ escaped = '\\';
-+ break;
-+ default:
-+ ++p;
-+ continue;
-+ }
-+
-+ /* Overwrite the backslash with the intended character,
-+ * and shift everything down one */
-+ *p++ = escaped;
-+ memmove(p, p+1, 1 + strlen(p+1));
-+ }
-+}
-+
- #define HASH_SIZE_MIN 64
- static int allocateHash(void)
- {
-@@ -1546,7 +1580,13 @@
- for (chptr = p->fn; *chptr; chptr++) {
- switch (*chptr) {
- case '"':
-+ case '\\':
- fputc('\\', f);
-+ break;
-+ case '\n':
-+ fputc('\\', f);
-+ fputc('n', f);
-+ continue;
- }
-
- fputc(*chptr, f);
-@@ -1567,7 +1607,8 @@
- static int readState(char *stateFilename)
- {
- FILE *f;
-- char buf[1024];
-+ char buf[STATEFILE_BUFFER_SIZE];
-+ char *filename;
- const char **argv;
- int argc;
- int year, month, day;
-@@ -1678,7 +1719,10 @@
-
- year -= 1900, month -= 1;
-
-- if ((st = findState(argv[0])) == NULL)
-+ filename = strdup(argv[0]);
-+ unescape(filename);
-+
-+ if ((st = findState(filename)) == NULL)
- return 1;
-
- st->lastRotated.tm_mon = month;
-@@ -1690,6 +1734,7 @@
- st->lastRotated = *localtime(&lr_time);
-
- free(argv);
-+ free(filename);
- }
-
- fclose(f);
diff --git a/main/logrotate/qsort.patch b/main/logrotate/qsort.patch
new file mode 100644
index 0000000000..1e932be192
--- /dev/null
+++ b/main/logrotate/qsort.patch
@@ -0,0 +1,32 @@
+--- ./logrotate.c.orig
++++ ./logrotate.c
+@@ -117,11 +117,12 @@
+ return 1;
+ }
+
+-#if defined(HAVE_STRPTIME) && defined(HAVE_QSORT_R)
+-static int compGlobResult(const void *result1, const void *result2, void *data) {
++#if defined(HAVE_STRPTIME)
++static struct compData qsort_data;
++static int compGlobResult(const void *result1, const void *result2) {
+ struct tm time;
+ time_t t1, t2;
+- struct compData *d = (struct compData *) data;
++ struct compData *d = &qsort_data;
+ const char *r1 = *(const char **)(result1);
+ const char *r2 = *(const char **)(result2);
+
+@@ -139,10 +140,9 @@
+ }
+
+ static void sortGlobResult(glob_t *result, int prefix_len, const char *dformat) {
+- struct compData d;
+- d.prefix_len = prefix_len;
+- d.dformat = dformat;
+- qsort_r(result->gl_pathv, result->gl_pathc, sizeof(char *), compGlobResult, &d);
++ qsort_data.prefix_len = prefix_len;
++ qsort_data.dformat = dformat;
++ qsort(result->gl_pathv, result->gl_pathc, sizeof(char *), compGlobResult);
+ }
+ #else
+ static void sortGlobResult(glob_t *result, int prefix_len, const char *dformat) {