zsh-workers
 help / color / mirror / code / Atom feed
From: "Mikael Magnusson" <mikachu@gmail.com>
To: "Peter Stephenson" <pws@csr.com>
Cc: "Zsh hackers list" <zsh-workers@sunsite.dk>
Subject: Re: PATCH: dynamic named directories
Date: Fri, 26 Sep 2008 14:52:17 +0200	[thread overview]
Message-ID: <237967ef0809260552o3903e719od88cf2c79d9c3f07@mail.gmail.com> (raw)
In-Reply-To: <15726.1222353125@csr.com>

2008/9/25 Peter Stephenson <pws@csr.com>:
> 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

  parent reply	other threads:[~2008-09-26 12:52 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-09-25 14:32 Peter Stephenson
2008-09-25 14:46 ` Mikael Magnusson
2008-09-25 14:50   ` Peter Stephenson
2008-09-25 15:51 ` Bart Schaefer
2008-09-25 16:05   ` Peter Stephenson
2008-09-27  5:54     ` Bart Schaefer
2008-09-26 12:52 ` Mikael Magnusson [this message]
2008-09-26 12:56   ` Mikael Magnusson
2008-09-27 19:42     ` Peter Stephenson

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:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

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

  git send-email \
    --in-reply-to=237967ef0809260552o3903e719od88cf2c79d9c3f07@mail.gmail.com \
    --to=mikachu@gmail.com \
    --cc=pws@csr.com \
    --cc=zsh-workers@sunsite.dk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).