unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#43716: 28.0.50; Error with emacsclient <file>:
@ 2020-09-30  7:03 Tassilo Horn
  2020-09-30 13:03 ` Lars Ingebrigtsen
  0 siblings, 1 reply; 18+ messages in thread
From: Tassilo Horn @ 2020-09-30  7:03 UTC (permalink / raw)
  To: 43716, larsi


Since today, emacsclient file.txt errors with

  *ERROR*: Wrong number of arguments: (1 . 4), 5

That seems to happen after commit:

  7f2c35d028 Fix emacsclient -c foo.txt behaviour with many frames

I've tried M-x toggle-debug-on-error RET in the Emacs instance running
the server but still I don't get a backtrace buffer.

Since I've had not time and needed a working emacs I just reverted to
some older version for now but I'm happy do diagnose the issue later
which might very well be in my .emacs.  I just need some help in how to
find out the erroneous function call with too many args...


In GNU Emacs 28.0.50 (build 13, x86_64-pc-linux-gnu)
 of 2020-09-29 built on jiffyarch
Repository revision: 9f30a6b1a417cebe795956a7eef44b8cd9b71557
Repository branch: master
System Description: Arch Linux

Configured using:
 'configure --without-x --without-x-toolkit'

Configured features:
SOUND GPM DBUS NOTIFY INOTIFY ACL GNUTLS LIBXML2 ZLIB XIM MODULES
THREADS LIBSYSTEMD PDUMPER

Important settings:
  value of $LANG: en_US.UTF-8
  locale-coding-system: utf-8-unix

Major mode: Magit

Minor modes in effect:
  cursor-sensor-mode: t
  rcirc-track-minor-mode: t
  global-aggressive-indent-mode: t
  which-key-mode: t
  global-company-mode: t
  yas-global-mode: t
  yas-minor-mode: t
  global-magit-file-mode: t
  magit-auto-revert-mode: t
  global-git-commit-mode: t
  async-bytecomp-package-mode: t
  shell-dirtrack-mode: t
  visual-filename-abbrev-mode: t
  bug-reference-mode: t
  override-global-mode: t
  minibuffer-depth-indicate-mode: t
  electric-pair-mode: t
  recentf-mode: t
  global-subword-mode: t
  subword-mode: t
  save-place-mode: t
  savehist-mode: t
  show-paren-mode: t
  tooltip-mode: t
  global-eldoc-mode: t
  eldoc-mode: t
  electric-indent-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  buffer-read-only: t
  column-number-mode: t
  line-number-mode: t
  transient-mark-mode: t

Load-path shadows:
None found.

Features:
(shadow emacsbug mule-util magit-extras cursor-sensor face-remap sort
gnus-cite qp mm-archive gnus-async gnus-bcklg gnus-ml hl-line nndraft
nnmh rot13 utf-7 secrets nnml nnnil gnus-agent gnus-srvr gnus-score
score-mode nnvirtual gnus-cache gnus-demon nntp spam spam-stat gnus-uu
yenc gnus-msg gnus-gravatar mail-extr gravatar url-cache gnus-topic
gnus-registry registry eieio-base dns misearch multi-isearch
network-stream rcirc-color th-private rcirc term/screen term/xterm xterm
cus-edit cus-start cus-load company-oddmuse company-keywords
company-etags etags fileloop generator company-gtags
company-dabbrev-code company-dabbrev company-files company-clang
company-capf company-cmake company-semantic company-template
company-bbdb paredit vc-mtn vc-hg vc-bzr vc-src vc-sccs vc-svn vc-cvs
vc-rcs display-fill-column-indicator auto-package-update finder-inf
generic logview datetime extmap bindat fish-mode cargo cargo-process
rust-mode web-mode disp-table eglot array jsonrpc ert pp debug backtrace
xref flymake-proc flymake mwheel compile deadgrep spinner hl-todo
aggressive-indent rainbow-mode vc-git vc-dir ewoc vc vc-dispatcher
epa-file org ob ob-tangle ob-ref ob-lob ob-table ob-exp org-macro
org-footnote org-src ob-comint org-pcomplete org-list org-faces
org-entities org-version ob-emacs-lisp ob-core ob-eval org-table ol
org-keys org-compat org-macs org-loaddefs find-func cal-menu calendar
cal-loaddefs dired-x dired-collapse dired-hacks-utils f s smtpmail-multi
smtpmail sendmail ecomplete auto-dictionary flyspell ispell tramp-smb
tramp tramp-loaddefs trampver tramp-integration files-x tramp-compat
ls-lisp which-key highlight-parentheses company-restclient
know-your-http-well http-status-codes http-relations http-methods
http-headers company pcase raven project yasnippet restclient forge-list
forge-commands forge-semi forge-bitbucket buck forge-gogs gogs
forge-gitea gtea forge-gitlab glab forge-github ghub-graphql treepy
gsexp ghub let-alist gnutls forge-notify forge-revnote forge-pullreq
forge-issue forge-topic forge-post markdown-mode color thingatpt
noutline outline forge-repo forge forge-core forge-db closql
emacsql-sqlite emacsql emacsql-compiler magit-submodule magit-obsolete
magit-blame magit-stash magit-reflog magit-bisect magit-push magit-pull
magit-fetch magit-clone magit-remote magit-commit magit-sequence
magit-notes magit-worktree magit-tag magit-merge magit-branch
magit-reset magit-files magit-refs magit-status magit magit-repos
magit-apply magit-wip magit-log which-func imenu magit-diff smerge-mode
diff diff-mode magit-core magit-autorevert autorevert filenotify
magit-margin magit-transient magit-process magit-mode git-commit
transient format-spec magit-git magit-section magit-utils crm log-edit
pcvs-util add-log with-editor async-bytecomp advice async shell
pcomplete comint ansi-color ring server dash visual-filename-abbrev
debbugs soap-client url-http url-auth url-gw nsm warnings rng-xsd rng-dt
rng-util xsd-regexp bug-reference use-package-bind-key bind-key
easy-mmode mb-depth use-package-diminish windmove elec-pair regexp-opt
rx recentf tree-widget cap-words superword subword saveplace savehist
paren smiley gnus-art mm-uu mml2015 mm-view mml-smime smime dig gnus-sum
url url-proxy url-privacy url-expand url-methods url-history mailcap shr
kinsoku url-cookie url-domsuf url-util image svg dom gnus-group
gnus-undo gnus-start gnus-dbus dbus xml gnus-cloud nnimap nnmail
mail-source utf7 netrc nnoo parse-time iso8601 gnus-spec gnus-int
gnus-range message rmc puny dired dired-loaddefs rfc822 mml mml-sec epa
derived epg epg-config mm-decode mm-bodies mm-encode mail-parse rfc2231
mailabbrev gmm-utils mailheader gnus-win gnus wid-edit nnheader
gnus-util rmail rmail-loaddefs rfc2047 rfc2045 ietf-drums
text-property-search time-date mm-util mail-prsvr mail-utils edmacro
kmacro modus-operandi-theme modus-vivendi-theme dracula-theme diminish
cl-extra help-mode use-package-ensure use-package-core info tool-bar
package easymenu browse-url url-handlers url-parse auth-source cl-seq
eieio eieio-core cl-macs eieio-loaddefs password-cache json subr-x map
url-vars seq byte-opt gv bytecomp byte-compile cconv cl-loaddefs cl-lib
tooltip eldoc electric uniquify ediff-hook vc-hooks lisp-float-type
tabulated-list replace newcomment text-mode elisp-mode lisp-mode
prog-mode register page tab-bar menu-bar rfn-eshadow isearch timer
select mouse jit-lock font-lock syntax facemenu font-core
term/tty-colors frame minibuffer cl-generic cham georgian utf-8-lang
misc-lang vietnamese tibetan thai tai-viet lao korean japanese eucjp-ms
cp51932 hebrew greek romanian slovak czech european ethiopic indian
cyrillic chinese composite charscript charprop case-table epa-hook
jka-cmpr-hook help simple abbrev obarray cl-preloaded nadvice button
loaddefs faces cus-face macroexp files window text-properties overlay
sha1 md5 base64 format env code-pages mule custom widget
hashtable-print-readable backquote threads dbusbind inotify multi-tty
make-network-process emacs)

Memory information:
((conses 16 891278 84285)
 (symbols 48 50632 17)
 (strings 32 266731 12920)
 (string-bytes 1 8292644)
 (vectors 16 81831)
 (vector-slots 8 1674061 217319)
 (floats 8 605 1078)
 (intervals 56 14086 214)
 (buffers 992 45))





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

* bug#43716: 28.0.50; Error with emacsclient <file>:
  2020-09-30  7:03 bug#43716: 28.0.50; Error with emacsclient <file>: Tassilo Horn
@ 2020-09-30 13:03 ` Lars Ingebrigtsen
  2020-09-30 13:58   ` Tassilo Horn
  0 siblings, 1 reply; 18+ messages in thread
From: Lars Ingebrigtsen @ 2020-09-30 13:03 UTC (permalink / raw)
  To: Tassilo Horn; +Cc: 43716

Tassilo Horn <tsdh@gnu.org> writes:

> Since today, emacsclient file.txt errors with
>
>   *ERROR*: Wrong number of arguments: (1 . 4), 5
>
> That seems to happen after commit:
>
>   7f2c35d028 Fix emacsclient -c foo.txt behaviour with many frames
>
> I've tried M-x toggle-debug-on-error RET in the Emacs instance running
> the server but still I don't get a backtrace buffer.

I'm unable to reproduce this problem on the current trunk.

Has your server Emacs been restarted from a rebuilt tree?

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no





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

* bug#43716: 28.0.50; Error with emacsclient <file>:
  2020-09-30 13:03 ` Lars Ingebrigtsen
