Stack overflow in emacs 27 because of preloading emacs-seq

  • Done
  • quality assurance status badge
Details
2 participants
  • Mark H Weaver
  • Pierre Langlois
Owner
unassigned
Submitted by
Pierre Langlois
Severity
normal
P
P
Pierre Langlois wrote on 31 Aug 2020 17:48
(name . Bug guix)(address . bug-guix@gnu.org)
87ft82lsul.fsf@gmx.com
Hello Guix!

Since switching to emacs 27 I've been having issues starting it, seeing
lots of errors like 'Lisp nesting exceeds ‘max-lisp-eval-depth’' when
loading various packages such as magit, ivy, ...etc.

After quite a bit of troubleshooting I reduced it to the `emacs-seq`
package. So if you create an environment with both `emacs-seq` and say
`magit`:

```
$ guix environment --pure --ad-hoc emacs emacs-magit emacs-seq
[env] $ emacs -Q --debug-init --eval "(require 'magit)"
```

Then you get the stack overflow.

Doing some digging, I found this comment from `doom-emacs` that

I'm not familiar with emacs' autoloading, so I'm not sure I understand
what's going on fully. However, it mentions that `emacs-seq` has been
included in emacs proper for a while.

So, what would be the best fix for this? Should we remove `emacs-seq`
entirely or try and patch it? Since we don't support previous versions
of emacs I don't know if we need it.

Thanks,
Pierre
M
M
Mark H Weaver wrote on 31 Aug 2020 22:34
(name . Pierre Langlois)(address . pierre.langlois@gmx.com)(address . 43138@debbugs.gnu.org)
87imcyv9iq.fsf@netris.org
Hi Pierre,

Pierre Langlois <pierre.langlois@gmx.com> writes:

Toggle quote (7 lines)
> [...] However, it mentions that `emacs-seq` has been
> included in emacs proper for a while.
>
> So, what would be the best fix for this? Should we remove `emacs-seq`
> entirely or try and patch it? Since we don't support previous versions
> of emacs I don't know if we need it.

If 'emacs-seq' is included in Emacs 27, it seems to me that we should
just delete it, unless there's something I'm missing.

Thanks for investigating!

Mark
P
P
Pierre Langlois wrote on 31 Aug 2020 23:20
(name . Mark H Weaver)(address . mhw@netris.org)
87imcy5x7y.fsf@gmx.com
Hi Mark,

Mark H Weaver writes:

Toggle quote (14 lines)
> Hi Pierre,
>
> Pierre Langlois <pierre.langlois@gmx.com> writes:
>
>> [...] However, it mentions that `emacs-seq` has been
>> included in emacs proper for a while.
>>
>> So, what would be the best fix for this? Should we remove `emacs-seq`
>> entirely or try and patch it? Since we don't support previous versions
>> of emacs I don't know if we need it.
>
> If 'emacs-seq' is included in Emacs 27, it seems to me that we should
> just delete it, unless there's something I'm missing.

Agreed, I was curious if there was another reason for needing it, since
I /believe/ it's been in emacs proper since 25, but emacs-seq was added
in to guix after that. I suspect it it's still listed as a dependency
for packages, even though it's not actually needed.

Anyways, I've reconfigured my system with the following patch to fix the
issue, let me know if that looks OK! The packages that depended on it
build just fine, although I don't use them directly -- I was pulling
emacs-seq from emacs-org-roam which depends on emacs-biblio, but I'm not
using this feature.

Oh, another thing, I wanted to warn potential users of emacs-seq with a
deprecation warning using (guix deprecation), like:

;; seq.el is included into emacs.
(define-deprecated emacs-seq emacs)

It would be good to do that so somebody isn't tempted to re-add it when
it's listed a dependency. But that triggers errors:

