php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #60853 Missing NCURSES_KEY_HOME constant
Submitted: 2012-01-23 15:38 UTC Modified: 2012-01-28 02:35 UTC
From: mbt at gator dot net Assigned: rasmus (profile)
Status: Closed Package: ncurses (PECL)
PHP Version: 5.3.9 OS: Linux
Private report: No CVE-ID: None
View Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
If you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: mbt at gator dot net
New email:
PHP Version: OS:

 

 [2012-01-23 15:38 UTC] mbt at gator dot net
Description:
------------
The PECL ncurses extension has a regression:  the NCURSES_KEY_HOME constant is 
not defined when the extension is loaded.

How on earth did this happen??  The first clue I had something was amiss with 
the ncurses codebase showed up in a diff between the PHP 5.2.17 tarball with 
the ncurses extension incorporated and the PECL 1.0.0 tarball:  the ncurses 
files had 2010 as the copyright year; the PECL sources had 2006.

The key difference is in ncurses.c, in which the list of constant-initializing 
macros is rearranged.  The PECL version lacks a PHP_NCURSES_CONST(KEY_HOME) 
line.

A look through the history is a bit more disturbing.  The oldest PHP tarball I 
could find--for version 5.1.4--has ZERO code difference from PECL ncurses 
1.0.0.  Maintenance of the ncurses code did proceed since 2006, especially in 
the rearrangement of the constants in ncurses.c that resulted in adding the 
missing NCURSES_KEY_HOME constant.

How many other regressions happened because you went back to an old version of 
the ncurses code?  I noted a regression at line 1475 of ncurses_functions.c 
that you repaired by version 1.0.1.  The other regressions seem more benign:  
the call to DISPLAY_INI_ENTRIES() in the PHP_MINFO_FUNCTION() at line 277 of 
ncurses.c has nothing to display because there are no .ini entries for the 
extension, and line 35 of ncurses_functions.c has a spelling error (ncruses 
instead of ncurses).

I tried looked at the Subversion repository, but after letting the checkout 
run for several hours it was still running.

I've given you a patch for that you can apply.  I added that patch to the 
Gentoo ebuild I made for dev-php5/pecl-ncurses-1.0.0, rebuilt it, and saw that 
it worked.  I'm hoping the fix makes it out to Debian to get into Squeeze (and 
PHP 5.3) by the time we move to Squeeze at work.

Test script:
---------------
<?php
if (defined('NCURSES_KEY_END'))  {
   if (defined('NCURSES_KEY_HOME'))  {
      echo "PHP has ncurses with definitions for the Home and End keys\n";
   }
   else  {
      echo "Oops:  ncurses extension lacks Home key!!\n";
   }
}
else  {
   echo "It looks like the ncurses extension is not enabled\n";
}

Expected result:
----------------
PHP has ncurses with definitions for the Home and End keys

Actual result:
--------------
Oops:  ncurses extension lacks Home key!!

Patches

restore_homekey.diff (last revision 2012-01-23 15:39 UTC by mbt at gator dot net)

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2012-01-24 14:52 UTC] mbt at gator dot net
-Package: ncurses related +Package: ncurses
 [2012-01-24 14:52 UTC] mbt at gator dot net
Changed package from "Extensibility functions > ncurses related" to "PECL > 
ncurses".  Bah!  I miss the unified code base, a la the Linux kernel.
 [2012-01-28 02:34 UTC] rasmus@php.net
Automatic comment from SVN on behalf of rasmus
Revision: http://svn.php.net/viewvc/?view=revision&amp;revision=322898
Log: Fix bug #60853
 [2012-01-28 02:35 UTC] rasmus@php.net
Patch applied, thanks.
 [2012-01-28 02:35 UTC] rasmus@php.net
-Status: Open +Status: Closed -Assigned To: +Assigned To: rasmus
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Dec 13 18:01:28 2024 UTC