php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #56871 Segmentation fault on expect_expectl
Submitted: 2006-03-02 09:06 UTC Modified: 2007-10-21 12:55 UTC
From: avax at n1ck dot name Assigned:
Status: Closed Package: expect (PECL)
PHP Version: 5.1.1 OS: Gentoo
Private report: No CVE-ID: None
 [2006-03-02 09:06 UTC] avax at n1ck dot name
Description:
------------
expect  0.2     beta

#php expect_sample.php
sh: expect://ssh: No such file or directory
Segmentation fault


Reproduce code:
---------------
script from http://ru.php.net/expect

<?php
ini_set ("expect.loguser", "Off");

$stream = popen ("expect://ssh root@remotehost uptime", "r");

$cases = array (
  array (0 => "password:", 1 => PASSWORD)
);

switch (expect_expectl ($stream, $cases))
{
 case PASSWORD:
  fwrite ($stream, "password\n");
  break;
 
 default:
  die ("Error was occurred while connecting to the remote host!\n");
}

while ($line = fgets ($stream)) {
  print $line;
}
fclose ($stream);
?>

Expected result:
----------------
work expect_expectl


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2006-03-02 09:55 UTC] avax at n1ck dot name
back trace

[Thread debugging using libthread_db enabled]
[New Thread 16384 (LWP 21909)]
sh: expect://ssh: No such file or directory

Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 16384 (LWP 21909)]
0xb759796f in exp_printify () from /usr/lib/libexpect.so
(gdb) bt
#0  0xb759796f in exp_printify () from /usr/lib/libexpect.so
#1  0xb7596c6e in exp_expectv () from /usr/lib/libexpect.so
#2  0xb7f167d6 in zif_expect_expectl (ht=2, return_value=0x86ba944, return_value_ptr=0x0, this_ptr=0x0, return_value_used=1)
    at /tmp/tmpl82GSK/expect-0.2/expect.c:256
#3  0x08292532 in zend_get_zval_ptr_ptr ()
#4  0x08291788 in execute ()
#5  0x0826a075 in zend_execute_scripts ()
#6  0x0822a8dd in php_execute_script ()
#7  0x082e3728 in main ()


---

php -i | head
phpinfo()
PHP Version => 5.1.1-gentoo

System => Linux xxx.ru 2.6-air2 #1 SMP Thu Aug 4 00:58:33 MSD 2005 i686
Build Date => Mar  1 2006 11:01:18
Configure Command =>  './configure' '--prefix=/usr/lib/php5' '--enable-pty' '--sysconfdir=/etc' '--cache-file=./config.cache' '--enable-cli' '--disable-cgi' '--with-config-file-path=/etc/php/cli-php5' '--with-config-file-scan-dir=/etc/php/cli-php5/ext-active' '--without-pear' '--enable-bcmath' '--with-bz2' '--disable-calendar' '--disable-ctype' '--with-curl' '--without-curlwrappers' '--disable-dbase' '--enable-exif' '--without-fbsql' '--without-fdftk' '--disable-filepro' '--enable-ftp' '--with-gettext' '--with-gmp' '--without-hwapi' '--without-informix' '--without-kerberos' '--enable-mbstring' '--with-mcrypt' '--disable-memory-limit' '--with-mhash' '--without-ming' '--without-msql' '--without-mssql' '--with-ncurses' '--without-oci8' '--without-oci8-instant-client' '--with-openssl' '--with-openssl-dir=/usr' '--enable-pcntl' '--disable-pdo' '--without-pgsql' '--with-pspell' '--without-recode' '--disable-shmop' '--without-snmp' '--disable-soap' '--enable-sockets' '--disable-spl' '--without-sybase' '--without-sybase-ct' '--disable-sysvmsg' '--disable-sysvsem' '--disable-sysvshm' '--without-tidy' '--disable-tokenizer' '--disable-wddx' '--without-xmlreader' '--without-xmlrpc' '--without-xsl' '--with-zlib' '--disable-debug' '--enable-dba' '--with-cdb' '--with-db4' '--without-flatfile' '--with-gdbm' '--with-inifile' '--without-qdbm' '--with-freetype-dir=/usr' '--with-t1lib=/usr' '--disable-gd-jis-conv' '--enable-gd-native-ttf' '--with-jpeg-dir=/usr' '--with-png-dir=/usr' '--without-xpm-dir' '--with-gd' '--with-imap' '--with-imap-ssl' '--with-mysql=/usr/lib/mysql' '--with-mysql-sock=/var/run/mysqld/mysqld.sock' '--without-mysqli' '--with-readline' '--without-libedit' '--without-mm' '--without-sqlite'
Server API => Command Line Interface
Virtual Directory Support => disabled
Configuration File (php.ini) Path => /etc/php/cli-php5/php.ini
Scan this dir for additional .ini files => /etc/php/cli-php5/ext-active
 [2006-03-07 07:28 UTC] michael at zend dot com
The example was wrong, it should be "fopen" instead of "popen". Anyway it shouldn't core dump... We will check it.
 [2007-10-21 12:55 UTC] spektom at gmail dot com
This bug has been fixed in CVS.

In case this was a documentation problem, the fix will show up at the
end of next Sunday (CET) on pecl.php.net.

In case this was a pecl.php.net website problem, the change will show
up on the website in short time.
 
Thank you for the report, and for helping us make PECL better.


 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Apr 25 16:01:28 2024 UTC