Subject: bug#28708: closed (Re: bug#28708: 27.0.50; [PATCH] Fix search for ~/.Xdefaults-HOSTNAME)

From: [email-masked] (GNU bug Tracking System)
Date: Wed, 04 Oct 2017 22:27:02 +0000

Your bug report

#28708: 27.0.50; [PATCH] Fix search for ~/.Xdefaults-HOSTNAME

which was filed against the emacs package, has been closed.

The explanation is attached below, along with your original report.
If you require more details, please reply to [email-masked].

-- 
28708: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=28708
GNU Bug Tracking System
Contact [email-masked] with problems

Subject: Re: bug#28708: 27.0.50; [PATCH] Fix search for ~/.Xdefaults-HOSTNAME
From: Paul Eggert <[email-masked]>
To: Johan Bockgård <[email-masked]>, [email-masked]
Date: Wed, 4 Oct 2017 15:26:31 -0700
List-Id: <debbugs-submit.debbugs.gnu.org>

Thanks for catching that bug. I installed the patch in your name into 
the emacs-26 branch.

Subject: 27.0.50; [PATCH] Fix search for ~/.Xdefaults-HOSTNAME
From: Johan Bockgård <[email-masked]>
To: [email-masked]
Date: Wed, 04 Oct 2017 23:44:31 +0200
List-Id: <debbugs-submit.debbugs.gnu.org>

Emacs is supposed to look for X resources in ~/.Xdefaults-HOSTNAME, but
the code forgets the hyphen in the filename.

The bug was introduced in Emacs 25.1, by commit
1e6879dbdb0832427f5c588c89a53a8a80768a00:

2014-12-25  Paul Eggert  <[email-masked]>

       Prefer stpcpy to strcat ...

**

The patch (should this go in the emacs-26 branch?):

diff --git a/src/xrdb.c b/src/xrdb.c
index 15a0147..3c1bad1 100644
--- a/src/xrdb.c
+++ b/src/xrdb.c
@@ -345,6 +345,7 @@ get_user_db (Display *display)
     db = XrmGetStringDatabase (xdefs);
   else
     {
+      /* Use ~/.Xdefaults.  */
       char *home = gethomedir ();
       ptrdiff_t homelen = strlen (home);
       char *filename = xrealloc (home, homelen + sizeof xdefaults);
@@ -375,13 +376,15 @@ 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
-				+ SBYTES (system_name));
+				+ 1 + SBYTES (system_name));
       p = filename = xrealloc (home, filenamesize);
-      lispstpcpy (stpcpy (filename + homelen, xdefaults), system_name);
+      lispstpcpy (stpcpy (stpcpy (filename + homelen, xdefaults), "-"),
+		  system_name);
     }
 
   db = XrmGetFileDatabase (p);