Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: There's no xtrace output for function definitions
- X-seq: zsh-workers 50353
- From: Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>
- To: Zsh hackers list <zsh-workers@xxxxxxx>
- Subject: Re: There's no xtrace output for function definitions
- Date: Wed, 8 Jun 2022 21:08:03 -0700
- Archived-at: <https://zsh.org/workers/50353>
- In-reply-to: <CAH+w=7bxzdCK6ykT-aas-ADSBD8OaBGzFSVnQ9BGD=99=fhKNA@mail.gmail.com>
- List-id: <zsh-workers.zsh.org>
- References: <CAH+w=7bxzdCK6ykT-aas-ADSBD8OaBGzFSVnQ9BGD=99=fhKNA@mail.gmail.com>
On Wed, Jun 8, 2022 at 9:45 AM Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx> wrote:
>
> Obviously (I would think) we don't want to dump the entire function
> body to stderr, but we ought to output something?
In the "I've forgotten more than I still know" department, I just
realized that other shells don't trace function definitions either.
Consequently, the following is submitted for consideration, but I
won't commit it. (I hope gmail isn't actually messing up indentation
as much as I think it might be.)
diff --git a/Src/exec.c b/Src/exec.c
index f2911807c..6d08f5e7e 100644
--- a/Src/exec.c
+++ b/Src/exec.c
@@ -5364,6 +5364,11 @@ execfuncdef(Estate state, Eprog redir_prog)
zfree(shf, sizeof(*shf));
break;
} else {
+ if (isset(XTRACE) && EMULATION(EMULATE_ZSH)) {
+ fprintf(xtrerr, "function ");
+ quotedzputs(s, xtrerr);
+ fputc('\n', xtrerr);
+ }
/* is this shell function a signal trap? */
if (!strncmp(s, "TRAP", 4) &&
(signum = getsignum(s + 4)) != -1) {
Messages sorted by:
Reverse Date,
Date,
Thread,
Author