From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 6655 invoked from network); 20 Sep 2008 15:15:03 -0000 X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-2.6 required=5.0 tests=AWL,BAYES_00,HTML_MESSAGE autolearn=ham version=3.2.5 Received: from news.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.88) by ns1.primenet.com.au with SMTP; 20 Sep 2008 15:15:03 -0000 Received-SPF: none (ns1.primenet.com.au: domain at sunsite.dk does not designate permitted sender hosts) Received: (qmail 84418 invoked from network); 20 Sep 2008 15:14:47 -0000 Received: from sunsite.dk (130.225.247.90) by a.mx.sunsite.dk with SMTP; 20 Sep 2008 15:14:47 -0000 Received: (qmail 3396 invoked by alias); 20 Sep 2008 15:14:37 -0000 Mailing-List: contact zsh-workers-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 25696 Received: (qmail 3378 invoked from network); 20 Sep 2008 15:14:36 -0000 Received: from bifrost.dotsrc.org (130.225.254.106) by sunsite.dk with SMTP; 20 Sep 2008 15:14:36 -0000 Received: from wa-out-1112.google.com (wa-out-1112.google.com [209.85.146.183]) by bifrost.dotsrc.org (Postfix) with ESMTP id 6D67D802720D for ; Sat, 20 Sep 2008 17:14:32 +0200 (CEST) Received: by wa-out-1112.google.com with SMTP id v27so550893wah.21 for ; Sat, 20 Sep 2008 08:14:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:to :subject:mime-version:content-type; bh=bwnf/OatoFCBRp7NaCFrMKpvh/LUb6QEqz5Pgp7rkGI=; b=rmV7LuXzBYoC/XKpOZ8QZtqKHThCqzPaps8lE59kFh+ueR9tnfz63T4JgwNerJzqyI jWwFZXZE0AEYSMVa/Qjw4cIHIL98LgNNXPtpytO1fyMLJQ1Fw8nFVftGrY580iqoh1Bg 50n3nkLHezjKPAZfXf1SigNjhLybaTS2h0SSE= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:to:subject:mime-version:content-type; b=pDXv4ihOkNZxJcbhm9YU/+nmzwrtf8tvMK81yzjihnJgbS8Sjmt2iupA8lEDhzhJRq 1vZ20zJYzb2/gFnzssaKUqjtNJ7+chTeJXBUWRmQs1H7KjsCI9tzLBtUjtGUbbW+pqkn iIoDY4/LBS6WUICdbHTx3u0Ct5HzisAFiNLDI= Received: by 10.114.182.1 with SMTP id e1mr1798679waf.143.1221923670559; Sat, 20 Sep 2008 08:14:30 -0700 (PDT) Received: by 10.114.159.2 with HTTP; Sat, 20 Sep 2008 08:14:30 -0700 (PDT) Message-ID: <6cd6de210809200814v6e4fbb82k8692845645de9c2f@mail.gmail.com> Date: Sat, 20 Sep 2008 11:14:30 -0400 From: "Rocky Bernstein" To: "Zsh hackers list" Subject: SEGV in history when searching a null list MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="----=_Part_30376_15260580.1221923670573" X-Virus-Scanned: ClamAV 0.92.1/8291/Sat Sep 20 13:50:48 2008 on bifrost X-Virus-Status: Clean ------=_Part_30376_15260580.1221923670573 Content-Type: multipart/alternative; boundary="----=_Part_30377_16225834.1221923670574" ------=_Part_30377_16225834.1221923670574 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline Found this bug when adding history to zshdb: #!/usr/local/bin/zsh -if history -ap ./$$ fc -l commands Program received signal SIGSEGV, Segmentation fault. 0x08080fab in up_histent (he=0x0) at hist.c:948 948 return he->up == hist_ring? NULL : he->up; (gdb) where where #0 0x08080fab in up_histent (he=0x0) at hist.c:948 #1 0x08082544 in hcomsearch (str=0xb7ccc388 "commands") at hist.c:1455 #2 0x08059927 in fcgetcomm (s=0xb7ccc388 "commands") at builtin.c:1520 #3 0x0805885e in bin_fc (nam=0xb7ccc378 "fc", argv=0xbfffc1d4, ops=0xbfffc258, func=16) at builtin.c:1391 #4 0x0805555c in execbuiltin (args=0xb7ccc348, bn=0x80e082c) at builtin.c:438 #5 0x0807184d in execcmd (state=0xbfffc8ec, input=0, output=0, how=18, last1=2) at exec.c:3061 #6 0x0806d781 in execpline2 (state=0xbfffc8ec, pcode=259, how=18, input=0, output=0, last1=0) at exec.c:1557 #7 0x0806cb61 in execpline (state=0xbfffc8ec, slcode=5122, how=18, last1=0) at exec.c:1343 #8 0x0806c3a4 in execlist (state=0xbfffc8ec, dont_change_job=0, exiting=0) at exec.c:1141 #9 0x0806be79 in execode (p=0xb7ccc2d0, dont_change_job=0, exiting=0) at exec.c:973 #10 0x08085a2f in loop (toplevel=1, justonce=0) at init.c:181 #11 0x0808855c in zsh_main (argc=4, argv=0xbfffca24) at init.c:1406 #12 0x08054a86 in main (argc=Cannot access memory at address 0x706100 ) at ./main.c:93 (gdb) p he p he $1 = (Histent) 0x0 (gdb) quit A possible patch should be attached. ------=_Part_30377_16225834.1221923670574 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline
Found this bug when adding history to zshdb:

