6.0.0-beta1
8/1/25

[#6625] imp/lib/SpellChecker/aspell.php test for ecode broken
Summary imp/lib/SpellChecker/aspell.php test for ecode broken
Queue IMP
Queue Version FRAMEWORK_3
Type Bug
State Resolved
Priority 1. Low
Owners chuck (at) horde (dot) org
Requester liamr (at) umich (dot) edu
Created 04/18/2008 (6314 days ago)
Due
Updated 04/21/2008 (6311 days ago)
Assigned 04/18/2008 (6314 days ago)
Resolved 04/21/2008 (6311 days ago)
Github Issue Link
Github Pull Request
Milestone
Patch No

History
04/21/2008 09:26:03 PM Chuck Hagenbuch Assigned to Chuck Hagenbuch
State ⇒ Resolved
 
04/21/2008 09:11:37 PM liamr (at) umich (dot) edu Comment #8 Reply to this comment
Seems like it works.  Thanks!
04/21/2008 07:37:40 PM liamr (at) umich (dot) edu Comment #6 Reply to this comment
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?
04/21/2008 06:49:58 PM Chuck Hagenbuch Comment #5 Reply to this comment
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.
04/21/2008 06:44:41 PM liamr (at) umich (dot) edu Comment #4 Reply to this comment
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()
04/18/2008 10:54:14 PM liamr (at) umich (dot) edu Comment #3 Reply to this comment
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 "-1".



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.
04/18/2008 09:34:19 PM Chuck Hagenbuch Comment #2
State ⇒ Feedback
Reply to this comment
Can you test if the:



$ret = (proc_close($proc) >> 8) & 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.
04/18/2008 09:11:58 PM liamr (at) umich (dot) edu Comment #1
Priority ⇒ 1. Low
Type ⇒ Bug
Summary ⇒ imp/lib/SpellChecker/aspell.php test for ecode broken
Queue ⇒ IMP
Milestone ⇒
Patch ⇒ No
New Attachment: aspell.log Download
State ⇒ Unconfirmed
Reply to this comment
per http://marc.info/?l=imp&m=120853832309748&w=2



I think I've tracked the issue down.  IMP is looking for aspell to 
exit with a code of "0" 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->_encoding) {

                 $err = String::convertCharset($err, $this->_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.


Saved Queries