[imp] run away ispell processes
Adam Arrowood
adam@oit.gatech.edu
Thu, 19 Sep 2002 09:38:51 -0400
On Thursday, July 25, 2002, at 02:05 AM, Chuck Hagenbuch wrote:
> Quoting Adam Arrowood <adam@oit.gatech.edu>:
>
>> I have run into the same problem, and think I have a work around. It
>> seems to be a problem with echo'ing large (>1024 character) strings
>> piped into ispell. I have written some test cases in php (outside of
>> IMP), and it does occur, but not every time. I can say that it I've
>> only
>> had it happen with large messages, but not every large message hangs
>> it.
>>
>> Anyway, my work around is to dump the message into a tmp file and
>> call a shell script to pipe it through ispell.
>
> I've committed something similar to this, but without the need for the
> wrapper. If it works for people in HEAD, I'll merge it to RELENG.
>
> -chuck
> Charles Hagenbuch, <chuck@horde.org>
My fix didn't seem to completely get rid of the run-away ispell
processes,
at least on Solaris 8. I'm pretty sure I've got it fixed now, though...
I am seeing ispell (International Ispell Version 3.2.06) get stuck in an
endless loop when presented with a file to check that is only one line
and greater than ~ 252 characters. I say ~, because it doesn't always
happen... just *most* of the time.
Given that IMP's textarea for message text is a "hard" wrap, I
shouldn't see
single line messages, right? Well, when an Internet Explorer user does a
spell check that results in more than one "page" of spelling errors,
clicking
on the "next" button results in IE sending the message to compose.php,
not from
a textarea tag, but from a hidden tag. IE, both on Mac and Windows,
sends the
message contained in the hidden tag using carriage returns (ascii 13),
not
new lines (ascii 10), as it does when submitting from a textarea tag.
Ispell,
at least on Solaris, wants to see new lines, not carriage returns and
will
hang otherwise. So, the solution is to modify my wrapper. It's now:
------------------------------------------------------------------------
--
#! /bin/sh
LINES=`/usr/bin/egrep -c . $1`
if [ "$LINES" = "1" ] ; then
/usr/bin/cat $1 | /usr/bin/perl -pe 's/\r/\n/g' | /usr/local/bin/ispell
-a
else
/usr/bin/cat $1 | /usr/local/bin/ispell -a
fi
------------------------------------------------------------------------
--
If you don't have perl installed (what, you don't have perl installed
!!??!),
you can use nawk instead... (/bin/nawk '{gsub("\r", "\n"); print}' $1).
The real fix, of course, would be to fix IE (which won't happen), fix
ispell (I'll send a copy of this message to their bug report address)...
or use apell (which seems to only compile cleanly with gcc, not the Sun
Workshop compiler).
-adam arrowood
adam@oit.gatech.edu
--
Adam Arrowood || http://www.gatech.edu/adam || adam@oit.gatech.edu
Office of Information Technology/O&E/CS
Georgia Institute of Technology, Atlanta, GA USA
(404) 894-0372 work || (404) 310-0108 cell