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

Methods of shadowing a builtin call



Hello,
I shadow setopt to gather data of what is being done in sourced
script. I currently use alias setopt=--setopt-shadow and then source a
script. This works fine except for z-sy-h. For that project, when I
source it with the alias being in place, interiors of it then still
use the shadowing function during their later operations. How to
suppress this? Self-insert is in some way catched by z-sy-h, and each
keypress invokes my shadowing function.

When I change:
    alias setopt=--shadow-setopt
to:
    setopt() { --shadow-setopt "$@" }

then Zsh segfaults. I'm not sure if on OS X gdb gives meaningful
output, but this is the backtrace:

Program received signal SIGSEGV, Segmentation fault.
0x00000001000184e4 in execrestore ()
(gdb) bt
#0  0x00000001000184e4 in execrestore ()
#1  0x00000001000135c4 in execlist ()
#2  0x0000000100012c27 in execlist ()
#3  0x0000000100012818 in execode ()
#4  0x0000000100016be2 in runshfunc ()
#5  0x0000000100016540 in doshfunc ()
#6  0x0000000100017ca6 in execrestore ()
#7  0x000000010001c031 in execrestore ()
#8  0x00000001000135c4 in execlist ()
#9  0x0000000100012d84 in execlist ()
#10 0x000000010003efae in execif ()
...

How to explain the segfault?

Is there any third method of attaching to setopt?

Best regards,
Sebastian Gniazdowski



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