@ 2020-09-30 13:58   ` Tassilo Horn
  2020-09-30 14:07     ` Lars Ingebrigtsen
  2020-09-30 14:40     ` Andreas Schwab
  0 siblings, 2 replies; 18+ messages in thread
From: Tassilo Horn @ 2020-09-30 13:58 UTC (permalink / raw)
  To: Lars Ingebrigtsen; +Cc: 43716

Lars Ingebrigtsen <larsi@gnus.org> writes:

Hi Lars,

>> Since today, emacsclient file.txt errors with
>>
>>   *ERROR*: Wrong number of arguments: (1 . 4), 5
>>
>> That seems to happen after commit:
>>
>>   7f2c35d028 Fix emacsclient -c foo.txt behaviour with many frames
>>
>> I've tried M-x toggle-debug-on-error RET in the Emacs instance
>> running the server but still I don't get a backtrace buffer.
>
> I'm unable to reproduce this problem on the current trunk.

I'm currently on 17ecfa8698 and get that problem also on another
computer (but with the same ~/.emacs).

> Has your server Emacs been restarted from a rebuilt tree?

Yes, I also made a full "make bootstrap" to be sure but the error
persists.

I cannot reproduce the issue with "emacs -Q", though, so it's most
probably something with my configuration or some 3rd party package.  If
I'd know the function call site or at least what function's called with
too many args, I'd probably figure out what's the problem.

I've tried:

--8<---------------cut here---------------start------------->8---
❯ gdb lib-src/emacsclient
GNU gdb (GDB) 9.2
Copyright (C) 2020 Free Software Foundation, Inc.
[snip]
(gdb) run ~/tmp/test.aux
Starting program: /home/horn/Repos/el/emacs/lib-src/emacsclient ~/tmp/test.aux
Waiting for Emacs...
*ERROR*: Wrong number of arguments: (1 . 4), 5
[Inferior 1 (process 23487) exited with code 01]
(gdb) bt
No stack.
--8<---------------cut here---------------end--------------->8---

Any help?  My GDB foo is quite low but I can operate it when given
instructions.

Bye,
Tassilo





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

* bug#43716: 28.0.50; Error with emacsclient <file>:
  2020-09-30 13:58   ` Tassilo Horn
