From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Paul Eggert Newsgroups: gmane.emacs.bugs Subject: bug#20191: 25.0.50; SIGABRT in re_match_2_internal Date: Fri, 27 Mar 2015 12:37:57 -0700 Organization: UCLA Computer Science Department Message-ID: <5515B195.2020404@cs.ucla.edu> References: <55119E21.6010109@cs.ucla.edu> <871tkdshgm.fsf@yahoo.fr> <551446A6.1080603@cs.ucla.edu> <87fv8qwhvd.fsf@yahoo.fr> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="------------030802020208000109020203" X-Trace: ger.gmane.org 1427485171 2772 80.91.229.3 (27 Mar 2015 19:39:31 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 27 Mar 2015 19:39:31 +0000 (UTC) Cc: 20191-done@debbugs.gnu.org To: Nicolas Richard Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Fri Mar 27 20:39:20 2015 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1Yba64-00081e-D8 for geb-bug-gnu-emacs@m.gmane.org; Fri, 27 Mar 2015 20:39:12 +0100 Original-Received: from localhost ([::1]:51613 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Yba63-000776-TC for geb-bug-gnu-emacs@m.gmane.org; Fri, 27 Mar 2015 15:39:11 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:37743) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Yba5y-00075T-N8 for bug-gnu-emacs@gnu.org; Fri, 27 Mar 2015 15:39:08 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Yba5v-0001sz-Ag for bug-gnu-emacs@gnu.org; Fri, 27 Mar 2015 15:39:06 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:48546) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Yba5v-0001sg-6g for bug-gnu-emacs@gnu.org; Fri, 27 Mar 2015 15:39:03 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.80) (envelope-from ) id 1Yba5u-0005lg-VN for bug-gnu-emacs@gnu.org; Fri, 27 Mar 2015 15:39:03 -0400 Resent-From: Paul Eggert Original-Sender: "Debbugs-submit" Resent-To: bug-gnu-emacs@gnu.org Resent-Date: Fri, 27 Mar 2015 19:39:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: cc-closed 20191 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Mail-Followup-To: 20191@debbugs.gnu.org, eggert@cs.ucla.edu, theonewiththeevillook@yahoo.fr Original-Received: via spool by 20191-done@debbugs.gnu.org id=D20191.142748509122104 (code D ref 20191); Fri, 27 Mar 2015 19:39:02 +0000 Original-Received: (at 20191-done) by debbugs.gnu.org; 27 Mar 2015 19:38:11 +0000 Original-Received: from localhost ([127.0.0.1]:38320 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Yba54-0005kR-DF for submit@debbugs.gnu.org; Fri, 27 Mar 2015 15:38:11 -0400 Original-Received: from smtp.cs.ucla.edu ([131.179.128.62]:44747) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Yba4z-0005jt-JN for 20191-done@debbugs.gnu.org; Fri, 27 Mar 2015 15:38:07 -0400 Original-Received: from localhost (localhost.localdomain [127.0.0.1]) by smtp.cs.ucla.edu (Postfix) with ESMTP id 15293A60003; Fri, 27 Mar 2015 12:37:59 -0700 (PDT) X-Virus-Scanned: amavisd-new at smtp.cs.ucla.edu Original-Received: from smtp.cs.ucla.edu ([127.0.0.1]) by localhost (smtp.cs.ucla.edu [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id BjYeMJRmLXQw; Fri, 27 Mar 2015 12:37:57 -0700 (PDT) Original-Received: from Penguin.CS.UCLA.EDU (Penguin.CS.UCLA.EDU [131.179.64.200]) by smtp.cs.ucla.edu (Postfix) with ESMTPSA id C2FD539E8013; Fri, 27 Mar 2015 12:37:57 -0700 (PDT) User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.5.0 In-Reply-To: <87fv8qwhvd.fsf@yahoo.fr> X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 140.186.70.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:100980 Archived-At: This is a multi-part message in MIME format. --------------030802020208000109020203 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit On 03/27/2015 09:00 AM, Nicolas Richard wrote: > > Should I report either of these as a bug ? Thanks, don't bother, I fixed it in master with the first attached patch. > I then get a core dump. Thanks. I reproduced that problem. It's an issue with the Emacs debugger, not with regular-expression matching. (The regular expression matcher is very slow with your example -- which is a problem, but I suggest filing a separate bug report for the performance problem, as this bug report is about a SIGABRT.) I fixed the problem in master by applying the second and third attached patches (which fix some related bugs while I was at it) and am marking this as done. At least, it works for me; if it still doesn't work for you we can reopen the bug report. --------------030802020208000109020203 Content-Type: text/x-patch; name="0001-Port-etags-to-DDEBUG.patch" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="0001-Port-etags-to-DDEBUG.patch" >From 84c7c6fd2b9604fa28e0b834caa46423114b9c5b Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Fri, 27 Mar 2015 11:14:14 -0700 Subject: [PATCH 1/3] Port etags to -DDEBUG * etags.c (xnew, xrnew) [DEBUG]: Don't include chkmalloc.h, which is not part of Emacs and is typically not installed. Instead, just invoke xmalloc and xrealloc as usual. Problem reported by Nicolas Richard in: http://bugs.gnu.org/20191#20 (xrnew): Avoid no-longer-needed cast to 'char *'. (xrealloc): First arg is now void *, not char *. --- lib-src/ChangeLog | 11 +++++++++++ lib-src/etags.c | 17 ++++------------- 2 files changed, 15 insertions(+), 13 deletions(-) diff --git a/lib-src/ChangeLog b/lib-src/ChangeLog index 9786809..0bb24c3 100644 --- a/lib-src/ChangeLog +++ b/lib-src/ChangeLog @@ -1,3 +1,14 @@ +2015-03-27 Paul Eggert + + Port etags to -DDEBUG + * etags.c (xnew, xrnew) [DEBUG]: Don't include chkmalloc.h, which + is not part of Emacs and is typically not installed. + Instead, just invoke xmalloc and xrealloc as usual. + Problem reported by Nicolas Richard in: + http://bugs.gnu.org/20191#20 + (xrnew): Avoid no-longer-needed cast to 'char *'. + (xrealloc): First arg is now void *, not char *. + 2015-03-06 Paul Eggert Random minor fixes for movemail diff --git a/lib-src/etags.c b/lib-src/etags.c index 7f18755..b1361db 100644 --- a/lib-src/etags.c +++ b/lib-src/etags.c @@ -176,17 +176,8 @@ char pot_etags_version[] = "@(#) pot revision number is 17.38.1.4"; * SYNOPSIS: Type *xnew (int n, Type); * void xrnew (OldPointer, int n, Type); */ -#if DEBUG -# include "chkmalloc.h" -# define xnew(n,Type) ((Type *) trace_malloc (__FILE__, __LINE__, \ - (n) * sizeof (Type))) -# define xrnew(op,n,Type) ((op) = (Type *) trace_realloc (__FILE__, __LINE__, \ - (char *) (op), (n) * sizeof (Type))) -#else -# define xnew(n,Type) ((Type *) xmalloc ((n) * sizeof (Type))) -# define xrnew(op,n,Type) ((op) = (Type *) xrealloc ( \ - (char *) (op), (n) * sizeof (Type))) -#endif +#define xnew(n, Type) ((Type *) xmalloc ((n) * sizeof (Type))) +#define xrnew(op, n, Type) ((op) = (Type *) xrealloc (op, (n) * sizeof (Type))) typedef void Lang_function (FILE *); @@ -348,7 +339,7 @@ static void canonicalize_filename (char *); static void linebuffer_init (linebuffer *); static void linebuffer_setlen (linebuffer *, int); static void *xmalloc (size_t); -static void *xrealloc (char *, size_t); +static void *xrealloc (void *, size_t); static char searchar = '/'; /* use /.../ searches */ @@ -6533,7 +6524,7 @@ xmalloc (size_t size) } static void * -xrealloc (char *ptr, size_t size) +xrealloc (void *ptr, size_t size) { void *result = realloc (ptr, size); if (result == NULL) -- 2.1.0 --------------030802020208000109020203 Content-Type: text/x-patch; name="0002-Port-user-login-name-initialization-to-Qnil-0.patch" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="0002-Port-user-login-name-initialization-to-Qnil-0.patch" >From 589a4034b7af522c5b8107d5089fb1aec523a1e4 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Fri, 27 Mar 2015 11:57:44 -0700 Subject: [PATCH 2/3] Port user-login-name initialization to Qnil == 0 * editfns.c (Fuser_login_name, Fuser_real_login_name) (syms_of_editfns): Don't rely on all-bits-zero being an Elisp integer, as this is no longer true now that Qnil == 0. --- src/ChangeLog | 5 +++++ src/editfns.c | 5 +++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/ChangeLog b/src/ChangeLog index 3f9ab4f..61f2a84 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,5 +1,10 @@ 2015-03-27 Paul Eggert + Port user-login-name initialization to Qnil == 0 + * editfns.c (Fuser_login_name, Fuser_real_login_name) + (syms_of_editfns): Don't rely on all-bits-zero being an Elisp integer, + as this is no longer true now that Qnil == 0. + Assume !BROKEN_NON_BLOCKING_CONNECT From a suggestion by Eli Zaretskii in: http://lists.gnu.org/archive/html/emacs-devel/2015-03/msg00824.html diff --git a/src/editfns.c b/src/editfns.c index f463890..7d3e462 100644 --- a/src/editfns.c +++ b/src/editfns.c @@ -1191,7 +1191,7 @@ of the user with that uid, or nil if there is no such user. */) /* Set up the user name info if we didn't do it before. (That can happen if Emacs is dumpable but you decide to run `temacs -l loadup' and not dump. */ - if (INTEGERP (Vuser_login_name)) + if (NILP (Vuser_login_name)) init_editfns (); if (NILP (uid)) @@ -1214,7 +1214,7 @@ This ignores the environment variables LOGNAME and USER, so it differs from /* Set up the user name info if we didn't do it before. (That can happen if Emacs is dumpable but you decide to run `temacs -l loadup' and not dump. */ - if (INTEGERP (Vuser_login_name)) + if (NILP (Vuser_login_name)) init_editfns (); return Vuser_real_login_name; } @@ -4955,6 +4955,7 @@ functions if all the text being accessed has this property. */); DEFVAR_LISP ("user-login-name", Vuser_login_name, doc: /* The user's name, taken from environment variables if possible. */); + Vuser_login_name = Qnil; DEFVAR_LISP ("user-real-login-name", Vuser_real_login_name, doc: /* The user's name, based upon the real uid only. */); -- 2.1.0 --------------030802020208000109020203 Content-Type: text/x-patch; name="0003-Avoid-some-core-dumps-in-X-session-management.patch" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="0003-Avoid-some-core-dumps-in-X-session-management.patch" >From 01d1024bec7781066440104ebee0b186382e10f3 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Fri, 27 Mar 2015 12:10:44 -0700 Subject: [PATCH 3/3] Avoid some core dumps in X session management Derived from a bug report by Nicolas Richard in: http://bugs.gnu.org/20191#20 * xsmfns.c (smc_save_yourself_CB): Don't dump core if invocation-name is not a string. Initialize user-login-name if it is not already initialized, and don't dump core if it is not a string. (create_client_leader_window): Don't dump core if x-resource-name and x-resource-class are not both strings. (x_session_initialize): Don't dump core if x-session-previous-id, invocation-directory, and invocation-name are not strings. --- src/ChangeLog | 14 ++++++++++++++ src/xsmfns.c | 57 +++++++++++++++++++++++++++++++++------------------------ 2 files changed, 47 insertions(+), 24 deletions(-) diff --git a/src/ChangeLog b/src/ChangeLog index 61f2a84..db3056c 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,6 +1,20 @@ 2015-03-27 Paul Eggert + Avoid some core dumps in X session management + Derived from a bug report by Nicolas Richard in: + http://bugs.gnu.org/20191#20 + * xsmfns.c (smc_save_yourself_CB): Don't dump core if + invocation-name is not a string. Initialize user-login-name if it + is not already initialized, and don't dump core if it is not a + string. + (create_client_leader_window): Don't dump core if x-resource-name + and x-resource-class are not both strings. + (x_session_initialize): Don't dump core if x-session-previous-id, + invocation-directory, and invocation-name are not strings. + Port user-login-name initialization to Qnil == 0 + Derived from a bug report by Nicolas Richard in: + http://bugs.gnu.org/20191#20 * editfns.c (Fuser_login_name, Fuser_real_login_name) (syms_of_editfns): Don't rely on all-bits-zero being an Elisp integer, as this is no longer true now that Qnil == 0. diff --git a/src/xsmfns.c b/src/xsmfns.c index 0e635d3..375b51c 100644 --- a/src/xsmfns.c +++ b/src/xsmfns.c @@ -168,7 +168,6 @@ smc_save_yourself_CB (SmcConn smcConn, int val_idx = 0, vp_idx = 0; int props_idx = 0; int i; - char *cwd = get_current_dir_name (); char *smid_opt, *chdir_opt = NULL; /* How to start a new instance of Emacs. */ @@ -181,27 +180,34 @@ smc_save_yourself_CB (SmcConn smcConn, props[props_idx]->vals[0].value = emacs_program; ++props_idx; - /* The name of the program. */ - props[props_idx] = &prop_ptr[props_idx]; - props[props_idx]->name = xstrdup (SmProgram); - props[props_idx]->type = xstrdup (SmARRAY8); - props[props_idx]->num_vals = 1; - props[props_idx]->vals = &values[val_idx++]; - props[props_idx]->vals[0].length = SBYTES (Vinvocation_name); - props[props_idx]->vals[0].value = SDATA (Vinvocation_name); - ++props_idx; + if (STRINGP (Vinvocation_name)) + { + /* The name of the program. */ + props[props_idx] = &prop_ptr[props_idx]; + props[props_idx]->name = xstrdup (SmProgram); + props[props_idx]->type = xstrdup (SmARRAY8); + props[props_idx]->num_vals = 1; + props[props_idx]->vals = &values[val_idx++]; + props[props_idx]->vals[0].length = SBYTES (Vinvocation_name); + props[props_idx]->vals[0].value = SDATA (Vinvocation_name); + ++props_idx; + } /* User id. */ - props[props_idx] = &prop_ptr[props_idx]; - props[props_idx]->name = xstrdup (SmUserID); - props[props_idx]->type = xstrdup (SmARRAY8); - props[props_idx]->num_vals = 1; - props[props_idx]->vals = &values[val_idx++]; - props[props_idx]->vals[0].length = SBYTES (Vuser_login_name); - props[props_idx]->vals[0].value = SDATA (Vuser_login_name); - ++props_idx; - + Lisp_Object user_login_name = Fuser_login_name (Qnil); + if (STRINGP (user_login_name)) + { + props[props_idx] = &prop_ptr[props_idx]; + props[props_idx]->name = xstrdup (SmUserID); + props[props_idx]->type = xstrdup (SmARRAY8); + props[props_idx]->num_vals = 1; + props[props_idx]->vals = &values[val_idx++]; + props[props_idx]->vals[0].length = SBYTES (user_login_name); + props[props_idx]->vals[0].value = SDATA (user_login_name); + ++props_idx; + } + char *cwd = get_current_dir_name (); if (cwd) { props[props_idx] = &prop_ptr[props_idx]; @@ -372,6 +378,7 @@ create_client_leader_window (struct x_display_info *dpyinfo, char *client_ID) -1, -1, 1, 1, CopyFromParent, CopyFromParent, CopyFromParent); + validate_x_resource_name (); class_hints.res_name = SSDATA (Vx_resource_name); class_hints.res_class = SSDATA (Vx_resource_class); XSetClassHint (dpyinfo->display, w, &class_hints); @@ -402,22 +409,24 @@ x_session_initialize (struct x_display_info *dpyinfo) /* Check if we where started by the session manager. If so, we will have a previous id. */ - if (! NILP (Vx_session_previous_id) && STRINGP (Vx_session_previous_id)) + if (STRINGP (Vx_session_previous_id)) previous_id = SSDATA (Vx_session_previous_id); /* Construct the path to the Emacs program. */ - if (! NILP (Vinvocation_directory)) + if (STRINGP (Vinvocation_directory)) name_len += SBYTES (Vinvocation_directory); - name_len += SBYTES (Vinvocation_name); + if (STRINGP (Vinvocation_name)) + name_len += SBYTES (Vinvocation_name); /* This malloc will not be freed, but it is only done once, and hopefully not very large */ emacs_program = xmalloc (name_len + 1); char *z = emacs_program; - if (! NILP (Vinvocation_directory)) + if (STRINGP (Vinvocation_directory)) z = lispstpcpy (z, Vinvocation_directory); - lispstpcpy (z, Vinvocation_name); + if (STRINGP (Vinvocation_name)) + lispstpcpy (z, Vinvocation_name); /* The SM protocol says all callbacks are mandatory, so set up all here and in the mask passed to SmcOpenConnection. */ -- 2.1.0 --------------030802020208000109020203--