[Logcheck-devel] Bug#302689: treats non-zero egrep exit status as failure
Marcin Owsiany
marcin at owsiany.pl
Sat Apr 2 11:21:06 UTC 2005
Package: logcheck
Version: 1.2.36
Severity: important
Tags: patch
"debdiff logcheck_1.2.35.dsc logcheck_1.2.36.dsc" shows this among other
changes:
- egrep --text -v -f $clean/$file $TMPDIR/checked | cat \
- >> $TMPDIR/checked.1 \
- || error "Could not output to TMPDIR/checked.1 Disk Full?"
+ (egrep --text -v -f $clean/$file $TMPDIR/checked \
+ || warn "Could not process file $file") | cat \
+ >> $TMPDIR/checked.1 \
+ || error "Could not output to $TMPDIR/checked.1 Disk Full?"
However this causes spurious reports looking like this:
| System Events
| =-=-=-=-=-=-=
|
|
| Logcheck Warnings
| =-=-=-=-=-=-=-=-=
| Could not process file spamassassin
|
This is because egrep returns 1 if no lines are found:
| DIAGNOSTICS
| Normally, exit status is 0 if selected lines are found and 1 otherwise.
| But the exit status is 2 if an error occurred, unless the -q or --quiet
| or --silent option is used and a selected line is found.
The quick fix is to simply revert that change. A better one would be to write a
more elaborate condition on whether egrep returned exit code 2.
-- System Information:
Debian Release: 3.1
APT prefers unstable
APT policy: (500, 'unstable'), (1, 'experimental')
Architecture: i386 (i686)
Kernel: Linux 2.4.27-2-k7
Locale: LANG=pl_PL, LC_CTYPE=pl_PL (charmap=ISO-8859-2)
Versions of packages logcheck depends on:
ii adduser 3.63 Add and remove users and groups
ii cron 3.0pl1-87 management of regular background p
ii debconf [debconf 1.4.47 Debian configuration management sy
ii debianutils 2.13.2 Miscellaneous utilities specific t
ii exim4 4.50-4 metapackage to ease exim MTA (v4)
ii exim4-daemon-hea 4.50-4 exim MTA (v4) daemon with extended
ii lockfile-progs 0.1.10 Programs for locking and unlocking
ii logcheck-databas 1.2.36 A database of system log rules for
ii logtail 1.2.36 Print log file lines that have not
ii mailx 1:8.1.2-0.20040524cvs-4 A simple mail user agent
ii sysklogd [system 1.4.1-16 System Logging Daemon
-- debconf information:
logcheck/changes:
* logcheck/install-note:
More information about the Logcheck-devel
mailing list