@ 2020-09-30 14:07     ` Lars Ingebrigtsen
  2020-09-30 14:27       ` Eli Zaretskii
                         ` (2 more replies)
  2020-09-30 14:40     ` Andreas Schwab
  1 sibling, 3 replies; 18+ messages in thread
From: Lars Ingebrigtsen @ 2020-09-30 14:07 UTC (permalink / raw)
  To: Tassilo Horn; +Cc: 43716

Tassilo Horn <tsdh@gnu.org> writes:

> I cannot reproduce the issue with "emacs -Q", though, so it's most
> probably something with my configuration or some 3rd party package.  If
> I'd know the function call site or at least what function's called with
> too many args, I'd probably figure out what's the problem.

It's unfortunate that there's no way to get Emacs to reliably give a
backtrace -- I'm guessing there's a condition-case somewhere in the
server code that inhibits the debugging?

Does

(setq debug-ignored-errors nil
      debug-on-error t)

help with getting a backtrace?  (It's a long shot...)

(setq debug-on-message "arguments")

may allow the backtrace to appear in some circumstances. 

> Starting program: /home/horn/Repos/el/emacs/lib-src/emacsclient ~/tmp/test.aux
> Waiting for Emacs...
> *ERROR*: Wrong number of arguments: (1 . 4), 5

I grepped for the string "*ERROR*" in the Emacs source tree, and
couldn't find it, but perhaps it's composed differently.

> [Inferior 1 (process 23487) exited with code 01]
> (gdb) bt
> No stack.
>
> Any help?  My GDB foo is quite low but I can operate it when given
> instructions.

Setting a breakpoint on Fsignal could perhaps work?  My gdb-foo is low,
too, though.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no





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

* bug#43716: 28.0.50; Error with emacsclient <file>:
  2020-09-30 14:07     ` Lars Ingebrigtsen
@ 2020-09-30 14:27       ` Eli Zaretskii
  2020-09-30 14:38         ` Tassilo Horn
  2020-09-30 14:30       ` Tassilo Horn
  2020-09-30 14:42       ` Andreas Schwab
  2 siblings, 1 reply; 18+ messages in thread
From: Eli Zaretskii @ 2020-09-30 14:27 UTC (permalink / raw)
  To: Lars Ingebrigtsen; +Cc: 43716, tsdh

> From: Lars Ingebrigtsen <larsi@gnus.org>
> Date: Wed, 30 Sep 2020 16:07:06 +0200
> Cc: 43716@debbugs.gnu.org
> 
> It's unfortunate that there's no way to get Emacs to reliably give a
> backtrace

I thought debug-on-event and SIGUSR1/SIGUSR2 were such a way?





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

* bug#43716: 28.0.50; Error with emacsclient <file>:
  2020-09-30 14:07     ` Lars Ingebrigtsen
  2020-09-30 14:27       ` Eli Zaretskii
@ 2020-09-30 14:30       ` Tassilo Horn
  2020-09-30 14:50         ` Lars Ingebrigtsen
  2020-09-30 14:42       ` Andreas Schwab
  2 siblings, 1 reply; 18+ messages in thread
From: Tassilo Horn @ 2020-09-30 14:30 UTC (permalink / raw)
  To: Lars Ingebrigtsen; +Cc: 43716

Lars Ingebrigtsen <larsi@gnus.org> writes:

> It's unfortunate that there's no way to get Emacs to reliably give a
> backtrace -- I'm guessing there's a condition-case somewhere in the
> server code that inhibits the debugging?

Possibly.

> Does
>
> (setq debug-ignored-errors nil
>       debug-on-error t)
>
> help with getting a backtrace?  (It's a long shot...)
>
> (setq debug-on-message "arguments")
>
> may allow the backtrace to appear in some circumstances. 

Neither of those seems to work for this specific issue. :-(

>> Starting program: /home/horn/Repos/el/emacs/lib-src/emacsclient ~/tmp/test.aux
>> Waiting for Emacs...
>> *ERROR*: Wrong number of arguments: (1 . 4), 5
>
> I grepped for the string "*ERROR*" in the Emacs source tree, and
> couldn't find it, but perhaps it's composed differently.

I found it. :-)

lib-src/emacsclient.c
2095               fprintf (stderr, "*ERROR*: %s", str);

>> [Inferior 1 (process 23487) exited with code 01]
>> (gdb) bt
>> No stack.
>>
>> Any help?  My GDB foo is quite low but I can operate it when given
>> instructions.
>
> Setting a breakpoint on Fsignal could perhaps work?  My gdb-foo is
> low, too, though.

Hm, I come there at least 5 times when "emacsclient file" is run.  I've
looked at "bt", especially the lisp backtraces but those contained just
(error ...) or (signal ...) forms wheras I guess the error I get must
come from funcall or so...

Bye,
Tassilo





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

* bug#43716: 28.0.50; Error with emacsclient <file>:
  2020-09-30 14:27       ` Eli Zaretskii
@ 2020-09-30 14:38         ` Tassilo Horn
  2020-09-30 14:54           ` Eli Zaretskii
  0 siblings, 1 reply; 18+ messages in thread
From: Tassilo Horn @ 2020-09-30 14:38 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: Lars Ingebrigtsen, 43716

Eli Zaretskii <eliz@gnu.org> writes:

>> It's unfortunate that there's no way to get Emacs to reliably give a
>> backtrace
>
> I thought debug-on-event and SIGUSR1/SIGUSR2 were such a way?

More details, please.  I mean, it's set to sigusr2 by default and I get
a *Backtrace* buffer with "kill -SIGUSR2 <emacs_pid>".  But how does
that help with the "emacsclient <file>" invocation?

Anyway, I'm sure you know where I have to set a breakpoint in order to
find out where and for which function "Wrong number of arguments" is
signalled, right?

Bye,
Tassilo






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

* bug#43716: 28.0.50; Error with emacsclient <file>:
  2020-09-30 13:58   ` Tassilo Horn
  2020-09-30 14:07     ` Lars Ingebrigtsen
@ 2020-09-30 14:40     ` Andreas Schwab
  2020-09-30 14:44       ` Tassilo Horn
  1 sibling, 1 reply; 18+ messages in thread
From: Andreas Schwab @ 2020-09-30 14:40 UTC (permalink / raw)
  To: Tassilo Horn; +Cc: Lars Ingebrigtsen, 43716

On Sep 30 2020, Tassilo Horn wrote:

> ❯ gdb lib-src/emacsclient
> GNU gdb (GDB) 9.2
> Copyright (C) 2020 Free Software Foundation, Inc.
> [snip]
> (gdb) run ~/tmp/test.aux
> Starting program: /home/horn/Repos/el/emacs/lib-src/emacsclient ~/tmp/test.aux
> Waiting for Emacs...
> *ERROR*: Wrong number of arguments: (1 . 4), 5

The error is generated by Emacs, so you need to point the debuger to it.

Andreas.

-- 
Andreas Schwab, schwab@linux-m68k.org
GPG Key fingerprint = 7578 EB47 D4E5 4D69 2510  2552 DF73 E780 A9DA AEC1
"And now for something completely different."





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

* bug#43716: 28.0.50; Error with emacsclient <file>:
  2020-09-30 14:07     ` Lars Ingebrigtsen
  2020-09-30 14:27       ` Eli Zaretskii
  2020-09-30 14:30       ` Tassilo Horn
@ 2020-09-30 14:42       ` Andreas Schwab
  2 siblings, 0 replies; 18+ messages in thread
From: Andreas Schwab @ 2020-09-30 14:42 UTC (permalink / raw)
  To: Lars Ingebrigtsen; +Cc: 43716, Tassilo Horn

On Sep 30 2020, Lars Ingebrigtsen wrote:

> I grepped for the string "*ERROR*" in the Emacs source tree, and
> couldn't find it, but perhaps it's composed differently.

Try "git grep -F '*ERROR*'".  Emacsclient is just displaying the answer
it received from Emacs.

Andreas.

-- 
Andreas Schwab, schwab@linux-m68k.org
GPG Key fingerprint = 7578 EB47 D4E5 4D69 2510  2552 DF73 E780 A9DA AEC1
"And now for something completely different."





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

* bug#43716: 28.0.50; Error with emacsclient <file>:
  2020-09-30 14:40     ` Andreas Schwab
@ 2020-09-30 14:44       ` Tassilo Horn
  0 siblings, 0 replies; 18+ messages in thread
From: Tassilo Horn @ 2020-09-30 14:44 UTC (permalink / raw)
  To: Andreas Schwab; +Cc: Lars Ingebrigtsen, 43716

Andreas Schwab <schwab@linux-m68k.org> writes:

>> ❯ gdb lib-src/emacsclient
>> GNU gdb (GDB) 9.2
>> Copyright (C) 2020 Free Software Foundation, Inc.
>> [snip]
>> (gdb) run ~/tmp/test.aux
>> Starting program: /home/horn/Repos/el/emacs/lib-src/emacsclient ~/tmp/test.aux
>> Waiting for Emacs...
>> *ERROR*: Wrong number of arguments: (1 . 4), 5
>
> The error is generated by Emacs, so you need to point the debuger to it.

Yeah, I've debugged emacs with a breakpoint inside Fsignal after Lars
suggested to debug that.

Bye,
Tassilo






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

* bug#43716: 28.0.50; Error with emacsclient <file>:
  2020-09-30 14:30       ` Tassilo Horn
@ 2020-09-30 14:50         ` Lars Ingebrigtsen
  2020-09-30 15:51           ` Tassilo Horn
  2020-09-30 17:59           ` Noam Postavsky
  0 siblings, 2 replies; 18+ messages in thread
From: Lars Ingebrigtsen @ 2020-09-30 14:50 UTC (permalink / raw)
  To: Tassilo Horn; +Cc: 43716

Tassilo Horn <tsdh@gnu.org> writes:

> I found it. :-)
>
> lib-src/emacsclient.c
> 2095               fprintf (stderr, "*ERROR*: %s", str);

Ah!  So the Emacs server reports it back to the client as an error.  No
wonder there's no backtrace here.  :-/

What about the following patch -- if that's the correct condition-case
that's catching all this, then it should give you a backtrace in the
server Emacs after reloading server.el.

diff --git a/lisp/server.el b/lisp/server.el
index a660deab8e..bdeed6bb00 100644
--- a/lisp/server.el
+++ b/lisp/server.el
@@ -1069,7 +1069,7 @@ server-process-filter
     (when prev
       (setq string (concat prev string))
       (process-put proc 'previous-string nil)))
-  (condition-case err
+  (condition-case-unless-debug err
       (progn
 	(server-add-client proc)
 	;; Send our pid

This is like the gazillionth time I've wanted a way to say (just when
debugging stuff like this) "there should be a way to disable all
condition case constructs"...

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no





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

* bug#43716: 28.0.50; Error with emacsclient <file>:
  2020-09-30 14:38         ` Tassilo Horn
@ 2020-09-30 14:54           ` Eli Zaretskii
  0 siblings, 0 replies; 18+ messages in thread
From: Eli Zaretskii @ 2020-09-30 14:54 UTC (permalink / raw)
  To: Tassilo Horn; +Cc: larsi, 43716

> From: Tassilo Horn <tsdh@gnu.org>
> Cc: Lars Ingebrigtsen <larsi@gnus.org>,  43716@debbugs.gnu.org
> Date: Wed, 30 Sep 2020 16:38:33 +0200
> 
> > I thought debug-on-event and SIGUSR1/SIGUSR2 were such a way?
> 
> More details, please.  I mean, it's set to sigusr2 by default and I get
> a *Backtrace* buffer with "kill -SIGUSR2 <emacs_pid>".  But how does
> that help with the "emacsclient <file>" invocation?

Sorry, I though getting a backtrace in an arbitrary place in the code
was what you were after.  If the above doesn't help you, then my
apologies for the noise.





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

* bug#43716: 28.0.50; Error with emacsclient <file>:
  2020-09-30 14:50         ` Lars Ingebrigtsen
@ 2020-09-30 15:51           ` Tassilo Horn
  2020-09-30 17:08             ` Tassilo Horn
  2020-10-01  3:30             ` Lars Ingebrigtsen
  2020-09-30 17:59           ` Noam Postavsky
  1 sibling, 2 replies; 18+ messages in thread
From: Tassilo Horn @ 2020-09-30 15:51 UTC (permalink / raw)
  To: Lars Ingebrigtsen; +Cc: Jonas Bernoulli, 43716

Lars Ingebrigtsen <larsi@gnus.org> writes:

Hi Lars,

>> I found it. :-)
>>
>> lib-src/emacsclient.c
>> 2095               fprintf (stderr, "*ERROR*: %s", str);
>
> Ah!  So the Emacs server reports it back to the client as an error.
> No wonder there's no backtrace here.  :-/
>
> What about the following patch -- if that's the correct condition-case
> that's catching all this, then it should give you a backtrace in the
> server Emacs after reloading server.el.

That doesn't work but pointed into the right direction.  I've edebugged
`server-process-filter' now, and the Wrong number of arguments message
appears when the (server-execute ...)  form is evaluated.

--8<---------------cut here---------------start------------->8---
          (process-put
           proc 'continuation
           (lambda ()
             (with-current-buffer (get-buffer-create server-buffer)
               ;; Use the same cwd as the emacsclient, if possible, so
               ;; relative file names work correctly, even in `eval'.
               (let ((default-directory
                       (if (and dir (file-directory-p dir))
                           dir default-directory)))
                 (server-execute proc files nowait commands
                                 dontkill frame tty-name)))))
