Репозитории ALT
S: | 3.20.1-alt2 |
5.1: | 3.7.9-alt0.M51.1 |
4.1: | 3.6.2-alt4 |
4.0: | 3.6.2-alt4 |
3.0: | 3.6.2-alt3 |
Группа :: Работа с файлами
Пакет: logrotate
Главная Изменения Спек Патчи Sources Загрузить Gear Bugs and FR Repocop
Патч: 0004-ALT-Add-more-taboo-suffixes.patch
Скачать
Скачать
From 772908ae80a92333731b6f31bdc6f9ab496fcb49 Mon Sep 17 00:00:00 2001
From: Alexey Gladkov <legion@altlinux.org>
Date: Sat, 25 Apr 2020 19:08:58 +0300
Subject: ALT: Add more taboo suffixes
Signed-off-by: Alexey Gladkov <legion@altlinux.org>
---
config.c | 9 +++++++++
test/Makefile.am | 4 +++-
test/test-0991.sh | 26 ++++++++++++++++++++++++++
test/test-0992.sh | 33 +++++++++++++++++++++++++++++++++
test/test-config.991.in | 9 +++++++++
test/test-config.992.in | 13 +++++++++++++
6 files changed, 93 insertions(+), 1 deletion(-)
create mode 100755 test/test-0991.sh
create mode 100755 test/test-0992.sh
create mode 100644 test/test-config.991.in
create mode 100644 test/test-config.992.in
diff --git a/config.c b/config.c
index 9d196cc..86f8e85 100644
--- a/config.c
+++ b/config.c
@@ -142,6 +142,12 @@ static const char *const defTabooExts[] = {
".ucf-dist",
".ucf-new",
".ucf-old",
+ ".gz",
+ ".bz2",
+ ".xz",
+ ".[0-9]",
+ ".[0-9][0-9]",
+ ".[0-9][0-9][0-9]",
"~"
};
static const unsigned defTabooCount = sizeof(defTabooExts) / sizeof(char *);
@@ -1857,6 +1863,9 @@ static int readConfigFile(const char *configFile, struct logInfo *defConfig)
}
}
+ if (!checkFile(globResult.gl_pathv[glob_count]))
+ continue;
+
newlog->files[newlog->numFiles] =
strdup(globResult.gl_pathv[glob_count]);
if (newlog->files[newlog->numFiles] == NULL) {
diff --git a/test/Makefile.am b/test/Makefile.am
index 67cfacc..2f3d9a5 100644
--- a/test/Makefile.am
+++ b/test/Makefile.am
@@ -96,7 +96,9 @@ TEST_CASES = \
test-0102.sh \
test-0103.sh \
test-0104.sh \
- test-0105.sh
+ test-0105.sh \
+ test-0991.sh \
+ test-0992.sh
EXTRA_DIST = \
compress \
diff --git a/test/test-0991.sh b/test/test-0991.sh
new file mode 100755
index 0000000..587e86d
--- /dev/null
+++ b/test/test-0991.sh
@@ -0,0 +1,26 @@
+#!/bin/bash
+
+. ./test-common.sh
+
+cleanup 991
+
+# ------------------------------- Test 991 ------------------------------------
+mkdir subdir
+preptest subdir/sample.log 991 8
+$RLR test-config.991 --force
+
+checkoutput <<EOF
+subdir/sample.log 0
+subdir/sample.log.1 0 zero
+subdir/sample.log.2 0 first
+subdir/sample.log.3 0 second
+subdir/sample.log.4 0 third
+subdir/sample.log.5 0 fourth
+subdir/sample.log.6 0 fifth
+subdir/sample.log.7 0 sixth
+subdir/sample.log.8 0 seventh
+EOF
+
+checkmail subdir/sample.log.1 zero
+
+rm -rf subdir
diff --git a/test/test-0992.sh b/test/test-0992.sh
new file mode 100755
index 0000000..cf4775b
--- /dev/null
+++ b/test/test-0992.sh
@@ -0,0 +1,33 @@
+#!/bin/bash
+
+. ./test-common.sh
+
+cleanup 992
+
+# ------------------------------- Test 992 ------------------------------------
+rm -rf subdir
+mkdir subdir
+preptest subdir/sample.log 992 2 0
+$RLR test-config.992 --force
+
+checkoutput <<EOF
+subdir/sample.log 0
+subdir/sample.log.1 0 zero
+subdir/sample.log.2.gz 1 first
+subdir/sample.log.3.gz 1 second
+EOF
+
+echo "newfile" > subdir/sample.log
+$RLR test-config.992 --force
+
+checkoutput <<EOF
+subdir/sample.log 0
+subdir/sample.log.1 0 newfile
+subdir/sample.log.2.gz 1 zero
+subdir/sample.log.3.gz 1 first
+EOF
+
+checkmail subdir/sample.log.1 newfile
+
+rm -rf subdir
+
diff --git a/test/test-config.991.in b/test/test-config.991.in
new file mode 100644
index 0000000..6187795
--- /dev/null
+++ b/test/test-config.991.in
@@ -0,0 +1,9 @@
+create
+
+&DIR&/subdir/* {
+ daily
+ rotate 8
+ nocompress
+ mailfirst
+ mail user@invalid.
+}
diff --git a/test/test-config.992.in b/test/test-config.992.in
new file mode 100644
index 0000000..537eed0
--- /dev/null
+++ b/test/test-config.992.in
@@ -0,0 +1,13 @@
+create
+
+&DIR&/subdir/* {
+ daily
+ rotate 3
+ compress
+ compresscmd gzip
+ uncompresscmd gunzip
+ compressext .gz
+ delaycompress
+ mailfirst
+ mail user@invalid.
+}
--
2.25.4