ID:               33147
 User updated by:  skissane at iips dot mq dot edu dot au
 Reported By:      skissane at iips dot mq dot edu dot au
-Status:           Feedback
+Status:           Open
 Bug Type:         Program Execution
 Operating System: Linux
 PHP Version:      5.0.4
 New Comment:

Tested with the patch you supplied. (Patch would not apply, so I had to
apply most of it by hand.) My test case works with the test you
supplied, and --enable-pty supplied as a config option.


Previous Comments:
------------------------------------------------------------------------

[2005-05-26 10:16:03] [EMAIL PROTECTED]

Please test the patch in this letter:
http://www.mail-archive.com/internals@lists.php.net/msg14854.html

------------------------------------------------------------------------

[2005-05-26 09:57:11] skissane at iips dot mq dot edu dot au

I've been running some tests of mine own, and it seems to work for me.
Here is a PHP test case for this bug:

(Note, I should have a SKIPIF which tests for the existence of the
ptsname(), grantpt() and unlockpt() C language functions on the
system... but I don't know how to write such a SKIPIF test...)

--TEST--
Bug #33147 (proc_open: basic test of Unix98 PTYs functionality)
--FILE--
<?php
// Create a pseudo terminal for the child process
$descriptorspec = array(
   0 => array("pty"),
   1 => array("pty"),
   2 => array("pty")
);
$process = proc_open("echo this is working", $descriptorspec, $pipes);
if (is_resource($process)) {
        echo "OK\n";
        while (!feof($pipes[1]))
                echo fread($pipes[1],1024);
}
?>
--EXPECT--
OK
this is working

------------------------------------------------------------------------

[2005-05-26 09:24:00] skissane at iips dot mq dot edu dot au

With the "#if 0" removed, my test case works fine.

I have a more complex application I have been developing with
proc_open, which might really benefit from pty support. I shall now
test it with that application.

------------------------------------------------------------------------

[2005-05-26 08:36:53] skissane at iips dot mq dot edu dot au

Looked at ext/standard/proc_open.c, lines 59-63. Found the following
code:

#if 0 && HAVE_PTSNAME && HAVE_GRANTPT && HAVE_UNLOCKPT &&
HAVE_SYS_IOCTL_H && HAVE_TERMIOS_H
# include <sys/ioctl.h>
# include <termios.h>
# define PHP_CAN_DO_PTS 1
#endif


Why is this "#if 0"? Is it broken? The docs state that the feature is
available in PHP 5 or greater. I will try removing the #if 0, and
seeing what happens.

------------------------------------------------------------------------

[2005-05-26 07:06:28] skissane at iips dot mq dot edu dot au

Description:
------------
Trying to use Unix98 pty's with proc_open gives error " pty pseudo
terminal is not support on this system in ". But, /dev/ptmx exists, and
devpts is mounted on /dev/pts!

PHP configuration: 

'./configure' '--enable-cli' '--disable-cgi' '--with-xsl'
'--prefix=/usr/local/php-5.0.4/' '--with-dba' '--with-cdb'
'--with-mssql=/usr/local'




Reproduce code:
---------------
<?php
// Create a pseudo terminal for the child process
$descriptorspec = array(
   0 => array("pty"),
   1 => array("pty"),
   2 => array("pty")
);
$process = proc_open("ls -l /", $descriptorspec, $pipes);
if (is_resource($process)) {
        echo "OK!";
}
else {
        echo "FAIL!";
}
?>


Expected result:
----------------
OK!

Actual result:
--------------
Warning: proc_open(): pty pseudo terminal is not support on this system
in /home/skissane/php-5.0.4/ptytest.php on line 8
FAIL!



------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=33147&edit=1

Reply via email to