NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

lib/44186: Problem with rl_display_match_list in libedit



>Number:         44186
>Category:       lib
>Synopsis:       Problem with rl_display_match_list in libedit
>Confidential:   no
>Severity:       serious
>Priority:       high
>Responsible:    lib-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Thu Dec 02 22:50:00 +0000 2010
>Originator:     Sergio Acereda
>Release:        -current
>Organization:
>Environment:
NetBSD new-host-4 5.99.40 NetBSD 5.99.40 (DM) #0: Sun Nov 21 21:37:10 CET 2010  
root@.:/usr/obj/sys/arch/amd64/compile/DM amd64

>Description:
This problem may be related to PR 44183.

rl_display_match_list prints (null) entries



>How-To-Repeat:
Apply the following patch and compile lib/libedit with MKDEBUGLIB=yes, and then 
try to run 'test.c' with no arguments and with one argument only.

In the first case, the program prints (null) entry. 
In the second case, the assertion will fail.

test.c:
#include <readline/readline.h>

int main(int argc, char ** argv) {
  rl_initialize();  
  rl_display_match_list(argv, argc, 30);
  return 0;
}


Index: lib/libedit/filecomplete.c
===================================================================
RCS file: /cvsroot/src/lib/libedit/filecomplete.c,v
retrieving revision 1.22
diff -u -r1.22 filecomplete.c
--- lib/libedit/filecomplete.c  2 Dec 2010 04:42:46 -0000       1.22
+++ lib/libedit/filecomplete.c  2 Dec 2010 22:43:11 -0000
@@ -33,10 +33,10 @@
 #if !defined(lint) && !defined(SCCSID)
 __RCSID("$NetBSD: filecomplete.c,v 1.22 2010/12/02 04:42:46 dholland Exp $");
 #endif /* not lint && not SCCSID */
-
 #include <sys/types.h>
 #include <sys/stat.h>
 #include <stdio.h>
+#include <assert.h>
 #include <dirent.h>
 #include <string.h>
 #include <pwd.h>
@@ -332,7 +332,7 @@
 {
        const char *s1 = ((const char * const *)i1)[0];
        const char *s2 = ((const char * const *)i2)[0];
-
+       assert(s1 && s2);
        return strcasecmp(s1, s2);
 }
 






>Fix:
The patch suggested in PR 44183 works as expected



Home | Main Index | Thread Index | Old Index