From: Stephane Chazelas <Stephane.Chazelas@morse.com>
To: Zsh hackers list <zsh-workers@sunsite.dk>
Subject: [bug] type -m '^foo'
Date: Fri, 1 Oct 2004 15:50:47 +0100 [thread overview]
Message-ID: <20041001145038.GB1772@frhdtmp102861.morse.corp.wan> (raw)
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 <printreswdnode>, 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 <Address 0x7efefeff out of bounds>
save = 0xd1e08 "if"
chrop = 0x1 <Address 0x1 out of bounds>
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 <printreswdnode>, 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' <repeats 109 times>, "\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
next reply other threads:[~2004-10-01 14:51 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-10-01 14:50 Stephane Chazelas [this message]
2004-10-01 14:59 ` DervishD
2004-10-01 15:29 ` Danek Duvall
2004-10-01 15:32 ` Stephane Chazelas
2004-10-01 15:34 ` Danek Duvall
2004-10-01 16:56 ` Bart Schaefer
2004-10-01 18:22 ` Peter Stephenson
2004-10-02 2:17 ` Bart Schaefer
2004-10-04 10:32 ` 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=20041001145038.GB1772@frhdtmp102861.morse.corp.wan \
--to=stephane.chazelas@morse.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).