Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: Weird exit caused in a trap DEBUG which sources a file.



"Rocky Bernstein" wrote:
> Below is a small program whittled down from a larger one. It has
> behavior I can't figure out.
> 
> It seems to show that when a function is called via trap DEBUG and you
> then source a file and it has a statement in it, on return from the
> TRAP an exit will be taken.  Here is the program:
> 
> #!/usr/bin/zsh
> function debug_trap_handler {
>     print $functrace[1]
>     do_bug
> }
> 
> function do_bug {
>    . ./bug-file
> }
> 
> trap 'echo EXIT hit' EXIT
> trap 'debug_trap_handler' DEBUG
> a=1
> b=2
> d=3
> 
> In "bug-file" put any command. ":" will do. Or a print statement.
> Let's say it contains the line:
> print bug file here
> 
> When I run the above I get:
> 
> $ ./zshtrace.sh
> 
> ./zshtrace.sh:12
> bug file here
> EXIT hit

That certainly looks like a bug, but it didn't happen for me.  What
version of the shell do you have, and does it happen with the -f option
after /usr/bin/zsh?

-- 
Peter Stephenson <pws@xxxxxxx>                  Software Engineer
CSR PLC, Churchill House, Cambridge Business Park, Cowley Road
Cambridge, CB4 0WZ, UK                          Tel: +44 (0)1223 692070



Messages sorted by: Reverse Date, Date, Thread, Author