help / color / mirror / code / Atom feed
From: Bart Schaefer <schaefer@brasslantern.com>
To: Zsh hackers list <zsh-workers@zsh.org>
Subject: Re: There's no xtrace output for function definitions
Date: Wed, 8 Jun 2022 21:08:03 -0700	[thread overview]
Message-ID: <CAH+w=7afCwQAA1YWRkqsb4XBxX-ivA3LyT+MbKY6wYmjPSPXqQ@mail.gmail.com> (raw)
In-Reply-To: <CAH+w=7bxzdCK6ykT-aas-ADSBD8OaBGzFSVnQ9BGD=99=fhKNA@mail.gmail.com>

On Wed, Jun 8, 2022 at 9:45 AM Bart Schaefer <schaefer@brasslantern.com> 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));
     } 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) {

  reply	other threads:[~2022-06-09  4:08 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-08 16:45 Bart Schaefer
2022-06-09  4:08 ` Bart Schaefer [this message]
2022-06-09  4:14   ` Bart Schaefer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAH+w=7afCwQAA1YWRkqsb4XBxX-ivA3LyT+MbKY6wYmjPSPXqQ@mail.gmail.com' \
    --to=schaefer@brasslantern.com \
    --cc=zsh-workers@zsh.org \
    --subject='Re: There'\''s no xtrace output for function definitions' \


* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

Code repositories for project(s) associated with this inbox:


This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).