On Saturday 30 August 2008, Daniel Qarras wrote: > > Hi, > > not sure if anyone has noticed but Red Hat has introduced a strange workaround into their zsh initscripts to workaround a corner case ZDOTDIR bug in zsh: > > https://bugzilla.redhat.com/show_bug.cgi?id=430665#c19 > https://bugzilla.redhat.com/show_bug.cgi?id=430665#c25 > https://bugzilla.redhat.com/show_bug.cgi?id=430665#c27 > > The comments above comment #19 are usual bickering about RH's zsh init scripts but it seems that those three comments illustrate that there's something fishy with ZDOTDIR when using "emulate". > Yes, emulate is never reset contrary to manual. The patch below is the most simple fix; one problem is it restores emulation mode if LOCAL_OPTIONS is set, not when "emulate -L" is used as documentation can be interpreted. OTOH documentation can be interpreted this way also. Peter, is it OK to commit? Index: Src/exec.c =================================================================== RCS file: /cvsroot/zsh/zsh/Src/exec.c,v retrieving revision 1.142 diff -u -p -r1.142 exec.c --- Src/exec.c 25 Aug 2008 17:28:16 -0000 1.142 +++ Src/exec.c 30 Aug 2008 19:54:54 -0000 @@ -4184,7 +4184,7 @@ doshfunc(char *name, Eprog prog, LinkLis int oldzoptind, oldlastval, oldoptcind, oldnumpipestats, ret; int *oldpipestats = NULL; char saveopts[OPT_SIZE], *oldscriptname = scriptname, *fname = dupstring(name); - int obreaks; + int obreaks, saveemulation ; struct funcstack fstack; #ifdef MAX_FUNCTION_DEPTH static int funcdepth; @@ -4223,6 +4223,7 @@ doshfunc(char *name, Eprog prog, LinkLis * not currently set. That's because if it gets set in the * * function we need to restore the original options on exit. */ memcpy(saveopts, opts, sizeof(opts)); + saveemulation = emulation; if (flags & PM_TAGGED) opts[XTRACE] = 1; @@ -4315,6 +4316,7 @@ doshfunc(char *name, Eprog prog, LinkLis saveopts[PRIVILEGED] = opts[PRIVILEGED]; saveopts[RESTRICTED] = opts[RESTRICTED]; memcpy(opts, saveopts, sizeof(opts)); + emulation = saveemulation; } else { /* just restore a couple. */ opts[XTRACE] = saveopts[XTRACE];
Attachment:
signature.asc
Description: This is a digitally signed message part.