Subject: Re: bug#78860: 30.1.90; eshell: wrong-number-of-arguments

From: Eli Zaretskii <[email-masked]>
Date: Sun, 22 Jun 2025 18:51:33 +0300

> Cc: [email-masked]
> Date: Sun, 22 Jun 2025 18:04:52 +0300
> From: Eli Zaretskii <[email-masked]>
> 
> > X-Spam-Status: No, score=0 tagged_above=-10 required=5 tests=[none]
> >  autolearn=ham autolearn_force=no
> > From: Christopher Howard <[email-masked]>
> > Cc: [email-masked]
> > Date: Sun, 22 Jun 2025 06:38:47 -0800
> > 
> > Eli Zaretskii <[email-masked]> writes:
> > 
> > > Crystal ball says you a version mismatch between the code that calls
> > > Eshell and Eshell itself.  Because eshell-stringify indeed accepted
> > > only 1 argument in Emacs 30, but in Emacs 31 it can accept 2.
> > 
> > Do you see anything in the bug report info that might suggest I am pulling in code from a weird place?
> 
> I don't have enough information to say anything definitive, but the
> backtrace you posted, viz.:
> 
> > Debugger entered--Lisp error: (wrong-number-of-arguments (1 . 1) 2)
> >   eshell-stringify("status" nil)
> >   #f(compiled-function (i) #<bytecode 0x12a893834464da57>)("status")
> >   mapcar(#f(compiled-function (i) #<bytecode 0x12a893834464da57>) ("status"))
> >   eshell-connection-local-command("/home/christopher/.guix-home/profile/bin/git" ("status"))
> >   eshell-external-command("/home/christopher/.guix-home/profile/bin/git" ("status"))
> >   eshell-explicit-command("*git" ("status"))
> 
> clearly shows that some byte-compiled function called from
> eshell-connection-local-command called eshell-stringify with 2
> arguments, something that will only work in Emacs 31.  Whereas your
> bug report says you are running Emacs 30.1.90.

I think this comes from here:

  (defun eshell-connection-local-command (command args)
    "Insert output from an external COMMAND, using ARGS.
  This always runs COMMAND using the connection associated with the
  current working directory."
    (setq args (eshell-stringify-list (flatten-tree args))) <<<<<<<<<<<<

eshell-stringify-list is a defsubst in esh-util.el:

  (defsubst eshell-stringify-list (args &optional quoted)
    "Convert each element of ARGS into a string value."
    (mapcar (lambda (i) (eshell-stringify i quoted)) args))

The above is the version from Emacs 31, which clearly calls
eshell-stringify with 2 arguments.

So my guess is that your Eshell was somehow compiled when loading
esh-util.el brought in the version from Emacs 31, and now esh-ext.elc
(or the corresponding *.eln?) has the wrong definition of
eshell-stringify-list expanded in it.

My suggestion is to recompile all the *.el files under
/home/christopher/local/share/emacs/30.1.90/lisp/eshell/, or maybe
rebuild and reinstall Emacs anew.