--8<---------------cut here---------------end--------------->8---

So I edebugged server-execute, and the error happens when calling
`server-switch-buffer' in:

--8<---------------cut here---------------start------------->8---
          (cond
           ((or isearch-mode (minibufferp))
            nil)
           ((and frame (null buffers))
            (run-hooks 'server-after-make-frame-hook)
            (message "%s" (substitute-command-keys
                           "When done with this frame, type \\[delete-frame]")))
           ((not (null buffers))
            (run-hooks 'server-after-make-frame-hook)
            (server-switch-buffer
             (car buffers) nil (cdr (car files))
             ;; When triggered from "emacsclient -c", we popped up a
             ;; new frame.  Ensure that we switch to the requested
             ;; buffer in that frame, and not in some other frame
             ;; where it may be displayed.
             (plist-get (process-plist proc) 'frame))
--8<---------------cut here---------------end--------------->8---

And that is *advised* by with-editor.el (used by Magit):

--8<---------------cut here---------------start------------->8---
server-switch-buffer is a Lisp closure in ‘server.el’.

(server-switch-buffer &optional NEXT-BUFFER KILLED-ONE FILEPOS THIS-FRAME-ONLY)

This function has :around advice:
‘server-switch-buffer--with-editor-server-window-alist’.
--8<---------------cut here---------------end--------------->8---

From with-editor.el:

--8<---------------cut here---------------start------------->8---
(defun server-switch-buffer--with-editor-server-window-alist
    (fn &optional next-buffer killed-one filepos)
  "Honor `with-editor-server-window-alist' (which see)."
  (let ((server-window (with-current-buffer
                           (or next-buffer (current-buffer))
                         (when with-editor-mode
                           (setq with-editor-previous-winconf
                                 (current-window-configuration)))
                         (with-editor-server-window))))
    (funcall fn next-buffer killed-one filepos)))

