Zsh Mailing List Archive
Messages sorted by:
Re: Feature request: ZSH_XTRACEFD variable
- X-seq: zsh-workers 45771
- From: Peter Stephenson <p.w.stephenson@xxxxxxxxxxxx>
- To: zsh-workers@xxxxxxx
- Subject: Re: Feature request: ZSH_XTRACEFD variable
- Date: Sun, 03 May 2020 18:30:13 +0100
- In-reply-to: <CAD8ZDTp=rYsWiEkq3byjU=BRAA2iLwxt5QG_19MBc+Jo8dCemail@example.com>
- List-help: <mailto:firstname.lastname@example.org>
- List-id: Zsh Workers List <zsh-workers.zsh.org>
- List-post: <mailto:email@example.com>
- List-unsubscribe: <mailto:firstname.lastname@example.org>
- Mailing-list: contact zsh-workers-help@xxxxxxx; run by ezmlm
- References: <EL9xNuAdKSLWp41th3XxhRLVtul7jHkT9ons2s2c_35aNjCbCMzo4DqiCNV1SoNjdLhNgdUGLNMHQxQ9q4jDMcNIsxzonWx5jzOB5Hr8rBsemail@example.com> <firstname.lastname@example.org> <email@example.com> <CGME20190721150914epcas1p18b5b4b9ccc4e593e854b076a835257c7@epcas1p1.samsung.com> <CAD8ZDTrfrWTKfa1efTo63uk1XJO4BOp5hSLOfjL1tXkeDMf_QQ@mail.gmail.com> <firstname.lastname@example.org> <CAD8ZDTokqOTfEajquX2SKU5pLWgd85sPdRMYkxE4nF0pQhi+BA@mail.gmail.com> <email@example.com> <CAD8ZDTotCLBANtzppSbCcgKyLhkXaVWysjqv99xS6bnLypBViA@mail.gmail.com> <firstname.lastname@example.org> <CAD8ZDTp=rYsWiEkq3byjU=BRAA2iLwxt5QG_19MBc+Jo8dCemail@example.com>
On Sat, 2020-05-02 at 20:02 +0200, Timothée Mazzucotelli wrote:
> I wrote such a test and noticed that file descriptors were being
> closed each time ZSH_XTRACEFD was (re)assigned, even as a local
> variable. So I removed the code lines closing the previous file
> descriptor in xtracefdsetfn, and it seemed to work well.
This re-introduces the file descriptor leak I was at pains to remove.
It apparently works because the test isn't sensitive to the leak ---
that's hard to fix in a standard way, i.e. with1out having some limit you
can rely on on file descriptors being created.
The key to this is the same as the point Daniel made: there needs to be
special handling in parameter start/end scope for local variables.
There are other variables that have some prior art for this ---
e.g. SECONDS has special handling to make sure we get back the prevoius
starting point for times. This variable might want something similar to
make sure we remember the previous file descriptor rather than close it,
but also make sure we close a local file descriptor on exit.
It might be possible to detect in the parameter-specific functions that
a new file descriptor is being called locally and the old one needs
saving in a way it can be restored, but that might be harder than
special code in the parmater scope hanling which should at least pick up
As you'll see I haven't really thought this through at the moment...
Messages sorted by: