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

Tracing bug Re: Regular expression expanding and matching

[users > workers]

On Nov 25, 11:30am, Bart Schaefer wrote:
} } +./zshtest:9> [[ $somestring -pcre-match \d{4}${todaysday} ]]
} } +./zshtest:11> [[ $somestring -pcre-match \d{4}${yesterday} ]]
} Hmm, there's something slighly off about that XTRACE output.

The problem here is that the trace is printed by tracemodcond() in
Src/cond.c, but the parse is executed by the handler function for the
conditional.  It just so happens that in the case of -pcre-match, the
handler calls back via cond_str() to parse the arguments exactly in
the way that the default infix conditionals would do, but in fact it
could choose to parse it differently.

Further, tracemodcond() is called before the parse is even attempted,
which means that unlike default conditionals, the trace output might be
printed first and then an error subsequently generated.

Under the current arrangement it is therefore impossible for xtrace to
produce accurate output for a module-defined conditional.  The only
obvious way to correct this would be to pass the tracingcond flag down
to the module handler and require it to call back to tracemodcond()
after the parse [or in some other way handle the trace itself].

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