unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#29067: 26.0.90; "Invalid client frame" when doing save-buffers-kill-terminal
@ 2017-10-30 17:10 Kaushal Modi
  2017-10-30 18:40 ` Eli Zaretskii
  2017-10-31  8:41 ` martin rudalics
  0 siblings, 2 replies; 10+ messages in thread
From: Kaushal Modi @ 2017-10-30 17:10 UTC (permalink / raw)
  To: 29067

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

X-Debbugs-CC: rudalics@gmx.at

Hello,

Normally (99.99% of the time), I run emacs using emacsclient.

Today I happened to run it with just emacs&. But then when I tried to quit
via save-buffers-kill-terminal, I got "Invalid client frame".

In files.el, we have:

(defun save-buffers-kill-terminal (&optional arg)
  "Offer to save each buffer, then kill the current connection.
If the current frame has no client, kill Emacs itself using
`save-buffers-kill-emacs'.

With prefix ARG, silently save all file-visiting buffers, then kill.

If emacsclient was started with a list of filenames to edit, then
only these files will be asked to be saved."
  (interactive "P")
  (if (frame-parameter nil 'client)
      (server-save-buffers-kill-terminal arg)
    (save-buffers-kill-emacs arg)))

When I eval'ed (frame-parameter nil 'client), I got "Unprintable entity"!

So server-save-buffers-kill-terminal gets called incorrectly instead of
save-buffers-kill-emacs when I actually do not have the emacsclient or
daemon running.

I do not see this issue on emacs 25.3 using my same emacs config.

Copying Martin as he might have an idea what could have caused this
regression.



In GNU Emacs 26.0.90 (build 14, x86_64-pc-linux-gnu, GTK+ Version 2.24.23)
 of 2017-10-26
Repository revision: 646e56e150ca08978d6ce736b12867b4958a0cd8
Windowing system distributor 'The X.Org Foundation', version 11.0.60900000
System Description: Red Hat Enterprise Linux Workstation release 6.6
(Santiago)

Recent messages:
Quit [4 times]
Ag finished
Mark saved where search started
Ag finished
nil
Entering debugger...
uncompressing files.el.gz...done
"Unprintable entity" [2 times]
Mark saved where search started
Mark set
"Unprintable entity"
Configured using:
 'configure --with-modules
 --prefix=/home/kmodi/usr_local/apps/6/emacs/emacs-26
 '--program-transform-name=s/^ctags$/ctags_emacs/'
 'CPPFLAGS=-I/home/kmodi/usr_local/6/include -I/usr/include/freetype2
 -I/usr/include' 'CFLAGS=-ggdb3 -O0' 'CXXFLAGS=-ggdb3 -O0'
 'LDFLAGS=-L/home/kmodi/usr_local/6/lib -L/home/kmodi/usr_local/6/lib64
 -ggdb3'
 PKG_CONFIG_PATH=/home/kmodi/usr_local/6/lib/pkgconfig:/home/kmodi/usr_local/6/lib64/pkgconfig:/cad/adi/apps/gnu/linux/x86_64/6/lib/pkgconfig:/cad/adi/apps/gnu/linux/x86_64/6/lib64/pkgconfig:/home/kmodi/stowed/lib/pkgconfig:/usr/lib/pkgconfig:/usr/lib64/pkgconfig:/usr/share/pkgconfig:/lib/pkgconfig:/lib64/pkgconfig'

Configured features:
XPM JPEG TIFF GIF PNG RSVG IMAGEMAGICK SOUND GPM DBUS GSETTINGS NOTIFY
ACL LIBSELINUX GNUTLS LIBXML2 FREETYPE LIBOTF XFT ZLIB
TOOLKIT_SCROLL_BARS GTK2 X11 MODULES


-- 

Kaushal Modi

[-- Attachment #2: Type: text/html, Size: 3733 bytes --]

^ permalink raw reply	[flat|nested] 10+ messages in thread

* bug#29067: 26.0.90; "Invalid client frame" when doing save-buffers-kill-terminal
  2017-10-30 17:10 bug#29067: 26.0.90; "Invalid client frame" when doing save-buffers-kill-terminal Kaushal Modi
@ 2017-10-30 18:40 ` Eli Zaretskii
  2017-10-30 18:49   ` Kaushal Modi
  2017-10-31  8:41 ` martin rudalics
  1 sibling, 1 reply; 10+ messages in thread
From: Eli Zaretskii @ 2017-10-30 18:40 UTC (permalink / raw)
  To: Kaushal Modi; +Cc: 29067

> From: Kaushal Modi <kaushal.modi@gmail.com>
> Date: Mon, 30 Oct 2017 17:10:13 +0000
> 
> Today I happened to run it with just emacs&. But then when I tried to quit via save-buffers-kill-terminal, I got
> "Invalid client frame".

Please show a Lisp backtrace from this error.

Thanks.





^ permalink raw reply	[flat|nested] 10+ messages in thread

* bug#29067: 26.0.90; "Invalid client frame" when doing save-buffers-kill-terminal
  2017-10-30 18:40 ` Eli Zaretskii
@ 2017-10-30 18:49   ` Kaushal Modi
  0 siblings, 0 replies; 10+ messages in thread
From: Kaushal Modi @ 2017-10-30 18:49 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: 29067

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

On Mon, Oct 30, 2017 at 2:40 PM Eli Zaretskii <eliz@gnu.org> wrote:

>
> Please show a Lisp backtrace from this error.
>

Sorry, should have done that earlier; I just assumed it didn't hold any
information of value for this case.

Debugger entered--Lisp error: (error "Invalid client frame")
  signal(error ("Invalid client frame"))
  error("Invalid client frame")
  server-save-buffers-kill-terminal(nil)
  save-buffers-kill-terminal()
  eval((save-buffers-kill-terminal) nil)
  eval-expression((save-buffers-kill-terminal) nil nil 127)
  funcall-interactively(eval-expression (save-buffers-kill-terminal) nil
nil 127)
  call-interactively(eval-expression nil nil)
  command-execute(eval-expression)

When I edebugged save-buffers-kill-terminal, I saw that (frame-parameter
nil 'client) was evaluating to non-nil as it was returning "Unprintable
entity". So it is executing the wrong clause of that if.

-- 

Kaushal Modi

[-- Attachment #2: Type: text/html, Size: 1579 bytes --]

^ permalink raw reply	[flat|nested] 10+ messages in thread

* bug#29067: 26.0.90; "Invalid client frame" when doing save-buffers-kill-terminal
  2017-10-30 17:10 bug#29067: 26.0.90; "Invalid client frame" when doing save-buffers-kill-terminal Kaushal Modi
  2017-10-30 18:40 ` Eli Zaretskii
@ 2017-10-31  8:41 ` martin rudalics
  2017-11-01 13:32   ` Kaushal Modi
  1 sibling, 1 reply; 10+ messages in thread
From: martin rudalics @ 2017-10-31  8:41 UTC (permalink / raw)
  To: kaushal.modi, 29067

 > Today I happened to run it with just emacs&. But then when I tried to quit
 > via save-buffers-kill-terminal, I got "Invalid client frame".
 >
 > In files.el, we have:
 >
 > (defun save-buffers-kill-terminal (&optional arg)
 >    "Offer to save each buffer, then kill the current connection.
 > If the current frame has no client, kill Emacs itself using
 > `save-buffers-kill-emacs'.
 >
 > With prefix ARG, silently save all file-visiting buffers, then kill.
 >
 > If emacsclient was started with a list of filenames to edit, then
 > only these files will be asked to be saved."
 >    (interactive "P")
 >    (if (frame-parameter nil 'client)
 >        (server-save-buffers-kill-terminal arg)
 >      (save-buffers-kill-emacs arg)))
 >
 > When I eval'ed (frame-parameter nil 'client), I got "Unprintable entity"!
 >
 > So server-save-buffers-kill-terminal gets called incorrectly instead of
 > save-buffers-kill-emacs when I actually do not have the emacsclient or
 > daemon running.
 >
 > I do not see this issue on emacs 25.3 using my same emacs config.

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.

Thanks, martin





^ permalink raw reply	[flat|nested] 10+ messages in thread

* bug#29067: 26.0.90; "Invalid client frame" when doing save-buffers-kill-terminal
  2017-10-31  8:41 ` martin rudalics
@ 2017-11-01 13:32   ` Kaushal Modi
  2017-11-01 13:40     ` Kaushal Modi
  2017-11-01 17:43     ` martin rudalics
  0 siblings, 2 replies; 10+ messages in thread
From: Kaushal Modi @ 2017-11-01 13:32 UTC (permalink / raw)
  To: martin rudalics; +Cc: 29067

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

On Tue, Oct 31, 2017 at 4:42 AM martin rudalics <rudalics@gmx.at> 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") "kmodi@foo.company.com" 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

[-- Attachment #2: Type: text/html, Size: 4593 bytes --]

^ permalink raw reply	[flat|nested] 10+ messages in thread

* bug#29067: 26.0.90; "Invalid client frame" when doing save-buffers-kill-terminal
  2017-11-01 13:32   ` Kaushal Modi
@ 2017-11-01 13:40     ` Kaushal Modi
  2017-11-01 13:51       ` Kaushal Modi
  2017-11-01 17:43     ` martin rudalics
  1 sibling, 1 reply; 10+ messages in thread
From: Kaushal Modi @ 2017-11-01 13:40 UTC (permalink / raw)
  To: martin rudalics; +Cc: 29067

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

I need to add that I never saw this issue in my emacsclient sessions,
because in my config, I directly call (save-buffers-kill-emacs) if
(daemonp). So the (save-buffers-kill-terminal) never got executed when
running emacsclient with my config.

So I see this issue on emacsclient too if I do
M-x save-buffers-kill-terminal

So need to figure out what could cause that client parameter to be set to
"Unprintable entity".


-- 

Kaushal Modi

[-- Attachment #2: Type: text/html, Size: 906 bytes --]

^ permalink raw reply	[flat|nested] 10+ messages in thread

* bug#29067: 26.0.90; "Invalid client frame" when doing save-buffers-kill-terminal
  2017-11-01 13:40     ` Kaushal Modi
@ 2017-11-01 13:51       ` Kaushal Modi
  0 siblings, 0 replies; 10+ messages in thread
From: Kaushal Modi @ 2017-11-01 13:51 UTC (permalink / raw)
  To: martin rudalics; +Cc: 29067

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

On Wed, Nov 1, 2017 at 9:40 AM Kaushal Modi <kaushal.modi@gmail.com> wrote:

> So need to figure out what could cause that client parameter to be set to
> "Unprintable entity".
>

This is the further I good go in elisp land:

Evaluating:

  (pp (frame-parameters (car (frame-list))))

gives (after removing buffer-list, buried-buffers-list, environment forms):

"((parent-id . 20506031)
 (outer-window-id . \"52429003\")
 (window-id . \"52429034\")
 (top . 0)
 (left . 2560)
 (width . 282)
 (height . 67)
 (name . \"emacs [emacs-26]   *scratch-emacs-lisp-mode**\")
 (fullscreen-restore)
 (explicit-name)
 (icon-name)
 (unsplittable)
 (modeline . t)
 (frameset--mini t . t)
 (frameset--id . \"D44A-14E2-2416-0AA9\")
 (display . \":1.0\")
 (tty . \"/dev/pts/10\")
 (tty-type . \"xterm-24bits\")
 (sticky)
 (cursor-color . \"white\")
 (background-mode . dark)
 (display-type . color)
 (client . \"Unprintable entity\")
 (z-group)
 (skip-taskbar)
 (visibility . t)
 (fullscreen)
 (no-accept-focus)
 (no-focus-on-map)
 (alpha)
 (scroll-bar-height . 0)
 (scroll-bar-width . 0)
 (cursor-type . box)
 (auto-lower)
 (auto-raise)
 (icon-type . t)
 (inhibit-double-buffering)
 (tool-bar-position . top)
 (wait-for-wm . t)
 (title)
 (buffer-predicate)
 (tool-bar-lines . 0)
 (menu-bar-lines . 0)
 (scroll-bar-background)
 (scroll-bar-foreground)
 (no-special-glyphs)
 (right-fringe . 8)
 (left-fringe . 8)
 (line-spacing)
 (screen-gamma)
 (border-color . \"black\")
 (mouse-color . \"black\")
 (background-color . \"#282828\")
 (foreground-color . \"#f7f7f7\")
 (horizontal-scroll-bars)
 (vertical-scroll-bars)
 (bottom-divider-width . 0)
 (right-divider-width . 1)
 (internal-border-width . 0)
 (border-width . 0)
 (font-parameter .
\"-unknown-PragmataPro-normal-normal-normal-*-18-*-*-*-*-0-iso10646-1\")
 (font .
\"-unknown-PragmataPro-normal-normal-normal-*-18-*-*-*-*-0-iso10646-1\")
 (font-backend xft x)
 (override-redirect)
 (undecorated)
 (parent-frame)
 (minibuffer . t))
"

Now frame-parameters is a C function and somehow derives the client
parameter to be "Unprintable entity". Let me know how I can further debug
this.
-- 

Kaushal Modi

[-- Attachment #2: Type: text/html, Size: 3630 bytes --]

^ permalink raw reply	[flat|nested] 10+ messages in thread

* bug#29067: 26.0.90; "Invalid client frame" when doing save-buffers-kill-terminal
  2017-11-01 13:32   ` Kaushal Modi
  2017-11-01 13:40     ` Kaushal Modi
@ 2017-11-01 17:43     ` martin rudalics
  2017-11-01 18:52       ` Kaushal Modi
  1 sibling, 1 reply; 10+ messages in thread
From: martin rudalics @ 2017-11-01 17:43 UTC (permalink / raw)
  To: Kaushal Modi; +Cc: 29067

 > 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.

Right.  So please add

      (client        . :never)

to 'frameset-persistent-filter-alist' (you probably have to remake your
autoloads afterwards) and look whether the problem is gone.

martin





^ permalink raw reply	[flat|nested] 10+ messages in thread

* bug#29067: 26.0.90; "Invalid client frame" when doing save-buffers-kill-terminal
  2017-11-01 17:43     ` martin rudalics
@ 2017-11-01 18:52       ` Kaushal Modi
  2017-11-02  9:51         ` martin rudalics
  0 siblings, 1 reply; 10+ messages in thread
From: Kaushal Modi @ 2017-11-01 18:52 UTC (permalink / raw)
  To: martin rudalics; +Cc: 29067

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

On Wed, Nov 1, 2017 at 1:43 PM martin rudalics <rudalics@gmx.at> wrote:

> Right.  So please add
>
>       (client        . :never)
>
> to 'frameset-persistent-filter-alist' (you probably have to remake your
> autoloads afterwards) and look whether the problem is gone.
>

That worked!

Now (frame-parameter nil 'client) returns nowait in emacsclient and nil in
emacs.

Can you please commit the fix?

Thanks!
-- 

Kaushal Modi

[-- Attachment #2: Type: text/html, Size: 904 bytes --]

^ permalink raw reply	[flat|nested] 10+ messages in thread

* bug#29067: 26.0.90; "Invalid client frame" when doing save-buffers-kill-terminal
  2017-11-01 18:52       ` Kaushal Modi
@ 2017-11-02  9:51         ` martin rudalics
  0 siblings, 0 replies; 10+ messages in thread
From: martin rudalics @ 2017-11-02  9:51 UTC (permalink / raw)
  To: Kaushal Modi; +Cc: 29067-done

 > Can you please commit the fix?

Done.  server.el sets other parameters like 'environment' and
'server-dummy-buffer'.  I suppose these shouldn't be preserved either
but didn't bother to do that.  In any case I added a note to the frame
parameters documentation that applications should care about which of
their parameters they want to save and restore via the desktop library.

Closing this bug.

martin





^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2017-11-02  9:51 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-10-30 17:10 bug#29067: 26.0.90; "Invalid client frame" when doing save-buffers-kill-terminal Kaushal Modi
2017-10-30 18:40 ` Eli Zaretskii
2017-10-30 18:49   ` Kaushal Modi
2017-10-31  8:41 ` martin rudalics
2017-11-01 13:32   ` Kaushal Modi
2017-11-01 13:40     ` Kaushal Modi
2017-11-01 13:51       ` Kaushal Modi
2017-11-01 17:43     ` martin rudalics
2017-11-01 18:52       ` Kaushal Modi
2017-11-02  9:51         ` martin rudalics

Code repositories for project(s) associated with this public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).