all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Paul Eggert <eggert@cs.ucla.edu>
To: Noam Postavsky <npostavs@users.sourceforge.net>,
	Richard Stallman <rms@gnu.org>
Cc: Emacs developers <emacs-devel@gnu.org>
Subject: Re: Emacs 26 MacOS bugs
Date: Tue, 6 Feb 2018 15:28:19 -0800	[thread overview]
Message-ID: <a654e4e6-1750-e1fa-ea53-5493bce192fa@cs.ucla.edu> (raw)
In-Reply-To: <CAM-tV-_f72uczrJ-+f3e2Zhw3KDF05Uy4WUFwNS7fw6fK1_KEg@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 297 bytes --]

On 02/06/2018 09:30 AM, Noam Postavsky wrote:
> on w32 I get an assertion failure, patch attached.

On Fedora 27 x86-64 I get a crash when running 'emacs 
--no-build-details'. There are several places in the Emacs code that 
crash when Fsystem_name returns a non-string. Proposed patch attached.


[-- Attachment #2: 0001-Fix-crashes-when-run-with-no-build-details.txt --]
[-- Type: text/plain, Size: 2905 bytes --]

From c7602b4e9e074eb8d0fd701d094f1c244713a70f Mon Sep 17 00:00:00 2001
From: Paul Eggert <eggert@cs.ucla.edu>
Date: Tue, 6 Feb 2018 15:25:45 -0800
Subject: [PATCH] Fix crashes when run with --no-build-details
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

* src/xrdb.c (get_environ_db):
* src/xterm.c (same_x_server, x_term_init):
Don’t assume Fsystem_name returns a string.
---
 src/xrdb.c  | 19 +++++++++++--------
 src/xterm.c | 16 +++++++++++-----
 2 files changed, 22 insertions(+), 13 deletions(-)

diff --git a/src/xrdb.c b/src/xrdb.c
index b55c0f9011..836c147947 100644
--- a/src/xrdb.c
+++ b/src/xrdb.c
@@ -376,15 +376,18 @@ get_environ_db (void)
 
   if (!p)
     {
-      /* Use ~/.Xdefaults-HOSTNAME.  */
-      char *home = gethomedir ();
-      ptrdiff_t homelen = strlen (home);
       Lisp_Object system_name = Fsystem_name ();
-      ptrdiff_t filenamesize = (homelen + sizeof xdefaults
-				+ 1 + SBYTES (system_name));
-      p = filename = xrealloc (home, filenamesize);
-      lispstpcpy (stpcpy (stpcpy (filename + homelen, xdefaults), "-"),
-		  system_name);
+      if (STRINGP (system_name))
+	{
+	  /* Use ~/.Xdefaults-HOSTNAME.  */
+	  char *home = gethomedir ();
+	  ptrdiff_t homelen = strlen (home);
+	  ptrdiff_t filenamesize = (homelen + sizeof xdefaults
+				    + 1 + SBYTES (system_name));
+	  p = filename = xrealloc (home, filenamesize);
+	  lispstpcpy (stpcpy (stpcpy (filename + homelen, xdefaults), "-"),
+		      system_name);
+	}
     }
 
   db = XrmGetFileDatabase (p);
diff --git a/src/xterm.c b/src/xterm.c
index 364a8a8db0..b10664dda9 100644
--- a/src/xterm.c
+++ b/src/xterm.c
@@ -12150,6 +12150,8 @@ same_x_server (const char *name1, const char *name2)
 {
   bool seen_colon = false;
   Lisp_Object sysname = Fsystem_name ();
+  if (! STRINGP (sysname))
+    sysname = empty_unibyte_string;
   const char *system_name = SSDATA (sysname);
   ptrdiff_t system_name_length = SBYTES (sysname);
   ptrdiff_t length_until_period = 0;
@@ -12572,15 +12574,19 @@ x_term_init (Lisp_Object display_name, char *xrm_option, char *resource_name)
 #endif
 
   Lisp_Object system_name = Fsystem_name ();
-  ptrdiff_t nbytes;
-  if (INT_ADD_WRAPV (SBYTES (Vinvocation_name), SBYTES (system_name) + 2,
-		     &nbytes))
+
+  ptrdiff_t nbytes = SBYTES (Vinvocation_name) + 1;
+  if (STRINGP (system_name)
+      && INT_ADD_WRAPV (nbytes, SBYTES (system_name) + 1, &nbytes))
     memory_full (SIZE_MAX);
   dpyinfo->x_id = ++x_display_id;
   dpyinfo->x_id_name = xmalloc (nbytes);
   char *nametail = lispstpcpy (dpyinfo->x_id_name, Vinvocation_name);
-  *nametail++ = '@';
-  lispstpcpy (nametail, system_name);
+  if (STRINGP (system_name))
+    {
+      *nametail++ = '@';
+      lispstpcpy (nametail, system_name);
+    }
 
   /* Figure out which modifier bits mean what.  */
   x_find_modifier_meanings (dpyinfo);
-- 
2.14.3


  reply	other threads:[~2018-02-06 23:28 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-02-06 14:49 Emacs 26 MacOS bugs Richard Stallman
2018-02-06 17:30 ` Noam Postavsky
2018-02-06 23:28   ` Paul Eggert [this message]
2018-02-07  3:37     ` Eli Zaretskii
2018-02-10 14:55     ` Uwe Brauer
2018-02-10 15:18       ` Noam Postavsky
2018-02-07  3:52   ` Eli Zaretskii
2018-02-06 19:05 ` Ben McGinnes
2018-02-06 20:30   ` Noam Postavsky
2018-02-06 22:27     ` Ben McGinnes
2018-02-06 22:30       ` Ben McGinnes
2018-02-06 22:50       ` Noam Postavsky
2018-02-07  0:43         ` Ben McGinnes
2018-02-07  1:33           ` Noam Postavsky
2018-02-07  2:13             ` Ben McGinnes
2018-02-07 22:55               ` Alan Third
2018-02-09 16:35                 ` Ben McGinnes
2018-02-09 16:57                   ` Noam Postavsky
2018-02-09 17:22                     ` Ben McGinnes
2018-02-09 18:13                       ` Noam Postavsky
2018-02-10  1:46                         ` Ben McGinnes
2018-02-10  1:47                   ` Alan Third
2018-02-11 13:53                 ` Philipp Stephani
2018-02-11 21:06                   ` Alan Third
2018-02-07 20:01     ` Alan Third
2018-02-10 15:01     ` Alan Third
2018-02-10 22:45 ` Alan Third
2018-02-11 11:47   ` Alan Third
2018-02-11 15:52     ` Eli Zaretskii
2018-02-11 20:57       ` Alan Third
2018-02-13 19:41         ` Ben McGinnes
2018-02-13 19:46           ` Noam Postavsky
2018-02-11 20:43   ` Richard Stallman

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=a654e4e6-1750-e1fa-ea53-5493bce192fa@cs.ucla.edu \
    --to=eggert@cs.ucla.edu \
    --cc=emacs-devel@gnu.org \
    --cc=npostavs@users.sourceforge.net \
    --cc=rms@gnu.org \
    /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 external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.