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

Re: PATCH: dynamic named directories



2008/9/25 Peter Stephenson <pws@xxxxxxx>:
> Problem: six feet deep in WiFi and UWB bugs to fix.  Solution:  do
> something else entirely.
>
> This morning I had a brainwave/brainstorm that turned out to be easy to
> implement and test without interfering with the rest of the shell, which
> is the sort of feature I like.  I'm sure you'll tell me if it's a stupid
> idea.
>
> It's based on the way I use an Emacs function suite called "bufname"
> that a colleague and I wrote a few years ago.  I have lots of parallel
> directory hierarchies with slightly different names at different levels,
> so normal static directory naming isn't really flexible enough.
>
> Now you can use ~[<stuff>] and <stuff> gets passed down to a function
> zsh_directory_name, which either parses it and picks an appropriate
> directory or refuses.  (If the function isn't defined this syntax is
> treated the way it always was, which typically wasn't all that useful.)
> There's also a mechanism for going the other way.  See documentation and
> examples.
>
> Much of the patch is actually another simplification to doshfunc() which
> was obvious when I worked out what the third argument was for.  It
> should mean any PM_* flags applicable to functions (such as PM_TAGGED)
> are handled more consistently.

Here's line broken backtrace of the week

(gdb) run
Starting program: /usr/local/bin/zsh -f
fartmonstret% zsh_directory_name() {}
fartmonstret% cd ~[a b]

Program received signal SIGSEGV, Segmentation fault.
0x080c1a73 in filesubstr (namptr=0xafca0380, assign=0) at subst.c:560
560		} else if (!inblank(str[1]) && isend(*ptr) &&
(gdb) bt full
#0  0x080c1a73 in filesubstr (namptr=0xafca0380, assign=0) at subst.c:560
	dirfunc = (Shfunc) 0x81077d8
	tmp = 0xa7a9ff84 "\022\020"
	val = 0
	ptr = 0x0
	res = 0x1 <Address 0x1 out of bounds>
	str = 0xa7bbe640 "\225\217a"
#1  0x080c1614 in filesub (namptr=0xafca0380, assign=0) at subst.c:492
	eql = 0x0
	sub = 0x0
	str = 0x0
	ptr = 0xca01c4 <Address 0xca01c4 out of bounds>
	len = 100
#2  0x080c080a in prefork (list=0xa7bbe608, flags=0) at subst.c:113
	cptr = 0xa7bbe640 "\225\217a"
	node = (LinkNode) 0xa7bbe620
	stop = (LinkNode) 0xa7bbe62c
	keep = 0
	asssub = 0
#3  0x0806f2e7 in execcmd (state=0xafca09cc, input=0, output=0,
how=18, last1=2) at exec.c:2420
	hn = (HashNode) 0x80df4d4
	args = (LinkList) 0xa7bbe608
	node = (LinkNode) 0xafca0648
	fn = (Redir) 0x41b6cdb3
	mfds = {0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}
	text = 0xa7bbe600 "b\220"
	save = {-2, -2, -2, -2, -2, -2, -2, -2, -2, -2}
	fil = -1345714676
---Type <return> to continue, or q <return> to quit---
	dfil = 135038111
	is_cursh = -1480858112
	type = 6
	do_exec = 0
	i = 10
	htok = 1
	nullexec = 0
	assign = 0
	forked = 0
	is_shfunc = 0
	is_builtin = 1
	is_exec = 0
	use_defpath = 0
	cflags = 0
	checked = 1
	oautocont = -1
	redir = (LinkList) 0x0
	code = 102
	beg = (Wordcode) 0xa7bbe5ac
	varspc = (Wordcode) 0x0
	oxtrerr = (FILE *) 0x41c29560
	newxtrerr = (FILE *) 0x0
#4  0x0806d1f5 in execpline2 (state=0xafca09cc, pcode=195, how=18,
input=0, output=0, last1=0)
    at exec.c:1557
	pid = 134789985
	pipes = {0, -1345714360}
#5  0x0806c58b in execpline (state=0xafca09cc, slcode=5122, how=18,
last1=0) at exec.c:1343
	ipipe = {0, 0}
---Type <return> to continue, or q <return> to quit---
	opipe = {0, 0}
	pj = 0
	newjob = 1
	old_simple_pline = 0
	slflags = 0
	code = 195
	lastwj = 0
	lpforked = 0
#6  0x0806bdcc in execlist (state=0xafca09cc, dont_change_job=0,
exiting=0) at exec.c:1141
	donedebug = 0
	next = (Wordcode) 0xa7bbe5bc
	code = 5122
	ret = 0
	cj = 0
	csp = 0
	ltype = 18
	old_pline_level = 0
	old_list_pipe = 0
	oldlineno = 3
	oldnoerrexit = 0
	donetrap = 0
#7  0x0806b8ad in execode (p=0xa7bbe578, dont_change_job=0, exiting=0)
at exec.c:973
	s = {prog = 0xa7bbe578, pc = 0xa7bbe5bc, strs = 0xa7bbe5c0 "Ð廧à廧"}
#8  0x08084d11 in loop (toplevel=1, justonce=0) at init.c:181
	toksav = 1
	prog = (Eprog) 0xa7bbe578
#9  0x0808778e in zsh_main (argc=2, argv=0xafca0b04) at init.c:1406
	t = (char **) 0xafca0b0c
---Type <return> to continue, or q <return> to quit---
	t0 = 157
#10 0x08055236 in main (argc=Cannot access memory at address 0xffff9000
) at ./main.c:93

-- 
Mikael Magnusson


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