#25727 [Fbk->Opn]: popen returns wrong exitcode
| From: | eru@php.net | Date: | Fri, 03 Oct 2003 23:36:37 +0000 |
| Subject: | #25727 [Fbk->Opn]: popen returns wrong exitcode | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-48534@lists.php.net to get a copy of this message | ||
ID: 25727
User updated by: eru@php.net
Reported By: eru@php.net
-Status: Feedback
+Status: Open
Bug Type: Filesystem function related
Operating System: i386 Linux
PHP Version: 4CVS-2003-10-03 (stable)
New Comment:
I tested the script on RH 8 and 9 with their current packets.
I made some very strange observations today, I was able to get the
correct result, but I wasn't able to reproduce the steps exactly. I
still have the impression, that it is some strange interaction with the
shell and/or their variables. This may sound stupid, but it was the
only difference I saw when I got correct results. Btw. I'm using tcsh,
popen seems to use /bin/sh.
RH8 RH9
--- ---
gcc 3.2-7 3.2.2-5
glibc 2.3.2 same
bash 2.0.5b same
tcsh 6.12 same
Previous Comments:
------------------------------------------------------------------------
[2003-10-03 19:17:17] sniper@php.net
Exactly what linux version is this with?
What glibc? Gcc? etc..
------------------------------------------------------------------------
[2003-10-03 11:10:08] eru@php.net
No change, I still get the Actual result (with fgets).
------------------------------------------------------------------------
[2003-10-02 19:31:25] iliaa@php.net
Please try using this CVS snapshot:
http://snaps.php.net/php4-STABLE-latest.tar.gz
For Windows:
http://snaps.php.net/win32/php4-win32-STABLE-latest.zip
I too (like sniper) get the correct output int(0)
------------------------------------------------------------------------
[2003-10-02 10:45:08] sniper@php.net
For me the output is (when replaced fread with fgets) this:
FOO
int(0)
------------------------------------------------------------------------
[2003-10-02 09:00:17] wez@php.net
If you pclose before all the data has been read, you might
cause the child process to terminate abnormally, and this
might explain the exit code.
In addition, fread() will only read a "packet" from a pipe,
so you might not be getting all the data before you pclose
it.
*that's* what fread/fgets() has got to do with it;
in future, please don't question my suggestions and just
provide the requested feedback.
------------------------------------------------------------------------
The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
http://bugs.php.net/25727
--
Edit this bug report at http://bugs.php.net/?id=25727&edit=1