* There's no xtrace output for function definitions
@ 2022-06-08 16:45 Bart Schaefer
2022-06-09 4:08 ` Bart Schaefer
0 siblings, 1 reply; 3+ messages in thread
From: Bart Schaefer @ 2022-06-08 16:45 UTC (permalink / raw)
To: Zsh hackers list
% zsh -fxc 'true && foo() { echo foo } && true'
+zsh:1> true
+zsh:1> true
%
Obviously (I would think) we don't want to dump the entire function
body to stderr, but we ought to output something?
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: There's no xtrace output for function definitions
2022-06-08 16:45 There's no xtrace output for function definitions Bart Schaefer
@ 2022-06-09 4:08 ` Bart Schaefer
2022-06-09 4:14 ` Bart Schaefer
0 siblings, 1 reply; 3+ messages in thread
From: Bart Schaefer @ 2022-06-09 4:08 UTC (permalink / raw)
To: Zsh hackers list
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));
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) {
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: There's no xtrace output for function definitions
2022-06-09 4:08 ` Bart Schaefer
@ 2022-06-09 4:14 ` Bart Schaefer
0 siblings, 0 replies; 3+ messages in thread
From: Bart Schaefer @ 2022-06-09 4:14 UTC (permalink / raw)
To: Zsh hackers list
On Wed, Jun 8, 2022 at 9:08 PM Bart Schaefer <schaefer@brasslantern.com> wrote:
>
> (I hope gmail isn't actually messing up indentation
> as much as I think it might be.)
Sadly, it is. Back to attaching patches as txt files after this, I guess.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2022-06-09 4:14 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-06-08 16:45 There's no xtrace output for function definitions Bart Schaefer
2022-06-09 4:08 ` Bart Schaefer
2022-06-09 4:14 ` Bart Schaefer
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/zsh/
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).