Bug #23293 readline detection broken on NetBSD
Submitted: 14 Oct 2006 17:16 Modified: 7 Feb 2007 19:23
Reporter: Juan RP Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Compiling Severity:S3 (Non-critical)
Version:5.0.27-BK, 5.0.26 OS:
Assigned to: Joerg Bruehe CPU Architecture:Any
Tags: Contribution, netbsd, readline

[14 Oct 2006 17:16] Juan RP
Description:
Readline detection in latest version of mysql-5.x is broken, it tries to run a function callback via a pointer, which is wrong on NetBSD.

The following patch fixes the problem and we've been using it on the NetBSD packages collection (pkgsrc) for long time now.

It would be nice if you can apply it for the next version, thanks.

How to repeat:
cd pkgsrc/databases/mysql5-client && make configure

Suggested fix:
Please apply the following patch (we are using this patch on the NetBSD packages collection):

--- config/ac-macros/readline.m4.orig   2006-10-14 19:03:29.000000000 +0200
+++ config/ac-macros/readline.m4        2006-10-14 19:03:37.000000000 +0200
@@ -26,7 +26,7 @@
                #include "readline/readline.h"
            ],
            [ 
-               char res= *(*rl_completion_entry_function)(0,0);
+               char res= (*rl_completion_entry_function)(0,0);
                completion_matches(0,0);
            ],
            [
[16 Oct 2006 11:52] Valeriy Kravchuk
Thank you for a problem report. Current source in 5.0.27-BK is still the same.
[30 Jan 2007 14:42] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/19010

ChangeSet@1.2390, 2007-01-30 15:42:02+01:00, joerg@trift2. +1 -0
  config/ac-macros/readline.m4
      Fix for bug#23293 (compile problem on NetBSD): Drop a '*' which does not belong there anyway.
[31 Jan 2007 9:27] Joerg Bruehe
Sorry to say:  The proposed patch is wrong.

It may fix the immediate "configure" problem, but that is just due to an inconsistency withing "libedit": The header files do not match the function specification and use.

As a consequence, my changeset for this (see previous "patch pending") was wrong as well and will not be pushed.

I am working on a more thorough fix.
[31 Jan 2007 14:51] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/19091

ChangeSet@1.2392, 2007-01-31 15:25:56+01:00, joerg@trift2. +3 -0
  Fix bug#23293 "readline detection broken on NetBSD":
  
  Its root cause is a difference between the "readline" and "libedit" (header files)
  definitions of "rl_completion_entry_function", where the "libedit" one is wrong anyway:
  This variable is used as a pointer to a function returning "char *",
  but "libedit" declares it as returning "int" and then adds casts on usage.
  
  Change it to "CPFunction *" and get rid of the casts.
[31 Jan 2007 17:38] Joerg Bruehe
The patch is pushed into the trees for versions 5.0.36 and 5.1.16-beta.

It contains a cleanup for the "libedit" header file making it consistent with that for "readline" and avoiding several casts.

I am *not* sure whether this is sufficient to solve the NetBSD issue, though, but I have no suitable environment.
So I would appreciate it very much if the reporter, JuanRP, or somebody else with a suitable setup could download the patch, try it, and report back.
I hope that with my fix we have a consistent base to fix any issue specific to NetBSD.
[7 Feb 2007 19:23] Paul DuBois
Noted in 5.0.36, 5.1.16 changelogs.

readline detection did not work correctly on NetBSD.