(advice-add 'server-switch-buffer :around
            'server-switch-buffer--with-editor-server-window-alist)
--8<---------------cut here---------------end--------------->8---

I've added Jonas to the Cc.  What breaks the advice is the new
`this-frame-only' parameter of `server-switch-buffer' Lars introduced on
master with 7f2c35d0287.

I guess with-editor.el needs to discriminate by emacs version or use a
&rest argument in the advice and checking the individual 3 (emacs < 28)
or 4 (emacs 28) arguments separately.

Bye,
Tassilo





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

* bug#43716: 28.0.50; Error with emacsclient <file>:
  2020-09-30 15:51           ` Tassilo Horn
@ 2020-09-30 17:08             ` Tassilo Horn
  2020-10-01 15:33               ` Tassilo Horn
  2020-10-01  3:30             ` Lars Ingebrigtsen
  1 sibling, 1 reply; 18+ messages in thread
From: Tassilo Horn @ 2020-09-30 17:08 UTC (permalink / raw)
  To: Lars Ingebrigtsen; +Cc: Jonas Bernoulli, 43716

I've filed a bug report for with-editor
https://github.com/magit/with-editor/issues/82.  (Not sure if I should
close the emacs report right now.  I'll close it when the upstream issue
is resolved.)

Bye,
Tassilo





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

* bug#43716: 28.0.50; Error with emacsclient <file>:
  2020-09-30 14:50         ` Lars Ingebrigtsen
  2020-09-30 15:51           ` Tassilo Horn
@ 2020-09-30 17:59           ` Noam Postavsky
  2020-09-30 18:10             ` Lars Ingebrigtsen
  1 sibling, 1 reply; 18+ messages in thread
From: Noam Postavsky @ 2020-09-30 17:59 UTC (permalink / raw)
  To: Lars Ingebrigtsen; +Cc: 43716, Tassilo Horn

Lars Ingebrigtsen <larsi@gnus.org> writes:

> This is like the gazillionth time I've wanted a way to say (just when
> debugging stuff like this) "there should be a way to disable all
> condition case constructs"...

(setq debug-on-signal t)?






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

* bug#43716: 28.0.50; Error with emacsclient <file>:
  2020-09-30 17:59           ` Noam Postavsky
@ 2020-09-30 18:10             ` Lars Ingebrigtsen
  0 siblings, 0 replies; 18+ messages in thread
From: Lars Ingebrigtsen @ 2020-09-30 18:10 UTC (permalink / raw)
  To: Noam Postavsky; +Cc: 43716, Tassilo Horn

Noam Postavsky <npostavs@gmail.com> writes:

