<?xml version="1.0" encoding="ISO-8859-1"?>
<?xml-stylesheet href="http://bugs.horde.org/themes/feed-rss.xsl" type="text/xsl"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
 <channel>
  <title>imp/lib/SpellChecker/aspell.php test for ecode broken</title>
  <pubDate>Fri, 29 Aug 2008 20:21:05 -0400</pubDate>
  <link>http://bugs.horde.org/ticket/6625</link>
  <atom:link rel="self" type="application/rss+xml" title="imp/lib/SpellChecker/aspell.php test for ecode broken" href="http://bugs.horde.org/ticket/6625/rss" />
  <description>imp/lib/SpellChecker/aspell.php test for ecode broken</description>

  
  
  <item>
   <title>per http://marc.info/?l=imp&amp;m=120853832309748&amp;w=2

I think</title>
   <description>per http://marc.info/?l=imp&amp;m=120853832309748&amp;w=2

I think I've tracked the issue down.  IMP is looking for aspell to exit with a code of &quot;0&quot; to decide whether the spellcheck works. 

imp/lib/SpellChecker/aspell.php ~ ln 67:

        if (($ecode = proc_close($process)) != 0) {
            require_once 'PEAR.php';
            if ($this-&gt;_encoding) {
                $err = String::convertCharset($err, $this-&gt;_encoding, $charset);
            }
            return PEAR::raiseError('spellcheck failed: ' . $err, $ecode);
        }

proc_close() doesn't return results you think it's returning.  See...
  http://us2.php.net/manual/en/function.proc-close.php
  http://bugs.php.net/bug.php?id=17538

Apparently, it's especially faulty if you compiled php with --enable-sigchild, which you're told to do if you're trying to use oracle on linux.

The debugging stubs I placed in aspell.php clearly show that aspell is being invoked, and is returning the expected output.  If I change..

   proc_close($process)) != 0

to look for -1, spellchecking works just dandy.
</description>
   <pubDate>Fri, 18 Apr 2008 17:11:58 -0400</pubDate>
   <link>http://bugs.horde.org/ticket/6625#t44727</link>
  </item>
  <item>
   <title>Can you test if the:

$ret = (proc_close($proc) &gt;&gt; 8) &amp; 0x</title>
   <description>Can you test if the:

$ret = (proc_close($proc) &gt;&gt; 8) &amp; 0xff;

Trick works, and if it still works if you create a genuine failure? We can't just check for -1, since 0 _is_ being returned in other working PHP installs.</description>
   <pubDate>Fri, 18 Apr 2008 17:34:19 -0400</pubDate>
   <link>http://bugs.horde.org/ticket/6625#t44732</link>
  </item>
  <item>
   <title>The code just makes it return 255 instead of -1 on the effec</title>
   <description>The code just makes it return 255 instead of -1 on the effected machine, which I've read might just be another way to say &quot;-1&quot;.  

I'd like to know why it works (returns exit code 0) in our dev environment but not our test environment.. but I haven't figured that out yet.  In the meantime, if I rebuild php without --enable-sigchild, the problem seems to go away.  That can't be the answer, tho.</description>
   <pubDate>Fri, 18 Apr 2008 18:54:14 -0400</pubDate>
   <link>http://bugs.horde.org/ticket/6625#t44735</link>
  </item>
  <item>
   <title>I can't figure out the difference between our test and devel</title>
   <description>I can't figure out the difference between our test and development environments re: this issue.

As mentioned in...
http://bugs.php.net/bug.php?id=29123

    [16 Jul 2004 1:32am UTC] iliaa@php.net

    When sigchild is used the return status from pclose and 
    proc_close() cannot be retrieved. 

And --enable-sigchild is strongly recommended for PHP users using Oracle.  So.. if oracle is going to remain supported, I really think you have to find another way to judge whether aspell is working than checking the exit code provided by proc_close()</description>
   <pubDate>Mon, 21 Apr 2008 14:44:41 -0400</pubDate>
   <link>http://bugs.horde.org/ticket/6625#t44769</link>
  </item>
  <item>
   <title>Well sure, that's what we're trying to do. What would you su</title>
   <description>Well sure, that's what we're trying to do. What would you suggest? Maybe ask Ilia what people who _do_ use Oracle should do.</description>
   <pubDate>Mon, 21 Apr 2008 14:49:58 -0400</pubDate>
   <link>http://bugs.horde.org/ticket/6625#t44770</link>
  </item>
  <item>
   <title>I don't actually know any of the PHP developers, so I've tac</title>
   <description>I don't actually know any of the PHP developers, so I've tacked a comment onto one of the bugs I perceived to be applicable (and that was still allowing comments).  If one of you has an in with the folks at php.net, could you pursue this?

In the meantime, what about replacing...

        if (($ecode = proc_close($process)) != 0) {

with something like..

        if (strlen($out) == 0) {

or 

        if (empty($out)) {

if there's a problem invoking aspell, $out stays empty, but $err gets filled.. so this seemed like it might work ok?</description>
   <pubDate>Mon, 21 Apr 2008 15:37:40 -0400</pubDate>
   <link>http://bugs.horde.org/ticket/6625#t44772</link>
  </item>
  <item>
   <title>Try:
http://cvs.horde.org/diff.php?r1=1.9&amp;r2=1.10&amp;f=imp%2Fl</title>
   <description>Try:
http://cvs.horde.org/diff.php?r1=1.9&amp;r2=1.10&amp;f=imp%2Flib%2FSpellChecker%2Faspell.php

?</description>
   <pubDate>Mon, 21 Apr 2008 17:00:52 -0400</pubDate>
   <link>http://bugs.horde.org/ticket/6625#t44775</link>
  </item>
  <item>
   <title>Seems like it works.  Thanks!</title>
   <description>Seems like it works.  Thanks!</description>
   <pubDate>Mon, 21 Apr 2008 17:11:37 -0400</pubDate>
   <link>http://bugs.horde.org/ticket/6625#t44776</link>
  </item>
  

 </channel>
</rss>
