File: fix-sanitize-messages.patch

package info (click to toggle)
backup-manager 0.7.14-1.3
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, sid, trixie
  • size: 1,616 kB
  • sloc: sh: 4,041; perl: 1,176; makefile: 213
file content (43 lines) | stat: -rw-r--r-- 1,527 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
From: "Georgios M. Zarkadas" <gz@member.fsf.org>
Date: Thu, 26 Nov 2015 14:32:16 -0800
Subject: fix-sanitize-messages

Sanitize logging system's variables first to ensure errors and warnings are
properly reported / logged.
---
 lib/sanitize.sh | 15 +++++++++------
 1 file changed, 9 insertions(+), 6 deletions(-)

diff --git a/lib/sanitize.sh b/lib/sanitize.sh
index ade5e0f..a65c760 100644
--- a/lib/sanitize.sh
+++ b/lib/sanitize.sh
@@ -121,6 +121,15 @@ function replace_deprecated_booleans()
 
 # First of all replace yes/no booleans with true/false ones.
 replace_deprecated_booleans
+# Then ensure that logging facility has sane values, so that subsequent
+# errors and warnings in configuration keys indeed get reported.
+confkey_require "BM_LOGGER" "true"
+if [[ "$BM_LOGGER" = "true" ]]; then
+    confkey_require "BM_LOGGER_FACILITY" "user"
+    confkey_require "BM_LOGGER_LEVEL" "warning"
+fi
+# Now we can sanitize rest configuration keys.
+
 confkey_handle_deprecated "BM_ARCHIVES_REPOSITORY" "BM_REPOSITORY_ROOT"
 confkey_require "BM_REPOSITORY_ROOT" "/var/archives" 
 
@@ -289,12 +298,6 @@ if [[ -z "$BM_ARCHIVE_STRICTPURGE" ]]; then
     confkey_require "BM_ARCHIVE_STRICTPURGE" "true"
 fi
 
-confkey_require "BM_LOGGER" "true"
-if [[ "$BM_LOGGER" = "true" ]]; then 
-    confkey_require "BM_LOGGER_FACILITY" "user"
-    confkey_require "BM_LOGGER_LEVEL" "warning"
-fi
-
 if [[ $nb_warnings -gt 0 ]]; then
     warning "When validating the configuration file \$conffile, \$nb_warnings warnings were found."
 fi