From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Gilles Newsgroups: gmane.emacs.bugs Subject: bug#47334: 27.1; Incompatibility between daemon, desktop and highlight-changes-mode Date: Sun, 28 Mar 2021 03:06:25 +0200 Message-ID: References: <83h7l289q4.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="2850"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 47334@debbugs.gnu.org To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sun Mar 28 03:08:11 2021 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lQJuT-0000eK-UT for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 28 Mar 2021 03:08:10 +0200 Original-Received: from localhost ([::1]:41894 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lQJuS-0000hU-VT for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 27 Mar 2021 21:08:08 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:42234) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lQJuM-0000h5-5V for bug-gnu-emacs@gnu.org; Sat, 27 Mar 2021 21:08:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:33630) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lQJuL-0001UR-TG for bug-gnu-emacs@gnu.org; Sat, 27 Mar 2021 21:08:01 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1lQJuL-000793-Nh for bug-gnu-emacs@gnu.org; Sat, 27 Mar 2021 21:08:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Gilles Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 28 Mar 2021 01:08:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 47334 X-GNU-PR-Package: emacs Original-Received: via spool by 47334-submit@debbugs.gnu.org id=B47334.161689363227408 (code B ref 47334); Sun, 28 Mar 2021 01:08:01 +0000 Original-Received: (at 47334) by debbugs.gnu.org; 28 Mar 2021 01:07:12 +0000 Original-Received: from localhost ([127.0.0.1]:45176 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lQJtY-00077y-A9 for submit@debbugs.gnu.org; Sat, 27 Mar 2021 21:07:12 -0400 Original-Received: from mail-qt1-f169.google.com ([209.85.160.169]:33665) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lQJtT-00077j-2z for 47334@debbugs.gnu.org; Sat, 27 Mar 2021 21:07:10 -0400 Original-Received: by mail-qt1-f169.google.com with SMTP id 1so6352765qtb.0 for <47334@debbugs.gnu.org>; Sat, 27 Mar 2021 18:07:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=sFvlilFu2bakznhk1D9aIhdoDHUKglXmxn1+jfe0IH0=; b=K4lY02Y7Tat1bw0wF7F/SFcD8ozznARfJHncloXh3zzTRQU0sTNCGrRGQtvfvBjlaf JWYwpn0qvTYXmoVajpub35UYfrS4MI4vMPN/HulvAtwv3eKjWdVsap3o9oYL5Kv3xY+L btuJ4UN63sIGS/ErzX0s3wDFnyx5nk05U4Tidq1uByKv+TLuUG51Ctk3xv1Jl1w/IxKo S+dD4RP2W4sTTAGl6d1nUe/HO5EXoL0iDsAb7p3ak4SW9ksewuj6CIFSJE9MoqiNKsOQ 8kcp3MEzkOK2Us8Ypjnh3JJuhDUQ2NaspiLqqR9CpmzJGive7GTY+1or+dJIH66pHGke 6Xgw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=sFvlilFu2bakznhk1D9aIhdoDHUKglXmxn1+jfe0IH0=; b=Oroi5TfRTfg4TongpTf1yA+prmgV2hej3oHqenzciMxf+WrrmiI/NdmJPef9+EBqv3 Wiv/EXHM/IH17h2IiQ5yc+VLmnsK6G+6cImxp7++UfjEOH6mKooZoCsZKNcmXYdq/IfT g410NIK6c0OY0SOwLTiuWbvvSgntwsap+XPWmOfd/DJPGtUVW+x/C5zQb4eLx3wZrlcn usN8ShMEpPhuMEkeeOwYLSKJiDd/563Wvx3J11EkxjcS2vv6ebFHQKpWzpNzN41a+WId vW7uddI6AOTEgvywR0id7figVr4gdsbQkvmGcGr9bCuIWBmnjHzMD2c8oVKs0ZXrvHWS R2aw== X-Gm-Message-State: AOAM531nWvZ2sv5ocS/A1E19lyykOkHi6H5S2WquOfYj8VGnJ4h14dHF 8fYv0iOZHCoAxpQxPWl34Ye+lJW6TU+vbAoQEdI= X-Google-Smtp-Source: ABdhPJzbwjbiEyuz/v9+OX40F5822SelLxxlDpoRXebV9swMr7IQrjEMWq52fUoU/oLFf2M7mKVGfKu4ztUZ1tLhuZo= X-Received: by 2002:a05:622a:1748:: with SMTP id l8mr17856928qtk.73.1616893621631; Sat, 27 Mar 2021 18:07:01 -0700 (PDT) In-Reply-To: <83h7l289q4.fsf@gnu.org> X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list 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-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:203141 Archived-At: Hello, I've done some further debugging (analysis below) and can reproduce the mute Emacs problem just by throwing an error from `after-init-hook'. I filed a separate bug for that: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=47439 The incompatibility between highlight-changes-mode, desktop and daemon startup exists regardless of the daemon-not-starting bug since highlight-changes-mode is not restored correctly. The daemon-not-starting bug just made it harder to figure out what was going on. ---------------------------------------------------------------- I built emacs-27.2 from source with debugging enabled on Linux (Ubuntu 20.04) / x84_64. I observe the same symptoms. Here's a backtrace. I used src/.gdbinit and do get a Lisp backtrace if I attach to an Emacs process with a non-empty Lisp call stack. ---------------------------------------------------------------- Breakpoint 1 at 0x55d190f50dbd: file emacs.c, line 379. Breakpoint 2 at 0x55d190f026f6: file xterm.c, line 10145. (gdb) bt #0 0x00007fdb9e854246 in __pselect (nfds=8, readfds=0x7fff6656d800, writefds=0x7fff6656d880, exceptfds=0x0, timeout=, sigmask=) at ../sysdeps/unix/sysv/linux/pselect.c:48 #1 0x000055d19120dfbe in really_call_select (arg=0x7fff6656d6f0) at thread.c:586 #2 0x000055d1910740ff in flush_stack_call_func (func=0x55d19120def3 , arg=0x7fff6656d6f0) at alloc.c:4951 #3 0x000055d19120e0ba in thread_select (func=0x7fdb9e854180 <__pselect>, max_fds=8, rfds=0x7fff6656d800, wfds=0x7fff6656d880, efds=0x0, timeout=0x7fff6656de30, sigmask=0x0) at thread.c:616 #4 0x000055d191276770 in xg_select (fds_lim=8, rfds=0x7fff6656dea0, wfds=0x7fff6656df20, efds=0x0, timeout=0x7fff6656de30, sigmask=0x0) at xgselect.c:117 #5 0x000055d19117fc7c in wait_reading_process_output (time_limit=0, nsecs=0, read_kbd=-1, do_display=true, wait_for_cell=XIL(0), wait_proc=0x0, just_wait_proc=0) at process.c:5572 #6 0x000055d190f67260 in kbd_buffer_get_event (kbp=0x7fff6656e200, used_mouse_menu=0x7fff6656e805, end_time=0x0) at keyboard.c:3866 #7 0x000055d190f6189d in read_event_from_main_queue (end_time=0x0, local_getcjmp=0x7fff6656e610, used_mouse_menu=0x7fff6656e805) at keyboard.c:2156 #8 0x000055d190f61cb3 in read_decoded_event_from_main_queue (end_time=0x0, local_getcjmp=0x7fff6656e610, prev_event=XIL(0), used_mouse_menu=0x7fff6656e805) at keyboard.c:2220 #9 0x000055d190f64030 in read_char (commandflag=1, map=XIL(0x55d19260ac23), prev_event=XIL(0), used_mouse_menu=0x7fff6656e805, end_time=0x0) at keyboard.c:2830 #10 0x000055d190f7673b in read_key_sequence (keybuf=0x7fff6656e9f0, prompt=XIL(0), dont_downcase_last=false, can_return_switch_frame=true, fix_current_buffer=true, prevent_redisplay=false) at keyboard.c:9554 #11 0x000055d190f5ef70 in command_loop_1 () at keyboard.c:1350 #12 0x000055d1910d6339 in internal_condition_case (bfun=0x55d190f5ead2 , handlers=XIL(0x90), hfun=0x55d190f5e082 ) at eval.c:1356 #13 0x000055d190f5e693 in command_loop_2 (ignore=XIL(0)) at keyboard.c:1091 #14 0x000055d1910d571c in internal_catch (tag=XIL(0xcc60), func=0x55d190f5e662 , arg=XIL(0)) at eval.c:1117 #15 0x000055d190f5e62d in command_loop () at keyboard.c:1070 #16 0x000055d190f5db49 in recursive_edit_1 () at keyboard.c:714 #17 0x000055d190f5dd49 in Frecursive_edit () at keyboard.c:786 #18 0x000055d190f5375d in main (argc=3, argv=0x7fff6656ee78) at emacs.c:2067 (gdb) p *readfds $1 = { fds_bits = {128, 0 } } (gdb) p *writefds $2 = { fds_bits = {0 } } ---------------------------------------------------------------- It appears that Emacs is waiting for input from an event object. I have no idea what that event object is about, or why the daemon would be waiting for input before starting the server. ---------------------------------------------------------------- $ ls -log /proc/1372320/fd total 0 lrwx------ 1 64 Mar 28 00:25 0 -> /dev/pts/6 lrwx------ 1 64 Mar 28 00:25 1 -> /dev/pts/6 lrwx------ 1 64 Mar 28 00:25 2 -> /dev/pts/6 lrwx------ 1 64 Mar 28 00:25 3 -> 'anon_inode:[timerfd]' l-wx------ 1 64 Mar 28 00:25 4 -> 'pipe:[510996821]' lr-x------ 1 64 Mar 28 00:25 5 -> /var/lib/sss/mc/passwd lrwx------ 1 64 Mar 28 00:25 6 -> 'anon_inode:[eventfd]' lrwx------ 1 64 Mar 28 00:25 7 -> 'anon_inode:[eventfd]' ---------------------------------------------------------------- I added some crude tracing in the init file: ---------------------------------------------------------------- (shell-command "echo >>trace .emacs start") (eval-after-load 'hilit-chg '(shell-command "echo >>trace hilit-chg loaded")) (defun my-highlight-changes-mode-hook () (shell-command (format "echo >>trace 'highlight-changes-mode=%s in %s'" highlight-changes-mode (buffer-name)))) (add-hook 'highlight-changes-mode-hook 'my-highlight-changes-mode-hook) (setq desktop-restore-frames nil) (desktop-save-mode) (require 'hilit-chg) (shell-command "echo >>trace .emacs end") ---------------------------------------------------------------- The resulting trace is: ---------------------------------------------------------------- .emacs start hilit-chg loaded .emacs end ---------------------------------------------------------------- My understanding is that the entry from desktop.el to `after-init-hook' restores the buffer in highlight-changes-mode, which calls (x-display-grayscale-p), which errors out because the daemon doesn't have an X display. And indeed I can reproduce the problem without session restoration or hilit-chg.el: the problem appears if after-init-hook throws an error. Turning on highlight-changes-mode should not depend on the capabilities of the current terminal or display, since this can change as new frames are attached. -- Gilles