Matthew Toseland
2005-Apr-02 16:46 UTC
[Logcheck-devel] Bug#302689: Patch for logcheck handling egrep return incorrectly
Package: logcheck Version: 1.2.36 Followup-For: Bug #302689 Logcheck will produce spurious errors at the moment, because egrep returns 2 on error but 1 if no lines are returned. A patch is attached to fix this. -- System Information: Debian Release: 3.1 APT prefers unstable APT policy: (500, 'unstable'), (500, 'testing') Architecture: i386 (i686) Kernel: Linux 2.6.11.6 Locale: LANG=C, LC_CTYPE=C (charmap=ANSI_X3.4-1968) 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 exim [mail-trans 3.36-14 An MTA (Mail Transport Agent) 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/noroot: logcheck/changes: * logcheck/install-note: -------------- next part -------------- --- /usr/sbin/logcheck 2005-03-31 03:08:41.000000000 +0100 +++ logcheck 2005-04-02 17:40:49.000000000 +0100 @@ -379,8 +379,8 @@ debug "cleanchecked - dir - $clean" for file in $(ls -1 $clean/); do debug "cleanchecked - dir - $clean/$file" - (egrep --text -v -f $clean/$file $TMPDIR/checked \ - || warn "Could not process file $file") | cat \ + (egrep --text -v -f $clean/$file $TMPDIR/checked; + if [[ $? == 2 ]]; then warn "Could not process file $file"; fi) | cat \ >> $TMPDIR/checked.1 \ || error "Could not output to $TMPDIR/checked.1 Disk Full?" mv $TMPDIR/checked.1 $TMPDIR/checked \
Todd Troxell
2005-Apr-02 19:46 UTC
Bug#302689: [Logcheck-devel] Bug#302689: Patch for logcheck handling egrep return incorrectly
On Sat, Apr 02, 2005 at 05:46:42PM +0100, Matthew Toseland wrote:> Package: logcheck > Version: 1.2.36 > Followup-For: Bug #302689 > > > Logcheck will produce spurious errors at the moment, because egrep > returns 2 on error but 1 if no lines are returned. A patch is attached > to fix this. > > -- System Information: > Debian Release: 3.1 > APT prefers unstable > APT policy: (500, 'unstable'), (500, 'testing') > Architecture: i386 (i686) > Kernel: Linux 2.6.11.6 > Locale: LANG=C, LC_CTYPE=C (charmap=ANSI_X3.4-1968) > > 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 exim [mail-trans 3.36-14 An MTA (Mail Transport Agent) > 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/noroot: > logcheck/changes: > * logcheck/install-note:> --- /usr/sbin/logcheck 2005-03-31 03:08:41.000000000 +0100 > +++ logcheck 2005-04-02 17:40:49.000000000 +0100 > @@ -379,8 +379,8 @@ > debug "cleanchecked - dir - $clean" > for file in $(ls -1 $clean/); do > debug "cleanchecked - dir - $clean/$file" > - (egrep --text -v -f $clean/$file $TMPDIR/checked \ > - || warn "Could not process file $file") | cat \ > + (egrep --text -v -f $clean/$file $TMPDIR/checked; > + if [[ $? == 2 ]]; then warn "Could not process file $file"; fi) | cat \ > >> $TMPDIR/checked.1 \ > || error "Could not output to $TMPDIR/checked.1 Disk Full?" > mv $TMPDIR/checked.1 $TMPDIR/checked \Thanks a lot for the patch, I will get this out shortly. -- [ Todd J. Troxell ,''`. Student, Debian GNU/Linux Developer, SysAdmin, Geek : :' : http://debian.org || http://rapidpacket.com/~xtat `. `' `- ]