Subject: bug#29067: 26.0.90; "Invalid client frame" when doing save-buffers-kill-terminal

From: Kaushal Modi <[email-masked]>
Date: Wed, 01 Nov 2017 13:32:17 +0000

On Tue, Oct 31, 2017 at 4:42 AM martin rudalics <[email-masked]> wrote:

>
> Evaluate (frame-parameter nil 'client) first after starting emacs with
> the -Q option and then with your customizations and tell us what you
> get.  In a non-client session this parameter should be always nil.
>

Hello,

After bisecting my config, turns out that this issue happens only when I
restore my session using desktop. Copying Eli as he can throw in some light
on cross-compatibility of a desktop.el saved .desktop file between emacs
(non-daemon) and emacsclient (daemon) sessions.

I cannot share my whole .desktop file for obvious reasons, but I see this
in my .desktop file, which seems to be the culprit:

(setq desktop-saved-frameset [frameset 1 (23033 51555 32954 566000)
(desktop . "208") "[email-masked]" nil nil ((((minibuffer . t)
(undecorated) (override-redirect) (font-backend xft x) (font .
"-unknown-PragmataPro-normal-normal-normal-*-18-*-*-*-*-0-iso10646-1")
(font-parameter .
"-unknown-PragmataPro-normal-normal-normal-*-18-*-*-*-*-0-iso10646-1")
(border-width . 0) (internal-border-width . 0) (right-divider-width . 1)
(bottom-divider-width . 0) (vertical-scroll-bars) (horizontal-scroll-bars)
(foreground-color . "#f7f7f7") (background-color . "#282828") (mouse-color
. "black") (border-color . "black") (screen-gamma) (line-spacing)
(left-fringe . 8) (right-fringe . 8) (no-special-glyphs)
(scroll-bar-foreground) (scroll-bar-background) (menu-bar-lines . 0)
(tool-bar-lines . 0) (title) (wait-for-wm . t) (tool-bar-position . top)
(inhibit-double-buffering) (icon-type . t) (auto-raise) (auto-lower)
(cursor-type . box) (scroll-bar-width . 0) (scroll-bar-height . 0) (alpha)
(no-focus-on-map) (no-accept-focus) (fullscreen) (visibility . t)
(skip-taskbar) (z-group) (display-type . color) (background-mode . dark)
(cursor-color . "white") (sticky)  (client . "Unprintable entity")
(tty-type . "xterm-24bits") (tty . "/dev/pts/10") (display . ":1.0")
(frameset--id . "D44A-14E2-2416-0AA9") (frameset--mini t . t) (modeline .
t) (unsplittable) (icon-name) (explicit-name) (fullscreen-restore) (height
. 67) (width . 282) (left . 2560) (top . 0)) ((min-height . 4) (min-width .
10) (min-height-ignore . 2) (min-width-ignore . 4) (min-height-safe . 1)
(min-width-safe . 2) (min-pixel-height . 80) (min-pixel-width . 90)
(min-pixel-height-ignore . 40) (min-pixel-width-ignore . 36)
(min-pixel-height-safe . 20) (min-pixel-width-safe . 18)) leaf (pixel-width
. 2554) (pixel-height . 1320) (total-width . 284) (total-height . 66)
(normal-height . 1.0) (normal-width . 1.0) (buffer "setup-desktop.el"
(selected . t) (hscroll . 0) (fringes 8 8 nil) (margins nil) (scroll-bars
nil 0 t nil 0 t) (vscroll . 0) (dedicated) (point . 6143) (start .
4847))))])

 Note the "(client . "Unprintable entity")" in there.

PS: I have removed the (environment . ..) form from that (setq
desktop-saved-frameset ..) for privary reasons and also it just added a lot
of noise. Also I don't believe that has anything to do with this issue.

I use emacsclient 99.99% percent of times. So my .desktop file is saves
from those sessions. When I started emacs (non-daemon), it did desktop-read
of that .desktop file saved from the last emacsclient session.

So it looks like emacsclient shouldn't save stuff to the .desktop file
(like the 'client parameter) that would cause a future non-daemon emacs
session to think that it's running in daemon mode.

So the root cause analysis would be to figure out what causes the client
parameter to be set to "Unprintable entity". Where is that client parameter
derived from? How can I help debug this further?

As a side, wouldn't doing (daemonp) check instead of (frame-parameter nil
'client) work?
-- 

Kaushal Modi