Ispell Bug

Aryeh M. Weiss aryeh at eddie.MIT.EDU
Fri Sep 15 22:56:58 AEST 1989


In Article 1976 of comp.sources.bugs, Frank Kolakowski writes:

> Has anyone noticed that when ispell is running on more that one file
> it forgets the ~/.ispell_words contents and continually thinks those
> words are mispelled, so I fixed this by a for f in *; do ispell $f
> loop. 
> 
> Any ideas, fixes or magic incantations?
> 
> Frank Kolakowski 

This has been driving me nuts for a long time.  I found that the
actual events were (1) invoke ispell with multiple files, (2) while
correcting words add to personal dictionary (via `I'), (3) when ispell
goes on to next file, ispell has forgotten words in personal
dictionary.

Cause: after ispell is done with a file it writes out the personal
dictionary (to ~/.ispell_words) IF the dictionary has been updated by
the user.  In doing so ispell fiddles with the case of the words in
memory.  Internally ispell handles everything in UPPER CASE, using
some bit flags to keep track of capitalization, but in writing out the
file it converts the words to lower case.  (This actually only occurs
if the CAPITILIZATION compile flag is turned on.)  Later when comparing words
it can't find matches between words in the file it is scanning and the
PD because of the case mismatch.  The fix: convert word in PD back to
UC after write in tree.c:

#! /bin/sh
# To extract, remove mail header lines and type "sh filename"
echo x - ispell.diffs
sed -e 's/^X//' > ispell.diffs << '!FaR!OuT!'
X*** tree.c	Thu Sep 14 14:28:15 1989
X--- tree.c~	Thu Sep 14 14:32:44 1989
X***************
X*** 660,666 ****
X  			cent->word[0] = toupper (cent->word[0]);
X  		toutword (cent->word, cent);
X  	}
X- 	upcase (cent->word);	/* return word to uppercase -- EF (89/09/13) */
X  #else
X  	toutword (cent->word, cent);
X  #endif
X--- 660,665 ----
X*** version.h	Thu Sep 14 14:34:31 1989
X--- version.h~	Thu Sep 14 15:04:37 1989
X***************
X*** 1,2 ****
X  static char Version_ID[] =
X!     "@(#) Ispell Version 2.0.02, May 1987 Beta posting";
X--- 1,2 ----
X  static char Version_ID[] =
X!     "@(#) Ispell Version 2.0.01, May 1987 Beta posting";
!FaR!OuT!
exit
-- 
aryeh at eddie.mit.edu
mit-eddie!lees-rif!aryeh



More information about the Comp.sources.bugs mailing list