From: "Mikael Magnusson" <mikachu@gmail.com>
To: zsh-workers <zsh-workers@sunsite.dk>
Subject: Crash with =~ in script, but not interactively
Date: Fri, 4 Jan 2008 10:27:40 +0100 [thread overview]
Message-ID: <237967ef0801040127k49e92485rf09ce72c47d076c5@mail.gmail.com> (raw)
I was going to make a wrapper script that replaces the :43: in gcc
warnings with +43 so i can open in vim easierly, but ran into some
problems.
#!/bin/zsh
#this makes zsh segfault
if [[ $#@ = 1 ]]; then
if [[ $1 =~ /?[^/]+:[0-9]+:$ ]]; then
echo hello
fi
fi
If i save that in a file and run 'zsh file' it crashes, but if i run
'source file' in an open shell it works as expected. Here's a
backtrace with -g3 -O0
Program received signal SIGSEGV, Segmentation fault.
0x080d0d16 in taddstr (s=0xc93fa008 <Address 0xc93fa008 out of
bounds>) at text.c:68
68 int sl = strlen(s);
(gdb) bt
#0 0x080d0d16 in taddstr (s=0xc93fa008 <Address 0xc93fa008 out of
bounds>) at text.c:68
#1 0x080d1ce2 in gettext2 (state=0xafb7dc3c) at text.c:538
#2 0x080d1008 in getjobtext (prog=0xa7f11480, c=0xa7f114bc) at text.c:172
#3 0x0807656b in execpline2 (state=0xafb7e22c, pcode=259, how=18,
input=0, output=0, last1=0)
at exec.c:1481
#4 0x0807597b in execpline (state=0xafb7e22c, slcode=26626, how=18,
last1=0) at exec.c:1275
#5 0x080751df in execlist (state=0xafb7e22c, dont_change_job=0,
exiting=0) at exec.c:1081
#6 0x08074dee in execode (p=0xa7f11480, dont_change_job=0, exiting=0)
at exec.c:939
#7 0x0808ddb6 in loop (toplevel=1, justonce=0) at init.c:181
#8 0x08090f15 in zsh_main (argc=2, argv=0xafb7e384) at init.c:1352
#9 0x0805ead6 in main (argc=Cannot access memory at address 0xffffffff
) at ./main.c:93
(gdb) bt full
#0 0x080d0d16 in taddstr (s=0xc93fa008 <Address 0xc93fa008 out of
bounds>) at text.c:68
sl = -918577144
c = 0 '\0'
#1 0x080d1ce2 in gettext2 (state=0xafb7dc3c) at text.c:538
end = (Wordcode) 0xaa0b5378
s = (Tstack) 0x0
n = (Tstack) 0x819bd30
stack = 0
code = 959262863
c1 = {0x815d5ab "=", 0x815d5ad "!=", 0x815d5b0 "<", 0x815d5b2 ">",
0x815d5b4 "-nt",
0x815d5b8 "-ot", 0x815d5bc "-ef", 0x815d5c0 "-eq", 0x815d5c4 "-ne",
0x815d5c8 "-lt",
0x815d5cc "-gt", 0x815d5d0 "-le", 0x815d5d4 "-ge", 0x815d5d8 "=~"}
#2 0x080d1008 in getjobtext (prog=0xa7f11480, c=0xa7f114bc) at text.c:172
s = {prog = 0xa7f11480, pc = 0xa7f11534,
strs = 0xa7f11524 "/\224\217\206/\220+:\2170-9\220+:\205"}
jbuf = "if [[ \205\204@ = 1 ]]; then; if [[ \2051 =~
/\224\217\206/\220+:\2170-9\220+:\205 ]]; then; echo hello; \005rE "
#3 0x0807656b in execpline2 (state=0xafb7e22c, pcode=259, how=18,
input=0, output=0, last1=0)
at exec.c:1481
pid = 134828847
pipes = {2, -1346904904}
#4 0x0807597b in execpline (state=0xafb7e22c, slcode=26626, how=18,
last1=0) at exec.c:1275
ipipe = {0, 0}
opipe = {0, 0}
pj = 0
newjob = 1
old_simple_pline = 0
slflags = 0
code = 259
---Type <return> to continue, or q <return> to quit---
lastwj = 0
lpforked = 0
#5 0x080751df in execlist (state=0xafb7e22c, dont_change_job=0,
exiting=0) at exec.c:1081
donedebug = 0
next = (Wordcode) 0xa7f11520
code = 26626
ret = -1346903576
cj = 0
csp = 0
ltype = 18
old_pline_level = 0
old_list_pipe = 0
oldlineno = 8
oldnoerrexit = 0
donetrap = 0
#6 0x08074dee in execode (p=0xa7f11480, dont_change_job=0, exiting=0)
at exec.c:939
s = {prog = 0xa7f11480, pc = 0xa7f114bc,
strs = 0xa7f11524 "/\224\217\206/\220+:\2170-9\220+:\205"}
#7 0x0808ddb6 in loop (toplevel=1, justonce=0) at init.c:181
toksav = 1
prog = (Eprog) 0xa7f11480
#8 0x08090f15 in zsh_main (argc=2, argv=0xafb7e384) at init.c:1352
t = (char **) 0xafb7e38c
t0 = 157
#9 0x0805ead6 in main (argc=Cannot access memory at address 0xffffffff
) at ./main.c:93
No locals.
Using revision 'Based on 24334: Documentation for run-help
improvements.' which is currently the latest.
--
Mikael Magnusson
next reply other threads:[~2008-01-04 9:27 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-01-04 9:27 Mikael Magnusson [this message]
2008-01-04 10:35 ` Mikael Magnusson
2008-01-04 14:42 ` Peter Stephenson
2008-01-04 15:38 ` Mikael Magnusson
2008-01-04 15:47 ` 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=237967ef0801040127k49e92485rf09ce72c47d076c5@mail.gmail.com \
--to=mikachu@gmail.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).