#!/usr/local/bin/zsh -if
history -ap ./$$
fc -l commands



Program received signal SIGSEGV, Segmentation fault.
0x08080fab in up_histent (he=0x0) at hist.c:948
948        return he->up == hist_ring? NULL : he->up;
(gdb) where
where
#0  0x08080fab in up_histent (he=0x0) at hist.c:948
#1  0x08082544 in hcomsearch (str=0xb7ccc388 "commands") at hist.c:1455
#2  0x08059927 in fcgetcomm (s=0xb7ccc388 "commands") at builtin.c:1520
#3  0x0805885e in bin_fc (nam=0xb7ccc378 "fc", argv=0xbfffc1d4,
    ops=0xbfffc258, func=16) at builtin.c:1391
#4  0x0805555c in execbuiltin (args=0xb7ccc348, bn=0x80e082c) at builtin.c:438
#5  0x0807184d in execcmd (state=0xbfffc8ec, input=0, output=0, how=18,
    last1=2) at exec.c:3061
#6  0x0806d781 in execpline2 (state=0xbfffc8ec, pcode=259, how=18, input=0,
    output=0, last1=0) at exec.c:1557
#7  0x0806cb61 in execpline (state=0xbfffc8ec, slcode=5122, how=18, last1=0)
    at exec.c:1343
#8  0x0806c3a4 in execlist (state=0xbfffc8ec, dont_change_job=0, exiting=0)
    at exec.c:1141
#9  0x0806be79 in execode (p=0xb7ccc2d0, dont_change_job=0, exiting=0)
    at exec.c:973
#10 0x08085a2f in loop (toplevel=1, justonce=0) at init.c:181
#11 0x0808855c in zsh_main (argc=4, argv=0xbfffca24) at init.c:1406
#12 0x08054a86 in main (argc=Cannot access memory at address 0x706100
) at ./main.c:93
(gdb) p he
p he
$1 = (Histent) 0x0
(gdb) quit

A possible patch should be attached.
------=_Part_30377_16225834.1221923670574-- ------=_Part_30376_15260580.1221923670573 Content-Type: text/x-diff; name=hbug.diff Content-Transfer-Encoding: base64 X-Attachment-Id: f_flcdppkr0 Content-Disposition: attachment; filename=hbug.diff SW5kZXg6IFNyYy9oaXN0LmMKPT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09 PT09PT09PT09PT09PT09PT09PT09PT09PT09PQpSQ1MgZmlsZTogL2N2c3Jvb3QvenNoL3pzaC9T cmMvaGlzdC5jLHYKcmV0cmlldmluZyByZXZpc2lvbiAxLjg0CmRpZmYgLXUgLXIxLjg0IGhpc3Qu YwotLS0gU3JjL2hpc3QuYwkxOCBTZXAgMjAwOCAwOTo0Mjo0NSAtMDAwMAkxLjg0CisrKyBTcmMv aGlzdC5jCTIwIFNlcCAyMDA4IDE1OjExOjMyIC0wMDAwCkBAIC05NDUsNyArOTQ1LDcgQEAKIG1v ZF9leHBvcnQgSGlzdGVudAogdXBfaGlzdGVudChIaXN0ZW50IGhlKQogewotICAgIHJldHVybiBo ZS0+dXAgPT0gaGlzdF9yaW5nPyBOVUxMIDogaGUtPnVwOworICAgIHJldHVybiAhaGUgfHwgaGUt PnVwID09IGhpc3RfcmluZz8gTlVMTCA6IGhlLT51cDsKIH0KIAogLyoqLwo= ------=_Part_30376_15260580.1221923670573--