Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
COMPLETE_IN_WORD dumps core if reserved word match
- X-seq: zsh-workers 290
- From: Thorsten Meinecke <kaefer@xxxxxxxxxxxxxxx>
- To: zsh-workers@xxxxxxxxxxxxxxx
- Subject: COMPLETE_IN_WORD dumps core if reserved word match
- Date: Mon, 7 Aug 1995 13:51:33 +0200 (MET DST)
- In-reply-to: <m0scCmr-00007BC@xxxxxxxxxxxxxxx> from "Thorsten Meinecke" at Jul 29, 95 04:22:44 pm
- Organization: none. Location: Berlin, Germany
I wrote,
Subject: COMPLETE_IN_WORD dumps core if built-in functions match,
> Starting program: /u/home/kaefer/wrk/zsh/zsh-2.6-beta10/Src/./zsh -f
> aglaia:~/wrk/zsh/zsh-2.6-beta10/Src> setopt autolist completeinword
> aglaia:~/wrk/zsh/zsh-2.6-beta10/Src> rt
> ^
> [cursor position is here, and completion requested]
>
> Program received signal SIGSEGV, Segmentation fault.
> 0x804ed39 in addmatch (s=0x8059424 "epeat", t=0x8059424 "epeat")
> at zle_tricky.c:1524
> 1524 *e = '\0';
> (gdb)
>
> The obvious way around (at least for GCC) is to recompile with
> -fwritable-strings.
Digging a little further shows that only the list of 24 reserved
words is subject to this problem. We're attempting to modify
"string constants", which can't be done portably.
The fix is to copy these words, at the expense of a-hundred-and-a-
few bytes increased memory usage, as it was done in earlier releases.
This is still for zsh-2.6-beta10:
*** hashtable.c.orig Sat Jul 1 00:06:17 1995
--- hashtable.c Mon Aug 7 01:49:09 1995
***************
*** 441,454 ****
reswdtab->printinfo = printhashtabinfo;
reswdtab->tablename = ztrdup("reswdtab");
#endif
! /* Add the actual words, not copies, to the table, *
! * as we do not expect to modify the table again. */
for (i = 0; reswds[i]; i++) {
struct reswd *ptr = (struct reswd *) zcalloc(sizeof *ptr);
ptr->cmd = i + DO;
! reswdtab->addnode(reswdtab, reswds[i], ptr);
}
}
--- 441,455 ----
reswdtab->printinfo = printhashtabinfo;
reswdtab->tablename = ztrdup("reswdtab");
#endif
! /* Add copies of the actual words to the table, as we do not *
! * expect to modify the table permanently, but we do insert *
! * end-of-string markers for COMPLETE_IN_WORD temporarily */
for (i = 0; reswds[i]; i++) {
struct reswd *ptr = (struct reswd *) zcalloc(sizeof *ptr);
ptr->cmd = i + DO;
! reswdtab->addnode(reswdtab, ztrdup(reswds[i]), ptr);
}
}
Messages sorted by:
Reverse Date,
Date,
Thread,
Author