zsh-workers
 help / color / mirror / code / Atom feed
* zsh/pcre module causes core dump w/cvs co as of 2007-04-02
@ 2007-04-03  6:00 Bart Schaefer
  2007-04-04 11:45 ` Clint Adams
  0 siblings, 1 reply; 5+ messages in thread
From: Bart Schaefer @ 2007-04-03  6:00 UTC (permalink / raw)
  To: zsh-workers

As it happens, I inadvertently compiled with --enable-pcre on a system
that had the libraries but not the header files for PCRE.  Obviously
this is pilot error, but it shouldn't lead to a crash.

schaefer<500> [[ ab -pcre-match xy ]]
zsh: unrecognized condition: `ab'
schaefer<501> zmodload zsh/pcre
schaefer<502> [[ ab -pcre-match xy ]]

Program received signal SIGSEGV, Segmentation fault.
0x080ac50b in pattryrefs (prog=0x8552c40, string=0x1 "", stringlen=-1, 
    unmetalen=-1, patoffset=0, nump=0x0, begp=0x0, endp=0x0)
    at ../../zsh-4.0/Src/pattern.c:1781
1781        if (*string == Nularg) {
(gdb) where
#0  0x080ac50b in pattryrefs (prog=0x8552c40, string=0x1 "", stringlen=-1, 
    unmetalen=-1, patoffset=0, nump=0x0, begp=0x0, endp=0x0)
    at ../../zsh-4.0/Src/pattern.c:1781
#1  0x080ac4a9 in pattry (prog=0x8552c40, string=0x1 "")
    at ../../zsh-4.0/Src/pattern.c:1725
#2  0x080742b3 in matchpat (a=0x1 "", b=0xb7d612d8 "ab")
    at ../../zsh-4.0/Src/glob.c:1992
#3  0x0806569c in cond_match (args=0xb7d612c8, num=0, str=0x1 "")
    at ../../zsh-4.0/Src/cond.c:479
#4  0x0806448a in evalcond (state=0xbfe9cc90, fromtest=0x0)
    at ../../zsh-4.0/Src/cond.c:122
#5  0x0806dcae in execcond (state=0xbfe9cc90, do_exec=0)
    at ../../zsh-4.0/Src/exec.c:3499
#6  0x08066fdb in execsimple (state=0xbfe9cc90) at ../../zsh-4.0/Src/exec.c:827
#7  0x080671c2 in execlist (state=0xbfe9cc90, dont_change_job=0, exiting=0)
    at ../../zsh-4.0/Src/exec.c:915
#8  0x08066eb5 in execode (p=0xb7d61268, dont_change_job=0, exiting=0)
    at ../../zsh-4.0/Src/exec.c:793
#9  0x0807e86e in loop (toplevel=1, justonce=0) at ../../zsh-4.0/Src/init.c:180
#10 0x0808116c in zsh_main (argc=1, argv=0xbfe9cdd4)
    at ../../zsh-4.0/Src/init.c:1347
#11 0x08052e76 in main (argc=1, argv=0xbfe9cdd4) at ../../zsh-4.0/Src/main.c:93


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: zsh/pcre module causes core dump w/cvs co as of 2007-04-02
  2007-04-03  6:00 zsh/pcre module causes core dump w/cvs co as of 2007-04-02 Bart Schaefer
@ 2007-04-04 11:45 ` Clint Adams
  2007-04-04 15:13   ` Bart Schaefer
  0 siblings, 1 reply; 5+ messages in thread
From: Clint Adams @ 2007-04-04 11:45 UTC (permalink / raw)
  To: zsh-workers

On Mon, Apr 02, 2007 at 11:00:29PM -0700, Bart Schaefer wrote:
> As it happens, I inadvertently compiled with --enable-pcre on a system
> that had the libraries but not the header files for PCRE.  Obviously
> this is pilot error, but it shouldn't lead to a crash.

Is pcre-config present?

> schaefer<500> [[ ab -pcre-match xy ]]
> zsh: unrecognized condition: `ab'
> schaefer<501> zmodload zsh/pcre
> schaefer<502> [[ ab -pcre-match xy ]]

Is #defining that to cond_match ever a good idea?


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: zsh/pcre module causes core dump w/cvs co as of 2007-04-02
  2007-04-04 11:45 ` Clint Adams
@ 2007-04-04 15:13   ` Bart Schaefer
  2007-04-05 16:16     ` Clint Adams
  0 siblings, 1 reply; 5+ messages in thread
From: Bart Schaefer @ 2007-04-04 15:13 UTC (permalink / raw)
  To: zsh-workers

On Apr 4,  7:45am, Clint Adams wrote:
} Subject: Re: zsh/pcre module causes core dump w/cvs co as of 2007-04-02
}
} On Mon, Apr 02, 2007 at 11:00:29PM -0700, Bart Schaefer wrote:
} > As it happens, I inadvertently compiled with --enable-pcre on a system
} > that had the libraries but not the header files for PCRE.  Obviously
} > this is pilot error, but it shouldn't lead to a crash.
} 
} Is pcre-config present?

No.  In RPM-speke, the pcre package was present, but not pcre-devel.
 
} > schaefer<502> [[ ab -pcre-match xy ]]
} 
} Is #defining that to cond_match ever a good idea?