> Lars Ingebrigtsen <larsi@gnus.org> writes:
>
>> This is like the gazillionth time I've wanted a way to say (just when
>> debugging stuff like this) "there should be a way to disable all
>> condition case constructs"...
>
> (setq debug-on-signal t)?

Oh, cool.  :-)

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no





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

* bug#43716: 28.0.50; Error with emacsclient <file>:
  2020-09-30 15:51           ` Tassilo Horn
  2020-09-30 17:08             ` Tassilo Horn
@ 2020-10-01  3:30             ` Lars Ingebrigtsen
  1 sibling, 0 replies; 18+ messages in thread
From: Lars Ingebrigtsen @ 2020-10-01  3:30 UTC (permalink / raw)
  To: Tassilo Horn; +Cc: Jonas Bernoulli, 43716

Tassilo Horn <tsdh@gnu.org> writes:

> I guess with-editor.el needs to discriminate by emacs version or use a
> &rest argument in the advice and checking the individual 3 (emacs < 28)
> or 4 (emacs 28) arguments separately.

(help-function-arglist 'server-switch-buffer)

should help determining what version is in use.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no





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

* bug#43716: 28.0.50; Error with emacsclient <file>:
  2020-09-30 17:08             ` Tassilo Horn
@ 2020-10-01 15:33               ` Tassilo Horn
  0 siblings, 0 replies; 18+ messages in thread
From: Tassilo Horn @ 2020-10-01 15:33 UTC (permalink / raw)
  To: Lars Ingebrigtsen; +Cc: Jonas Bernoulli, 43716-done

Tassilo Horn <tsdh@gnu.org> writes:

> I've filed a bug report for with-editor
> https://github.com/magit/with-editor/issues/82.  (Not sure if I should
> close the emacs report right now.  I'll close it when the upstream
> issue is resolved.)

Fixed upstream.  I'm closing this report.  Thanks a lot, Jonas!

Bye,
Tassilo






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

end of thread, other threads:[~2020-10-01 15:33 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-09-30  7:03 bug#43716: 28.0.50; Error with emacsclient <file>: Tassilo Horn
2020-09-30 13:03 ` Lars Ingebrigtsen
2020-09-30 13:58   ` Tassilo Horn
2020-09-30 14:07     ` Lars Ingebrigtsen
2020-09-30 14:27       ` Eli Zaretskii
2020-09-30 14:38         ` Tassilo Horn
2020-09-30 14:54           ` Eli Zaretskii
2020-09-30 14:30       ` Tassilo Horn
2020-09-30 14:50         ` Lars Ingebrigtsen
2020-09-30 15:51           ` Tassilo Horn
2020-09-30 17:08             ` Tassilo Horn
2020-10-01 15:33               ` Tassilo Horn
2020-10-01  3:30             ` Lars Ingebrigtsen
2020-09-30 17:59           ` Noam Postavsky
2020-09-30 18:10             ` Lars Ingebrigtsen
2020-09-30 14:42       ` Andreas Schwab
2020-09-30 14:40     ` Andreas Schwab
2020-09-30 14:44       ` Tassilo Horn

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