[dokuwiki] Re: Bug in spellchecker

  • From: Andreas Gohr <andi@xxxxxxxxxxxxxx>
  • To: dokuwiki@xxxxxxxxxxxxx
  • Date: Fri, 10 Jun 2005 23:34:31 +0200


> The problem is your new line by line input loop in inc/aspell.php line
> 185ff. You read a line and check it for EOL because this tells you
> that the current line is completely processed. The input buffer is
> 8192 Bytes wide and after reading the last complete line out of it
> (which is not a single EOL) there are some characters left. The next
> fgets() call neither can't retrieve a complete line nor 8192
> characters (your specified length). So fgets() waits for further input
> and doesn't return -> bang! Aspell on the other side waits for someone
> reading the last bytes from the buffer -> deadlock.

Hmm maybe I understood the documentation wrong... Here is what I thought: fgets 
should return either a complete line (with one newline at the end or 8192 bytes 
of other chars... in both cases we can expect more output from aspell so we 
continue to read. If aspell outputs an empty line, fgets should return exactly 
one byte with a newline... correct? 

So obviously this didn't work for you (while it did for me) can you point me in 
the right direction and tell me how you fixed the loop?

> I repaired this loop and the checker ran through, but the output is
> still corrupted. I think you searched in the wrong direction and your
> last changes weren't necessary, because we had this state already. I'm
> sorry to say this.

Well these changes did correct the output for me so i can't be all wrong ;-)
> A second hint: You parsed lines beginning with '&' and '#' but no
> lines beginning with '?'. As you could see in the output the last line
> of the wiki page I sent to you is a line beginning with '?' and it's
> the only one. This is the first line with rubbish in it, starting from
> the bottom of the text (As I got it right the text is parsed
> bottom-up).

You're right! That's very strange - straight from the manual:

... output lines can be summarized as follows:

OK: *
Suggestions: & original count offset: miss, miss, ...
None: # original offset

However ispell which aspell claims to be compatible to does have the 

... output lines can be summarized as follows:

OK:    *
Root:  + <root>
Compound: -
Miss:  & <original> <count> <offset>: <miss>, <miss>, ..., <guess>, ...
Guess: ? <original> 0 <offset>: <guess>, <guess>, ...
None:  # <original> <offset>

So I guess we should check for these modes, too.


Other related posts: