From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 9687 invoked from network); 1 Oct 2004 14:51:07 -0000 Received: from news.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.88) by ns1.primenet.com.au with SMTP; 1 Oct 2004 14:51:07 -0000 Received: (qmail 56420 invoked from network); 1 Oct 2004 14:50:59 -0000 Received: from sunsite.dk (130.225.247.90) by a.mx.sunsite.dk with SMTP; 1 Oct 2004 14:50:58 -0000 Received: (qmail 24191 invoked by alias); 1 Oct 2004 14:50:55 -0000 Mailing-List: contact zsh-workers-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 20429 Received: (qmail 24171 invoked from network); 1 Oct 2004 14:50:54 -0000 Received: from news.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.88) by sunsite.dk with SMTP; 1 Oct 2004 14:50:54 -0000 Received: (qmail 56160 invoked from network); 1 Oct 2004 14:50:53 -0000 Received: from mail27.messagelabs.com (193.109.254.147) by a.mx.sunsite.dk with SMTP; 1 Oct 2004 14:50:52 -0000 X-VirusChecked: Checked X-Env-Sender: Stephane.Chazelas@morse.com X-Msg-Ref: server-20.tower-27.messagelabs.com!1096642250!19119179 X-StarScan-Version: 5.2.10; banners=-,-,- X-Originating-IP: [195.152.231.104] Received: (qmail 7200 invoked from network); 1 Oct 2004 14:50:51 -0000 Received: from unknown (HELO GIS-MAIL-01.morse.corp.wan) (195.152.231.104) by server-20.tower-27.messagelabs.com with SMTP; 1 Oct 2004 14:50:51 -0000 Received: from frhdtmp102861 (frhdtmp102861.morse.corp.wan [10.25.10.16]) by GIS-MAIL-01.morse.corp.wan with SMTP (Microsoft Exchange Internet Mail Service Version 5.5.2653.13) id T8NBBWWS; Fri, 1 Oct 2004 15:50:50 +0100 Date: Fri, 1 Oct 2004 15:50:47 +0100 From: Stephane Chazelas To: Zsh hackers list Subject: [bug] type -m '^foo' Message-ID: <20041001145038.GB1772@frhdtmp102861.morse.corp.wan> Mail-Followup-To: Zsh hackers list Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit User-Agent: Mutt/1.5.6i X-Spam-Checker-Version: SpamAssassin 2.63 on a.mx.sunsite.dk X-Spam-Level: X-Spam-Status: No, hits=0.1 required=6.0 tests=HTML_MESSAGE autolearn=no version=2.63 X-Spam-Hits: 0.1 With latest CVS version as well as 4.2.0 $ type -m '(^a)' segfaults. It seems '(^a)' is matched against the keywords whose names are defined as string constants. That may be why the *testptr = '\0'; causes the segfaults (attempt to modify a readonly variable). Program received signal SIGSEGV, Segmentation fault. 0x000a7010 in patmatch (prog=0xfa2ec) at pattern.c:1849 1849 *testptr = '\0'; (gdb) bt #0 0x000a7010 in patmatch (prog=0xfa2ec) at pattern.c:1849 #1 0x000a57a4 in pattryrefs (prog=0xfa2c8, string=0xd1e08 "if", nump=0x0, begp=0x0, endp=0x0) at pattern.c:1404 #2 0x000a54c0 in pattry (prog=0xfa2c8, string=0xd1e08 "if") at pattern.c:1346 #3 0x0004f638 in scanmatchtable (ht=0xf3b30, pprog=0xfa2c8, flags1=0, flags2=1, scanfunc=0x50e60 , scanflags=64) at hashtable.c:435 #4 0x00026538 in bin_whence (nam=0xff3904d8 "type", argv=0xffbef2d4, ops=0xffbef2f8, func=0) at builtin.c:2762 #5 0x0001a530 in execbuiltin (args=0xff3904a8, bn=0xe7784) at builtin.c:439 #6 0x0003e414 in execcmd (state=0xffbef768, input=0, output=0, how=18, last1=2) at exec.c:2425 #7 0x00039158 in execpline2 (state=0xffbef768, pcode=131, how=18, input=0, output=0, last1=0) at exec.c:1276 #8 0x00037e9c in execpline (state=0xffbef768, slcode=5122, how=18, last1=0) at exec.c:1065 #9 0x0003729c in execlist (state=0xffbef768, dont_change_job=0, exiting=0) at exec.c:871 #10 0x00036d90 in execode (p=0xff390448, dont_change_job=0, exiting=0) at exec.c:771 #11 0x0005ce98 in loop (toplevel=1, justonce=0) at init.c:165 #12 0x00060fa8 in zsh_main (argc=1, argv=0xffbef964) at init.c:1274 #13 0x0001960c in main (argc=1, argv=0xffbef964) at ./main.c:93 (gdb) bt full #0 0x000a7010 in patmatch (prog=0xfa2ec) at pattern.c:1849 savpatinlen = 3 syncpt = (unsigned char *) 0x113412 "\001ø" savchar = 0 '\0' testptr = 0xd1e0a "" savpatinstart = 0xd1e08 "if" savforce = -1 savpatflags = 64 syncstrp = 0xfa304 matchpt = 0xd1e0a "" ret = 1 savparsfound = 0 oldsyncstr = (unsigned char *) 0x0 savglobdots = 1 matchederrs = 0 scan = 0xfa2f4 next = 0xfa300 opnd = 0xfa308 start = 0x7efefeff
save = 0xd1e08 "if" chrop = 0x1
savglobflags = 0 op = -13041360 no = 10 min = 272 nextch = 0 fail = 0 saverrsfound = 0 from = 0 to = -511101108225 comp = 1074944 #1 0x000a57a4 in pattryrefs (prog=0xfa2c8, string=0xd1e08 "if", nump=0x0, begp=0x0, endp=0x0) at pattern.c:1404 i = -4263548 maxnpos = 0 sp = (char **) 0x0 ep = (char **) 0x0 progstr = 0xfa2ec "" #2 0x000a54c0 in pattry (prog=0xfa2c8, string=0xd1e08 "if") at pattern.c:1346 No locals. #3 0x0004f638 in scanmatchtable (ht=0xf3b30, pprog=0xfa2c8, flags1=0, flags2=1, scanfunc=0x50e60 , scanflags=64) at hashtable.c:435 hn = 0xe7b34 i = 2 hsize = 23 nodes = (HashNode *) 0xf3b80 match = 0 st = {sorted = 0, u = {s = {tab = 0x0, ct = 0}, u = 0x0}} #4 0x00026538 in bin_whence (nam=0xff3904d8 "type", argv=0xffbef2d4, ops=0xffbef2f8, func=0) at builtin.c:2762 hn = 0xff3904e8 pprog = 0xfa2c8 returnval = 0 printflags = 64 aliasflags = 64 csh = 0 all = 0 v = 1 wd = 0 informed = -16954744 cnam = 0xff390000 "" #5 0x0001a530 in execbuiltin (args=0xff3904a8, bn=0xe7784) at builtin.c:439 argarr = (char **) 0xffbef2d0 argv = (char **) 0xffbef2d4 pp = 0xd06b1 "" name = 0xff3904d8 "type" optstr = 0xd06b8 "ampfsw" flags = 8 sense = 0 argc = 1 execop = 109 xtr = 0 ops = {ind = '\0' , "\001\000\000\000\000\000\000\000\000\001\000\000\000\000\000\000\000\000", args = 0x0, argscount = 0, argsalloc = 0} #6 0x0003e414 in execcmd (state=0xffbef768, input=0, output=0, how=18, last1=2) at exec.c:2425 restorelist = 0x0 removelist = 0x0 hn = 0xe7784 node = 0xff390490 fn = 0xff39048c mfds = {0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0} text = 0xebfe0 "type -m '(^a)'" save = {-2, -2, -2, -2, -2, -2, -2, -2, -2, -2} fil = 860513 dfil = 1097904 is_cursh = 1 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 = 0 redir = 0x0 code = 102 beg = 0xff39047c varspc = 0x0 oxtrerr = (FILE *) 0xee5a8 #7 0x00039158 in execpline2 (state=0xffbef768, pcode=131, how=18, input=0, output=0, last1=0) at exec.c:1276 pid = 1 pipes = {860504, 60} #8 0x00037e9c in execpline (state=0xffbef768, slcode=5122, how=18, last1=0) at exec.c:1065 ipipe = {0, 0} opipe = {0, 0} pj = 0 newjob = 1 old_simple_pline = 0 slflags = 0 code = 131 lastwj = 0 lpforked = 0 #9 0x0003729c in execlist (state=0xffbef768, dont_change_job=0, exiting=0) at exec.c:871 donetrap = 0 next = 0xff39048c code = 5122 ret = 0 cj = 0 csp = 0 ltype = 18 old_pline_level = 0 old_list_pipe = 0 oldlineno = 2 oldnoerrexit = 0 #10 0x00036d90 in execode (p=0xff390448, dont_change_job=0, exiting=0) at exec.c:771 s = {prog = 0xff390448, pc = 0xff39048c, strs = 0xff390490 "type"} #11 0x0005ce98 in loop (toplevel=1, justonce=0) at init.c:165 toksav = 1 preprog = 0xf0178 prog = 0xff390448 #12 0x00060fa8 in zsh_main (argc=1, argv=0xffbef964) at init.c:1274 t = (char **) 0xffbef968 t0 = 156 #13 0x0001960c in main (argc=1, argv=0xffbef964) at ./main.c:93 No locals. -- Stephane