Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

XTRACE output -- I thought we'd fixed this?



bash-3.2$ set -x
bash-3.2$ echo hello 2>/dev/null
+ echo hello
hello
bash-3.2$ 

torch% set -x
torch% echo hello 2>/dev/null
hello
torch% echo hello
+Src/zsh:3> echo hello
hello
torch% 

Stderr redirection isn't supposed to redirect the xtrace descriptor unless
you use a { ... } construct.  There's even this in exec.c:execcmd():

    /* Make a copy of stderr for xtrace output before redirecting */
    fflush(xtrerr);
    if (isset(XTRACE) && xtrerr == stderr &&
	(type < WC_SUBSH || type == WC_TIMED)) {
	if ((newxtrerr = fdopen(movefd(dup(fileno(stderr))), "w"))) {
	    xtrerr = newxtrerr;
	    fdtable[fileno(xtrerr)] = FDT_XTRACE;
	}
    }

Yet E02xtrace.ztst appears to expect this (wrong?) behavior, so I must be
mis-remembering something.



Messages sorted by: Reverse Date, Date, Thread, Author