[Logcheck-commits] Frédéric Brière : Allow filenames with spaces in logcheck.logfiles (closes: #319169)

Frédéric Brière fbriere-guest at alioth.debian.org
Mon Aug 24 20:25:33 UTC 2009


Module: logcheck
Branch: master
Commit: b42f6ed2c4974fd6c11570e80050621dd35cfc13
URL:    http://git.debian.org/?p=logcheck/logcheck.git;a=commit;h=b42f6ed2c4974fd6c11570e80050621dd35cfc13

Author: Frédéric Brière <fbriere at fbriere.net>
Date:   Mon Aug 24 16:19:18 2009 -0400

Allow filenames with spaces in logcheck.logfiles (closes: #319169)

This replaces the "for VAR in CMD" construct with "CMD | while read VAR"
when parsing logcheck.logfiles.  This allows for logcheck.logfiles to
contain filenames with embedded spaces.  (Leading and trailing spaces
are not retained by read.)

(Note that while there are a couple other "for VAR in CMD" in logcheck,
they all work on rules filenames, which are already filtered by
run-parts and cannot contain spaces.  This is the only one worth
changing.)

---

 debian/changelog |    1 +
 src/logcheck     |    2 +-
 2 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/debian/changelog b/debian/changelog
index e9dd72b..2c179ce 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -61,6 +61,7 @@ logcheck (1.3.4) experimental; urgency=low
     - ignore.d.server/sendmail, also in sendmail-base (closes: #542265)
     - deleting all the conffiles dropped over the years (closes: #453519)
   * Quote most variables and commands in logcheck
+  * Allow filenames with spaces in logcheck.logfiles (closes: #319169)
 
  -- Frédéric Brière <fbriere at fbriere.net>  Mon, 17 Aug 2009 11:48:08 -0400
 
diff --git a/src/logcheck b/src/logcheck
index e3c26ca..380494b 100755
--- a/src/logcheck
+++ b/src/logcheck
@@ -663,7 +663,7 @@ fi
 mkdir "$TMPDIR/logoutput" \
     || error "Could not mkdir for log files"
 if [ ! "$LOGFILE" ] && [ -r "$LOGFILES_LIST" ]; then
-    for file in $(egrep --text -v "(^#|^[[:space:]]*$)" "$LOGFILES_LIST"); do
+    egrep --text -v "(^#|^[[:space:]]*$)" "$LOGFILES_LIST" | while read file; do
 	logoutput "$file"
     done 
 elif [ "$LOGFILE" ]; then




More information about the Logcheck-commits mailing list