php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #48608 Invalid libreadline version not detected during configure
Submitted: 2009-06-19 17:07 UTC Modified: 2009-08-04 11:48 UTC
From: shahar dot e at zend dot com Assigned: jani (profile)
Status: Closed Package: Readline related
PHP Version: 5.3CVS-2009-06-19 (snap) OS: Mac OS X 10.5
Private report: No CVE-ID: None
 [2009-06-19 17:07 UTC] shahar dot e at zend dot com
Description:
------------
The default libreadline version that comes with OS X is too old and seems to be missing symbols like rl_mark, rl_pending_input, rl_history_list, rl_on_new_line. This is not detected by ./configure

I am not sure what the minimum requirement is, but adding a check for rl_pending_input in the config.m4 file fixed the problem for me (or more correctly, I got proper detection by ./configure).

Reproduce code:
---------------
./configure --with-readline on a default Mac OS X setup (I think it's 4.2)

Expected result:
----------------
Configure to report a too old version of libreadline

Actual result:
--------------
Configure works, linking ext/readline fails due to missing symbols.

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2009-06-19 17:09 UTC] shahar dot e at zend dot com
I used this patch to fix it, perhaps there is a better way (like checking a minimum version):

--- ext/readline/config.m4.orig 2009-06-19 19:50:29.000000000 +0300
+++ ext/readline/config.m4      2009-06-19 19:47:51.000000000 +0300
 -43,6 +43,12 @@
     -L$READLINE_DIR/$PHP_LIBDIR $PHP_READLINE_LIBS
   ])
 
+  dnl Check that libreadline has rl_pending_input defined
+  PHP_CHECK_LIBRARY(readline, rl_pending_input, 
+  [], [
+    AC_MSG_ERROR(readline library is missing some symbols and is probably too old)
+  ], [])
+
   PHP_CHECK_LIBRARY(readline, rl_callback_read_char,
   [
     AC_DEFINE(HAVE_RL_CALLBACK_READ_CHAR, 1, [ ])
 [2009-08-03 11:04 UTC] jani@php.net
Exactly what readline version is it? I tested with 4.2 and it compiles just fine.
 [2009-08-03 13:04 UTC] shahar dot e at zend dot com
Thanks for looking into this.

I am not entirely sure how to check this, but looking at an include/readline/readline.h that works, I see:

#define RL_READLINE_VERSION     0x0600          /* Readline 6.0 */

While on the one that doesn't work, I see:

#define RL_READLINE_VERSION     0x0402

So I'm assuming that's readline 4.02 and not 4.2 as I thought before. 

Then again, according to this discussion: http://discussions.apple.com/message.jspa?messageID=7387944 - it seems that libreadline provided with OS X 10.5 is not really libreadline, but just a not-fully compatible wrapper. If this is true, it is probably a good idea to check for those symbols anyway to avoid this problem on Mac OS X (but perhaps change the error message I added in my patch).

Shahar.
 [2009-08-03 13:10 UTC] jani@php.net
How nice of Apple. Why don't they use libedit? :)
Is the missing rl_pending_input symbol really the only difference? 

 [2009-08-03 14:39 UTC] shahar dot e at zend dot com
From what I've seen there's a bunch of missing symbols - since I assumed it's a version issue I added a check for just one, but given what we know now, it might be wiser to check for more stuff. 

'make' complains about these symbols: 'rl_mark', 'rl_done', 'rl_pending_input'
 [2009-08-03 15:09 UTC] jani@php.net
One more question: Without installing anything extra, does using --with-libedit instead work..? As that should be installed there..
 [2009-08-03 16:14 UTC] shahar dot e at zend dot com
Yes, using --with-libedit compiles and works as expected
 [2009-08-03 23:05 UTC] jani@php.net
Ok. I have this fixed at work laptop, I added a friendly suggest notice 
to point out that using --with-libedit might work. :)
 [2009-08-04 11:20 UTC] svn@php.net
Automatic comment from SVN on behalf of jani
Revision: http://svn.php.net/viewvc/?view=revision&revision=286797
Log: - Fixed bug #48608 (Invalid libreadline version not detected during configure)
 [2009-08-04 11:48 UTC] jani@php.net
This bug has been fixed in SVN.

Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
http://snaps.php.net/.
 
Thank you for the report, and for helping us make PHP better.


 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Dec 21 12:01:31 2024 UTC