[PATCH] randomtrain utility gets confused by spams with null bytes
Matthias Andree
matthias.andree at gmx.de
Sun Dec 8 19:01:21 CET 2002
Greg Louis <glouis at dynamicro.on.ca> writes:
> The randomtrain script invokes grep without the -a option and therefore
> fails if a file it needs to process is deemed binary. Some spam
> contains null bytes (hex 00) in the body of the text, and will cause
> this failure.
>
> --- contrib/randomtrain~ 2002-12-08 12:01:15.000000000 -0500
> +++ contrib/randomtrain 2002-12-08 12:01:15.000000000 -0500
> @@ -69,7 +69,7 @@
> test "$indic" != "s" -a "$indic" != "n" && usage
> file=$1 ; shift
> if [ ! -r $file ]; then echo "$file not found"; usage; fi
> - grep -b '^From ' $file | \
> + grep -a -b '^From ' $file | \
> awk "BEGIN {FS=\":\"} {print \"$indic $file \"\$1}" >>list.$pid
> wc -c $file | awk "{print \"$indic $file \"\$1}" >>list.$pid
> done
My Solaris version of grep does not have the -a switch and will barf:
bash-2.05$ /usr/bin/grep -a blah /dev/null
/usr/bin/grep: illegal option -- a
Usage: grep -hblcnsviw pattern file . . .
bash-2.05$ uname -a
SunOS wiggum 5.8 Generic_108528-15 sun4u sparc SUNW,Ultra-5_10
--
Matthias Andree
More information about the Bogofilter
mailing list