Subject: bug#25228: [emacs-bug] bug#25228: 25.1; GNU emacs 25.1: custom-set-faces from init file ~/.emacs ignored

From: "Dr. Werner Fink" <[email-masked]>
Date: Thu, 6 Mar 2025 10:08:02 +0100

On 2025/02/23 21:04:01 +0200, Björn Bidar wrote:
> Eli Zaretskii <[email-masked]> writes:
> 
> >> Date: Tue, 20 Dec 2016 17:56:48 +0100
> >> From: "Dr. Werner Fink" <[email-masked]>
> >> Cc: Eli Zaretskii <[email-masked]>, [email-masked]
> >> 
> >> > The only guess I have is that the correction had now enabled the :user-spec
> >> > key/attribute.  For a workaround I've change some lines of code in
> >> > lisp/dynamic-setting.el ... compare with the attached patch.
> >> > 
> >> > With this patch both the custom font if enabled in ~/.emacs as well as
> >> > the system font works here for GNU Emacs with GTK as well as with X11.
> >> 
> >> Wrong version of the patch, this one seems to be better one ;)
> >
> > Thanks.  However, this doesn't look like the right fix, because this:
> >
> >> +  (let ((system-font (and (fboundp 'font-get-system-font)
> >> +                       (font-get-system-font)))
> >> +        (frame-list (frames-on-display-list display-or-frame))
> >> +	(user-font (face-attribute 'default :font)))
> >> +    (when (and system-font (display-graphic-p display-or-frame))
> >>        (clear-font-cache)
> >>        (if set-font
> >>  	  ;; Set the font on all current and future frames, as though
> >>  	  ;; the `default' face had been "set for this session":
> >> -	  (set-frame-font new-font nil frame-list)
> >> +	  (if (not user-font)
> >> +	      (set-frame-font system-font nil frame-list)
> >> +	     (set-frame-font user-font nil frame-list))
> >
> > effectively disables the system-font feature, because
> >
> >    (face-attribute 'default :font)
> >
> > will always return non-nil.
> >
> > So if my suggestion of rounding the DPI values before comparing them
> > fixes this for you, it sounds like a better solution to me.
> 
> Ping Werner Could you look at this again?

I'll do as soon as possible ... currently it builds on opensuse.org build
service after I had disabled xwidget support for gtk port as well as fixed
the seccomp filter (see attachment).

Werner

-- 
  "Having a smoking section in a restaurant is like having
          a peeing section in a swimming pool." -- Edward Burr
Allow also to get attributes of the terminal line as
well as support mmap(2) flag MAP_DROPPABLE to allow
zero memory under memory pressure.

---
 lib-src/seccomp-filter.c |   12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

--- lib-src/seccomp-filter.c
+++ lib-src/seccomp-filter.c	2025-03-06 08:46:41.901322068 +0000
@@ -42,6 +42,7 @@ variants of those files that can be used
 #include <stdlib.h>
 #include <stdint.h>
 #include <stdio.h>
+#include <termios.h>
 #include <time.h>
 
 #include <asm/prctl.h>
@@ -64,6 +65,10 @@ variants of those files that can be used
 #define ARCH_CET_STATUS 0x3001
 #endif
 
+#ifndef MAP_DROPPABLE
+#define MAP_DROPPABLE 0x0
+#endif
+
 static ATTRIBUTE_FORMAT_PRINTF (2, 3) _Noreturn void
 fail (int error, const char *format, ...)
 {
@@ -187,7 +192,7 @@ main (int argc, char **argv)
            some versions of the dynamic loader still use it.  Also
            allow allocating thread stacks.  */
         SCMP_A3_32 (SCMP_CMP_MASKED_EQ,
-                    ~(MAP_SHARED | MAP_PRIVATE | MAP_FILE
+                    ~(MAP_SHARED | MAP_PRIVATE | MAP_FILE | MAP_DROPPABLE
                       | MAP_ANONYMOUS | MAP_FIXED | MAP_DENYWRITE
                       | MAP_STACK | MAP_NORESERVE),
                     0));
@@ -274,6 +279,11 @@ main (int argc, char **argv)
         SCMP_A0_32 (SCMP_CMP_EQ, STDIN_FILENO),
         SCMP_A1_32 (SCMP_CMP_EQ, TIOCGPGRP));
 
+  /* Allow `tcgetattr'.  */
+  RULE (SCMP_ACT_ALLOW, SCMP_SYS (ioctl),
+        SCMP_A0_32 (SCMP_CMP_EQ, STDERR_FILENO),
+        SCMP_A1_32 (SCMP_CMP_EQ, TCGETS));
+
   /* Allow reading (but not setting) file flags.  */
   RULE (SCMP_ACT_ALLOW, SCMP_SYS (fcntl),
         SCMP_A1_32 (SCMP_CMP_EQ, F_GETFL));