Bogofilter, Cygwin, EOL issue

Ismael Valladolid Torres ismaeval at free.fr
Wed Jan 26 15:29:58 CET 2005


David Relson escribe:
> On Wed, 26 Jan 2005 11:50:53 +0100
> Ismael Valladolid Torres wrote:
> 
> > I compiled Bogofilter 0.93.5 on Windows using Cygwin's gcc. When used
> > as a filter, it outputs DOS end-of-lines instead of UNIX
> > end-of-lines. I need UNIX end-of-lines so my cygwinized Mutt displays
> > messages properly. This snippet works on my .procmailrc:
> > 
> > :0 fw
> > | bogofilter -u -e -p
> > 
> > :0 fw
> > | dos2unix
> > 
> > However this behaviour seems very strange to me.
> > 
> > Cordially, Ismael
> 
> Hello Ismael,
> 
> An interesting experiment!  I'm not surprised to hear that Cygwin gcc
> compiles bogofilter.  Using '-p' activates code in passthrough.c to
> output the message.  Looking at the code, I see two possible
> explanations for your problem:
> 
> First, the code uses fprintf and fputs to output an end-of-line string. 
> The string is set in function write_header to either NL or CRLF
> (depending on what the input looks like).  You may need to disable the
> CRLF setting.

I understand you mean that if bogofilter sees that input format is
UNIX, it will use UNIX as output and if it sees that input format is
DOS, will use DOS.

Nevertheless, I am piping to bogofilter a single message in UNIX
format and output is DOS format.

> Second, fprintf and fputs may be converting the NL to a CRLF pair.  In
> fact, this would be considered normal behavior for C in the DOS/Windows
> environment.  You'll need to run an experiment to see what's really
> happening.  Assuming fprintf is the culprit, you _could_ change
> bogofilter to use fwrite(eol) to force a single character NL to be
> written.  It's probably simpler to just use dos2unix.

Maybe this is a problem with files opened as [1]O_BINARY, where text
mode should be being used instead.

1. http://www.cygwin.com/faq/faq_3.html#SEC74

Cordially, Ismael
-- 
Ismael Valladolid Torres    Oberthur Card Systems
Technical Support           C/ Manuel Tovar, 16, 1ª pta., Oficina dcha.
i.valladolid at oberthurcs.com 28034 Madrid (Spain)
Web: www.oberthurcs.com     Tel.: +34 917 355 461 - Fax: +34 917 355 452
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 186 bytes
Desc: not available
URL: <http://www.bogofilter.org/pipermail/bogofilter/attachments/20050126/32894c55/attachment.sig>


More information about the Bogofilter mailing list