I wouldn't think so, but I'm not sure what that was supposed to achieve.


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: zsh/pcre module causes core dump w/cvs co as of 2007-04-02
  2007-04-04 15:13   ` Bart Schaefer
@ 2007-04-05 16:16     ` Clint Adams
  2007-04-12 10:22       ` Peter Stephenson
  0 siblings, 1 reply; 5+ messages in thread
From: Clint Adams @ 2007-04-05 16:16 UTC (permalink / raw)
  To: zsh-workers

On Wed, Apr 04, 2007 at 08:13:43AM -0700, Bart Schaefer wrote:
> I wouldn't think so, but I'm not sure what that was supposed to achieve.

I haven't a clue.  Maybe it'd be better to prevent the module from being
loadable at all.

Index: Src/Modules/pcre.c
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/Modules/pcre.c,v
retrieving revision 1.10
diff -u -r1.10 pcre.c
--- Src/Modules/pcre.c	30 May 2006 22:35:03 -0000	1.10
+++ Src/Modules/pcre.c	5 Apr 2007 16:12:59 -0000
@@ -189,13 +189,16 @@
     return 0;
 }
 
+static struct conddef cotab[] = {
+    CONDDEF("pcre-match", CONDF_INFIX, cond_pcre_match, 0, 0, CPCRE_PLAIN)
+};
+
 /**/
 #else /* !(HAVE_PCRE_COMPILE && HAVE_PCRE_EXEC) */
 
 # define bin_pcre_compile bin_notavail
 # define bin_pcre_study bin_notavail
 # define bin_pcre_match bin_notavail
-# define cond_pcre_match cond_match
 
 /**/
 #endif /* !(HAVE_PCRE_COMPILE && HAVE_PCRE_EXEC) */
@@ -206,10 +209,6 @@
     BUILTIN("pcre_match",   0, bin_pcre_match,   1, 2, 0, "a",    NULL)
 };
 
-static struct conddef cotab[] = {
-    CONDDEF("pcre-match", CONDF_INFIX, cond_pcre_match, 0, 0, CPCRE_PLAIN)
-};
-
 
 /**/
 int
@@ -222,8 +221,12 @@
 int
 boot_(Module m)
 {
+#if defined(HAVE_PCRE_COMPILE) && defined(HAVE_PCRE_EXEC)
     return !addbuiltins(m->nam, bintab, sizeof(bintab)/sizeof(*bintab)) ||
 	   !addconddefs(m->nam, cotab, sizeof(cotab)/sizeof(*cotab));
+#else /* !(HAVE_PCRE_COMPILE && HAVE_PCRE_EXEC) */
+    return !addbuiltins(m->nam, bintab, sizeof(bintab)/sizeof(*bintab));
+#endif /* !(HAVE_PCRE_COMPILE && HAVE_PCRE_EXEC) */
 }
 
 /**/
@@ -231,7 +234,9 @@
 cleanup_(Module m)
 {
     deletebuiltins(m->nam, bintab, sizeof(bintab)/sizeof(*bintab));
+#if defined(HAVE_PCRE_COMPILE) && defined(HAVE_PCRE_EXEC)
     deleteconddefs(m->nam, cotab, sizeof(cotab)/sizeof(*cotab));
+#endif /* !(HAVE_PCRE_COMPILE && HAVE_PCRE_EXEC) */
     return 0;
 }
 


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: zsh/pcre module causes core dump w/cvs co as of 2007-04-02
  2007-04-05 16:16     ` Clint Adams
@ 2007-04-12 10:22       ` Peter Stephenson
  0 siblings, 0 replies; 5+ messages in thread
From: Peter Stephenson @ 2007-04-12 10:22 UTC (permalink / raw)
  To: Zsh hackers list

Clint Adams <clint@zsh.org> wrote:
> On Wed, Apr 04, 2007 at 08:13:43AM -0700, Bart Schaefer wrote:
> > I wouldn't think so, but I'm not sure what that was supposed to achieve.
> 
> I haven't a clue.  Maybe it'd be better to prevent the module from being
> loadable at all.

That's certainly the attitude I've been taking.  Some of the early modules
load and then report an error when you try to run the feature in question.
That's nasty to test for, so I've been trying (not very actively, just when
I update a module anyway) to ensure that zmodload fails.

-- 
Peter Stephenson <pws@csr.com>                  Software Engineer
CSR PLC, Churchill House, Cambridge Business Park, Cowley Road
Cambridge, CB4 0WZ, UK                          Tel: +44 (0)1223 692070


To access the latest news from CSR copy this link into a web browser:  http://www.csr.com/email_sig.php

To get further information regarding CSR, please visit our Investor Relations page at http://ir.csr.com/csr/about/overview


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2007-04-12 10:28 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-04-03  6:00 zsh/pcre module causes core dump w/cvs co as of 2007-04-02 Bart Schaefer
2007-04-04 11:45 ` Clint Adams
2007-04-04 15:13   ` Bart Schaefer
2007-04-05 16:16     ` Clint Adams
2007-04-12 10:22       ` Peter Stephenson

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).