error: emacs: unbound variable
hint: Did you forget a `use-modules' form?

Am I using it wrong? The (gnu packages emacs) module is included of
course.

Thanks,
Pierre
From 1d4fc30d13df916a0800dfcf2f993a1c2a95add8 Mon Sep 17 00:00:00 2001
From: Pierre Langlois <pierre.langlois@gmx.com>
Date: Mon, 31 Aug 2020 17:05:58 +0100
Subject: [PATCH] gnu: Remove emacs-seq package.

It is included with emacs and installing it alongisde emacs 27 causes issues.


* gnu/packages/emacs-xyz.scm (emacs-bugs-hunter)[propagated-inputs]: Remove.
(emacs-erc-status-sidebar)[propagated-inputs]: Remove.
(emacs-psc-ide)[propagated-inputs]: Remove emacs-seq.
(emacs-biblio)[propagated-inputs]: Remove emacs-seq.
(emacs-seq): Delete variable.
(emacs-flycheck-haskell)[propagated-inputs]: Remove emacs-seq.
---
gnu/packages/emacs-xyz.scm | 28 ++--------------------------
1 file changed, 2 insertions(+), 26 deletions(-)

Toggle diff (74 lines)
diff --git a/gnu/packages/emacs-xyz.scm b/gnu/packages/emacs-xyz.scm
index 3036004cee..151718dd6e 100644
--- a/gnu/packages/emacs-xyz.scm
+++ b/gnu/packages/emacs-xyz.scm
@@ -1312,8 +1312,6 @@ regexp-like arguments to @code{skip-chars-forward} and
(base32
"134fj493sdn93pyyac8rpz1fzahzmayvphsrmqp3wvgysmfqm38l"))))
(build-system emacs-build-system)
- (propagated-inputs
- `(("emacs-seq" ,emacs-seq)))
(home-page "https://github.com/Malabarba/elisp-bug-hunter")
(synopsis "Hunt down errors by bisecting elisp files")
(description
@@ -3506,7 +3504,6 @@ IRC bouncer with ERC.")
(sha256
(base32 "1hwlhzgx03z8891sblz56zdp8zj0izh72kxykgcnz5rrkyc3vfi3"))))
(build-system emacs-build-system)
- (propagated-inputs `(("emacs-seq" ,emacs-seq)))
(home-page "https://github.com/drewbarbs/erc-status-sidebar")
(synopsis "Hexchat-like activity overview for ERC channels")
(description
@@ -13560,8 +13557,7 @@ and can be consulted and modified.")
("emacs-dash" ,emacs-dash)
("emacs-flycheck" ,emacs-flycheck)
("emacs-let-alist" ,emacs-let-alist)
- ("emacs-s" ,emacs-s)
- ("emacs-seq" ,emacs-seq)))
+ ("emacs-s" ,emacs-s)))
(home-page "https://github.com/purescript-emacs/psc-ide-emacs")
(synopsis "Emacs integration for PureScript's psc-ide tool")
(description
@@ -14321,8 +14317,7 @@ with (La)TeX mode, Org mode and other Emacs editing modes.")
(base32 "1gxjind6r235az59dr8liv03d8994mqb8a7m28j3c12q7p70aziz"))))
(build-system emacs-build-system)
(propagated-inputs
- `(("emacs-seq" ,emacs-seq)
- ("emacs-dash" ,emacs-dash)
+ `(("emacs-dash" ,emacs-dash)
("emacs-let-alist" ,emacs-let-alist)))
(home-page "https://github.com/cpitclaudel/biblio.el")
(synopsis "Browse and import bibliographic references")
@@ -14730,24 +14725,6 @@ timestamps and date-time format strings library for Emacs.")
"@code{npm-mode} provides a minor mode to work with @code{npm} projects.")
(license license:gpl3+)))

-(define-public emacs-seq
- (package
- (name "emacs-seq")
- (version "2.20")
- (source
- (origin
- (method url-fetch)
- (uri (string-append "https://elpa.gnu.org/packages/seq-" version ".tar"))
- (sha256
- (base32
- "0vrpx6nnyjb0gsypknzagimlhvcvi5y1rcdkpxyqr42415zr8d0n"))))
- (build-system emacs-build-system)
- (home-page "https://elpa.gnu.org/packages/seq.html")
- (synopsis "Sequence manipulation functions")
- (description "Sequence-manipulation functions that complement basic
-functions provided by @file{subr.el}.")
- (license license:gpl3+)))
-
(define-public emacs-itail
(let ((commit "6e43c20da03be3b9c6ece93b7dc3495975ec1888")
(revision "1"))
@@ -20448,7 +20425,6 @@ unescaping of quotes.")
(build-system emacs-build-system)
(propagated-inputs
`(("emacs-dash" ,emacs-dash)
- ("emacs-seq" ,emacs-seq)
("emacs-flycheck" ,emacs-flycheck)
("emacs-haskell-mode" ,emacs-haskell-mode)
("emacs-let-alist" ,emacs-let-alist)))
--
2.28.0
P
P
Pierre Langlois wrote on 4 Sep 2020 13:30
(name . Mark H Weaver)(address . mhw@netris.org)
87mu25srrm.fsf@gmx.com
Hi Mark,

Replying with the bug on CC, I didn't realise your last email didn't
include it. I assume that was a mistake?

Mark H Weaver writes:

Toggle quote (32 lines)
> Hi Pierre,
>
> Pierre Langlois <pierre.langlois@gmx.com> writes:
>
>> Mark H Weaver writes:
>>
>>> If 'emacs-seq' is included in Emacs 27, it seems to me that we should
>>> just delete it, unless there's something I'm missing.
>>
>> Agreed, I was curious if there was another reason for needing it, since
>> I /believe/ it's been in emacs proper since 25, but emacs-seq was added
>> in to guix after that. I suspect it it's still listed as a dependency
>> for packages, even though it's not actually needed.
>
> It might be that the copy of 'emacs-seq' in Emacs 26 was relatively old,
> and that some users and other emacs packages wanted a newer version. I
> guess that's the rationale for 'emacs-org', and I vaguely recall that we
> might have had an updated Gnus package in the past as well, for the same
> reason.
>
> Hopefully the version of 'emacs-seq' bundled with Emacs 27 is now
> sufficiently up-to-date.
>
>> Anyways, I've reconfigured my system with the following patch to fix the
>> issue, let me know if that looks OK!
>
> Except for a minor typo in the commit log "alongisde", looks good to me.
>
> Thank you! I think you should go ahead and push it to 'master', since
> things are currently broken and this is certainly an improvement. If
> there are remaining issues, they can be addressed in future commits.

OK, pushed to master with 852ae64e11ef9107afabbdb307770f946376addd ,
I'll close the bug as well, I suppose we can open new ones in case
problems arise later.

Toggle quote (32 lines)
>
>> Oh, another thing, I wanted to warn potential users of emacs-seq with a
>> deprecation warning using (guix deprecation), like:
>>
>> ;; seq.el is included into emacs.
>> (define-deprecated emacs-seq emacs)
>
> It's a good thought, but I'm not sure if 'define-deprecated' is the
> right thing here. This might be a question for Ludovic.
>
>> It would be good to do that so somebody isn't tempted to re-add it when
>> it's listed a dependency. But that triggers errors:
>>
>> error: emacs: unbound variable
>> hint: Did you forget a `use-modules' form?
>>
>> Am I using it wrong? The (gnu packages emacs) module is included of
>> course.
>
> I guess that this is most likely caused by a cyclic dependency between
> the (gnu packages emacs) and (gnu packages emacs-xyz) modules. When
> there's a cyclic dependency between modules, Guile cannot ensure that
> the definitions of imported modules are evaluated first.
>
> In this case, I guess that (define-deprecated emacs-seq emacs) is
> evaluated before the definition of 'emacs' is evaluated, and that it
> fails to cope with that.
>
> I wish that we didn't have any cyclic module dependencies, but at this
> point it would require a *major* reorganization of our package modules
> to avoid it.

Ouch, yeah that seems like the problem, I'll see if I can get it to work
as a follow-up, but it seems not really worth the effort :-).

Thanks!
Pierre
-----BEGIN PGP SIGNATURE-----

iQEzBAEBCgAdFiEEctU9gYy29KFyWDdMqPyeRH9PfVQFAl9SJW0ACgkQqPyeRH9P
fVQWxgf8DTfelZPoOewJJlu110Gmf2kgbRMDaAfJUfpdDIYS1zFzlH3Bb09/m8L8
VVlEqluYA14wa4Y/kfdDYzNKxxB3xoa04EsVv3dsgS7wjYkCWQGh1rmOJIJ9cItv
NcB016og5WN35JS72TUaWwpyepte1xPDT8l/HOOnjFAOwnw00Oryr93UYClBHna1
jigNXSIEdz1sX3nt/RfEF9La6VSu3r74plYQ+nnOt5Ei+fjceUzLZZOrbFOl5YMw
NV8LuLsPzroAmWtkqPDZppPoVXOhpyos1+S5hxKwAaY5DrWAxB4JPijyfNyAti8v
inxr2jOLFQC629bgqSm75O7DG8WVRg==
=RQZH
-----END PGP SIGNATURE-----

Closed
M
M
Mark H Weaver wrote on 1 Sep 2020 00:51
(name . Pierre Langlois)(address . pierre.langlois@gmx.com)
871rjmv37n.fsf@netris.org
Hi Pierre,

Pierre Langlois <pierre.langlois@gmx.com> writes:

Toggle quote (10 lines)
> Mark H Weaver writes:
>
>> If 'emacs-seq' is included in Emacs 27, it seems to me that we should
>> just delete it, unless there's something I'm missing.
>
> Agreed, I was curious if there was another reason for needing it, since
> I /believe/ it's been in emacs proper since 25, but emacs-seq was added
> in to guix after that. I suspect it it's still listed as a dependency
> for packages, even though it's not actually needed.

It might be that the copy of 'emacs-seq' in Emacs 26 was relatively old,
and that some users and other emacs packages wanted a newer version. I
guess that's the rationale for 'emacs-org', and I vaguely recall that we
might have had an updated Gnus package in the past as well, for the same
reason.

Hopefully the version of 'emacs-seq' bundled with Emacs 27 is now
sufficiently up-to-date.

Toggle quote (3 lines)
> Anyways, I've reconfigured my system with the following patch to fix the
> issue, let me know if that looks OK!

Except for a minor typo in the commit log "alongisde", looks good to me.

Thank you! I think you should go ahead and push it to 'master', since
things are currently broken and this is certainly an improvement. If
there are remaining issues, they can be addressed in future commits.

Toggle quote (6 lines)
> Oh, another thing, I wanted to warn potential users of emacs-seq with a
> deprecation warning using (guix deprecation), like:
>
> ;; seq.el is included into emacs.
> (define-deprecated emacs-seq emacs)

It's a good thought, but I'm not sure if 'define-deprecated' is the
right thing here. This might be a question for Ludovic.

Toggle quote (9 lines)
> It would be good to do that so somebody isn't tempted to re-add it when
> it's listed a dependency. But that triggers errors:
>
> error: emacs: unbound variable
> hint: Did you forget a `use-modules' form?
>
> Am I using it wrong? The (gnu packages emacs) module is included of
> course.

I guess that this is most likely caused by a cyclic dependency between
the (gnu packages emacs) and (gnu packages emacs-xyz) modules. When
there's a cyclic dependency between modules, Guile cannot ensure that
the definitions of imported modules are evaluated first.

In this case, I guess that (define-deprecated emacs-seq emacs) is
evaluated before the definition of 'emacs' is evaluated, and that it
fails to cope with that.

I wish that we didn't have any cyclic module dependencies, but at this
point it would require a *major* reorganization of our package modules
to avoid it.

Thanks,
Mark
M
M
Mark H Weaver wrote on 4 Sep 2020 15:23
(name . Pierre Langlois)(address . pierre.langlois@gmx.com)(address . 43138@debbugs.gnu.org)
877dt9smja.fsf@netris.org
Pierre Langlois <pierre.langlois@gmx.com> writes:
Toggle quote (3 lines)
> Replying with the bug on CC, I didn't realise your last email didn't
> include it. I assume that was a mistake?

Indeed, my mistake. I just resent my previous email to complete the
record for this bug.

Toggle quote (4 lines)
> OK, pushed to master with 852ae64e11ef9107afabbdb307770f946376addd ,
> I'll close the bug as well, I suppose we can open new ones in case
> problems arise later.

Sounds good. Thanks for taking care of this, Pierre!

Mark
?