Re: pcre problem



Dear Ildar:

Am 05.10.07 12:03 schrieb(en) Ildar Mulyukov:
I've persistent problem with 2.3.20 compiled with PCRE (libpcre3-7.4- alt1) (SIGSEGV)

details attached.

Strange, apparently it isn't possible to compile the regular expression properly (which it /does/ for me, using pcre 7.0 on Fedora 7). Maybe something changed in between in pcre... Can you please try the attached patch which should (a) remove the crash and (b) extend the "url regex compilation failed" message on stderr to something more meaningful. Please post the error message back to the list. Thanks!

Right now I'm using 2.3.20 without pcre. In compose window I have "Reflow selected text" menuitem grayed. Is it because of pcre=off?

No, this is a side-effect of switching off flowed mode (under Options) in the composer.

Cheers, Albrecht.


--
Albrecht Dreß - Johanna-Kirchner-Straße 13 - D-53123 Bonn (Germany)
       Phone (+49) 228 6199571  -  mailto:albrecht dress arcor de
  GnuPG public key:  http://www.mynetcologne.de/~nc-dreszal/pubkey.asc
Index: libbalsa/mime.c
===================================================================
--- libbalsa/mime.c	(Revision 7746)
+++ libbalsa/mime.c	(Arbeitskopie)
@@ -796,7 +796,7 @@
     GtkTextIter start = *iter;
     GtkTextIter end = *iter;
 
-    while (!regexec(url_reg, p, 1, &url_match, 0)) {
+    while (url_reg && !regexec(url_reg, p, 1, &url_match, 0)) {
         glong offset = g_utf8_pointer_to_offset(line, p + url_match.rm_so);
         gtk_text_iter_set_line_offset(&start, offset);
         offset = g_utf8_pointer_to_offset(line, p + url_match.rm_eo);
@@ -891,11 +891,16 @@
         static const char url_str[] =
             "(((https?|ftps?|nntp)://)|(mailto:|news:))"
             "(%[0-9A-F]{2}|[-_.!~*';/?:@&=+$,#[:alnum:]])+";
+	int error;
 
         url_reg = g_new(regex_t, 1);
-        if (regcomp(url_reg, url_str, REG_EXTENDED | REG_ICASE) != 0)
-            g_warning("libbalsa_insert_with_url: "
-                      "url regex compilation failed.");
+        if ((error = regcomp(url_reg, url_str, REG_EXTENDED | REG_ICASE)) != 0) {
+	    gchar errbuf[256];
+
+	    regerror(error, NULL, errbuf, 256);
+            g_warning("%s: url regex compilation failed: %s.", __FUNCTION__, errbuf);
+	    url_reg = NULL;
+	}
     }
 
     return url_reg;
@@ -960,6 +965,7 @@
     if (url_info) {
 	GtkTextTagTable *table = gtk_text_buffer_get_tag_table(buffer);
 	GtkTextTag *url_tag = gtk_text_tag_table_lookup(table, "url");
+	regex_t *url_reg = get_url_reg();
 
 	if (url_info->ml_url) {
 	    gchar *url_end = strchr(p, '>');
@@ -986,9 +992,8 @@
 	    }
 	}
 
-	if (prescanner(p)) {
+	if (url_reg && prescanner(p)) {
 	    gint offset = 0;
-	    regex_t *url_reg = get_url_reg();
 	    regmatch_t url_match;
 	    gint match = regexec(url_reg, p, 1, &url_match, 0);
 

Attachment: pgpzuj9W6iFnQ.pgp
Description: PGP signature



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]