aspell-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[aspell-devel] argument transcoding bug fix


From: Zachary Bodnar
Subject: [aspell-devel] argument transcoding bug fix
Date: Thu, 26 Apr 2007 13:05:31 -0400

I believe I have found a bug in aspell. If you have moved your aspell .cset and .cmap files to a location that is different from where they were installed by the build system, you need to use the -- data-dir command line argument to override the aspell's built-in default search path. Generally this works. However, if you have set your LANG environment variable to something like en_US, you will get a error of the form:

Error: The encoding "iso-8859-1" is not known. This could also mean that the file "/[location of aspell build output]/lib/aspell-0.60/ iso-8859-1.cmap" could not be opened for reading or does not exist.

The problem appears to be in Config::commit_all:

PosibErr<void> Config::commit_all(Vector<int> * phs, const char * codeset)
 {
   committed_ = true;
   others_ = first_;
   first_ = 0;
   insert_point_ = &first_;
   Conv to_utf8;
   if (codeset)
     RET_ON_ERR(to_utf8.setup(*this, codeset, "utf-8", NormTo));
   while (others_) {
     *insert_point_ = others_;
     others_ = others_->next;
     (*insert_point_)->next = 0;
RET_ON_ERR_SET(commit(*insert_point_, codeset ? &to_utf8 : 0), int, place_holder); if (phs && place_holder != -1 && (phs->empty() || phs->back() ! = place_holder))
       phs->push_back(place_holder);
     insert_point_ = &((*insert_point_)->next);
   }
   return no_err;
 }

Specifically, to_utf8.setup(*this, codeset, "utf-8", NormTo) is called AFTER the first_ pointer is reset. This means that "data-dir" config option is not found by the conversion code, and therefore only the default path is searc. It seems like rearranging the code as follows would fix the problem:

PosibErr<void> Config::commit_all(Vector<int> * phs, const char * codeset)
 {
   Conv to_utf8;
   if (codeset)
     RET_ON_ERR(to_utf8.setup(*this, codeset, "utf-8", NormTo));

  committed_ = true;
   others_ = first_;
   first_ = 0;
   insert_point_ = &first_;

   while (others_) {
     *insert_point_ = others_;
     others_ = others_->next;
     (*insert_point_)->next = 0;
RET_ON_ERR_SET(commit(*insert_point_, codeset ? &to_utf8 : 0), int, place_holder); if (phs && place_holder != -1 && (phs->empty() || phs->back() ! = place_holder))
       phs->push_back(place_holder);
     insert_point_ = &((*insert_point_)->next);
   }
   return no_err;
 }

Are there any side-effects to doing this that I'm not aware of?







reply via email to

[Prev in Thread] Current Thread [Next in Thread]