It seems as though my crash is also related to this bug. According to the docs, BRACE_EXPAND is an alias for NO_IGNORE_BRACES. emulate -R sh +o ignorebraces -c 'foo() { setopt; }' works and doesn't crash the shell -- Russell Harmon On Mon, Apr 29, 2013 at 2:17 PM, Bart Schaefer wrote: > On Apr 29, 11:47am, Bart Schaefer wrote: > } > } OK, I found the problem, but I don't know what to do to fix it. > > This seems to do it. > > diff --git a/Src/init.c b/Src/init.c > index 8467a73..49ac124 100644 > --- a/Src/init.c > +++ b/Src/init.c > @@ -281,9 +281,10 @@ parseargs(char **argv, char **runscript) > > /**/ > static void > -parseopts_insert(LinkList optlist, void *ptr) > +parseopts_insert(LinkList optlist, void *base, int optno) > { > LinkNode node; > + void *ptr = base + (optno < 0 ? -optno : optno); > > for (node = firstnode(optlist); node; incnode(node)) { > if (ptr < getdata(node)) { > @@ -390,7 +391,7 @@ parseopts(char *nam, char ***argvp, char *new_opts, > char **cmdp, > if (dosetopt(optno, action, !nam, new_opts) && nam) { > WARN_OPTION("can't change option: %s", *argv); > } else if (optlist) { > - parseopts_insert(optlist, new_opts+optno); > + parseopts_insert(optlist, new_opts, optno); > } > } > break; > @@ -415,7 +416,7 @@ parseopts(char *nam, char ***argvp, char *new_opts, > char **cmdp, > if (dosetopt(optno, action, !nam, new_opts) && nam) { > WARN_OPTION("can't change option: -%c", **argv); > } else if (optlist) { > - parseopts_insert(optlist, new_opts+optno); > + parseopts_insert(optlist, new_opts, optno); > } > } > } > > -- > Barton E. Schaefer >