andrewt@watsnew.waterloo.edu (Andrew Thomas) (07/10/89)
Using a uVax II under Ultrix 2.0: Bash 1.02 performs an indirection through a null pointer when given the line: Meta-TAB: expand-line in the .inputrc file. In the following diff, funmap[i] == 0, but on a vax, funmap[i]->name is not an error. No error is reported unless the value of funmap[i]->name is outside the process space. The following diff solved the problem for me, though it might not be the correct solution: *** readline.c.orig Thu Jul 6 13:36:14 1989 --- readline.c Sun Jul 9 17:12:00 1989 *************** *** 3797,3803 **** { register int i; ! for (i = 0; funmap[i]->name; i++) if (stricmp (funmap[i]->name, string) == 0) return (funmap[i]->function); return ((Function *)NULL); --- 3797,3803 ---- { register int i; ! for (i = 0; funmap[i] && funmap[i]->name; i++) if (stricmp (funmap[i]->name, string) == 0) return (funmap[i]->function); return ((Function *)NULL); -- Andrew Thomas andrewt@watsnew.waterloo.edu Systems Design Eng. University of Waterloo "If a million people do a stupid thing, it's still a stupid thing." - Opus
bfox@AUREL.CALTECH.EDU (Brian Fox) (07/10/89)
Date: 9 Jul 89 21:37:33 GMT From: utgpu!watmath!watcgl!andrewt@jarvis.csri.toronto.edu (Andrew Thomas) Bash 1.02 performs an indirection through a null pointer ... *** readline.c.orig Thu Jul 6 13:36:14 1989 --- readline.c Sun Jul 9 17:12:00 1989 *************** *** 3797,3803 **** { register int i; ! for (i = 0; funmap[i]->name; i++) if (stricmp (funmap[i]->name, string) == 0) return (funmap[i]->function); return ((Function *)NULL); --- 3797,3803 ---- { register int i; ! for (i = 0; funmap[i] && funmap[i]->name; i++) if (stricmp (funmap[i]->name, string) == 0) return (funmap[i]->function); return ((Function *)NULL); -- Thanks, Andrew. This happened in 1.02 because I made funmaps be dynamically allocated, which changed the test conditions. You patch is correct, but has too much code; the solution is for (i = 0; funmap[i]; i++) Brian