6.0.0-git
2019-03-19

[#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 2008-04-18 (3987 days ago)
Due
Updated 2008-04-21 (3984 days ago)
Assigned 2008-04-18 (3987 days ago)
Resolved 2008-04-21 (3984 days ago)
Milestone
Patch No

History
2008-04-21 21:26:03 Chuck Hagenbuch Assigned to Chuck Hagenbuch
State ⇒ Resolved
 
2008-04-21 21:11:37 liamr (at) umich (dot) edu Comment #8 Reply to this comment
Seems like it works.  Thanks!
2008-04-21 19:37:40 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?
2008-04-21 18:49:58 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.
2008-04-21 18:44:41 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()
2008-04-18 22:54:14 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.
2008-04-18 21:34:19 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.
2008-04-18 21:11:58 liamr (at) umich (dot) edu Comment #1
Type ⇒ Bug
State ⇒ Unconfirmed
Priority ⇒ 1. Low
Summary ⇒ imp/lib/SpellChecker/aspell.php test for ecode broken
Queue ⇒ IMP
Milestone ⇒
Patch ⇒ No
New Attachment: aspell.log Download
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