Hello, I'm coming back to the ZSH_XTRACEFD feature again :)
About closing file descriptors or not: I don't understand what it means to "leak a FILE".
I'm not sure to understand the past comments either: we only use fdopen when the value of ZSH_XTRACEFD is > 2.
For 0, 1 and 2, we re-use the existing file descriptors stdin, stdout and stderr.
Anyway, I added the patch in an attachment. Also, here's the link to the commit on my fork:
In this patch, I never close any file descriptor.
There's one last thing that looks weird to me:
single instructions like ZSH_XTRACEFD=5 are not properly logged in the xtrace output.
It seems they are truncated up to the end of the variable assignment:
- with a=0 ZSH_XTRACEFD=5, nothing appear in the output either
- with ZXH_XTRACEFD=5 a=0, only a=0 appears in the output (but no +(eval):18 prefix or similar)
Any idea about this?
Cheers,
Timothée