Re: Patch to prevent tilde crashing readline

Mark Kettenis
2005-07-03T08:23:55Z

From: Martin Simmons <qqxnjvamvxwx@spammotel.com>
Date: Sat, 2 Jul 2005 23:48:56 +0100 (BST)

Here is a patch to the gdb readline to fix a typo in the MinGW changes. The
current CVS gdb segfaults on x86_64 FC3 Linux whenever ~ is used, e.g.

source ~martin/my-commands

The segfault is in strlen(), called from tilde_expand(), because
tilde_expand_word() returns NULL when HAVE_GETPWNAM is not defined
(i.e. always!). Someone should fix tilde_expand_word() to do the existing
else clause in this case.

Oops, Thanks Martin! I committed the attached patch (since it is
obviously correct).

Chet, I'm not sure whether you incorporated Mark Mitschell's MinGW
changes yet, but you'll at least want to apply this change.

Mark

Index: ChangeLog.gdb
from Mark Kettenis <kettenis@gnu.org>

From Martin Simmons:
* configure.in: Check for getpwnam instead of getpwname.
* configure: Regenerate.

Index: configure.in
===================================================================
RCS file: /cvs/src/src/readline/configure.in,v
retrieving revision 1.7
diff -u -p -r1.7 configure.in
--- configure.in 9 May 2005 19:42:03 -0000 1.7
+++ configure.in 3 Jul 2005 08:18:03 -0000
@@ -120,7 +120,7 @@ AC_HEADER_DIRENT

AC_CHECK_FUNCS(fcntl kill lstat memmove putenv select setenv setlocale \
strcasecmp strpbrk tcgetattr vsnprintf isascii isxdigit \
- getpwname getpwent getpwuid)
+ getpwnam getpwent getpwuid)

AC_FUNC_STRCOLL