[PATCH] randomtrain utility gets confused by spams with null bytes

Greg Louis glouis at dynamicro.on.ca
Sun Dec 8 18:05:38 CET 2002


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


-- 
| G r e g  L o u i s          | gpg public key:      |
|   http://www.bgl.nu/~glouis |   finger greg at bgl.nu |




More information about the Bogofilter mailing list