Emacs fails to start with "List contains a loop" error

  • Open
  • quality assurance status badge
Details
7 participants
  • Alexandre Hannud Abdo
  • Thiago Jung Bauermann
  • Jakob Honal
  • James Smith
  • Liliana Marie Prikler
  • Ludovic Courtès
  • Rostislav Svoboda
Owner
unassigned
Submitted by
Thiago Jung Bauermann
Severity
important
Merged with
T
T
Thiago Jung Bauermann wrote on 20 Jan 23:43 +0100
(address . bug-guix@gnu.org)
867c6p5cp7.fsf@kolabnow.com
Since a recent "guix pull", Emacs (I tested with the emacs-pgtk package)
can't start up anymore:

$ emacs
List contains a loop: ("/home/user/.guix-profile/lib/emacs/native-site-lisp" "/gnu/store/k62mmzkbmivw2r3wwlpcxs3lp9vwjyac-emacs-lsp-mode-9.0.0/lib/emacs/native-site-lisp" "/home/user/.guix-profile/lib/emacs/native-site-lisp" "/home/user/.guix-profile/lib/emacs/native-site-lisp" "/gnu/store/k62mmzkbmivw2r3wwlpcxs3lp9vwjyac-emacs-lsp-mode-9.0.0/lib/emacs/native-site-lisp" . #2)
$ echo $?
255

The root cause of the problem is that I have duplicate path entries in
these environment variables:

$ env | grep EMACS
EMACSNATIVELOADPATH=/home/sademeo/.guix-profile/lib/emacs/native-site-lisp:/home/sademeo/.guix-profile/lib/emacs/native-site-lisp
EMACSLOADPATH=/home/sademeo/.guix-profile/share/emacs/site-lisp:/home/sademeo/.guix-profile/share/emacs/site-lisp

If I remove the duplicate entries, Emacs starts correctly again.

I suppose this is a common problem (it's surprisingly hard to ensure a
given shell initialization snippet will run only once), and also it's
hardly a fatal or unrecoverable error. IMHO it should warrant at most a
warning message (if that), not a complete abort of the program.

With that in mind, I bisected Guix and arrived at this commit:

e9b13294700de7082ee23aa6e1c17b4a8c8828ec is the first bad commit
commit e9b13294700de7082ee23aa6e1c17b4a8c8828ec

profiles: emacs-subdirs: Also expand native-comp-eln-load-path.

To reproduce the problem, it's enough to install emacs-pgtk and
emacs-ccls in your profile. It might be necessary to remove them and
then install them again, not sure why.

Guix version:

$ guix describe
Generation 17 jan 20 2025 18:48:17 (current)
guix e9b1329
commit: e9b13294700de7082ee23aa6e1c17b4a8c8828ec

It's probably irrelevant, but just for completeness: Guix is installed
on top of Ubuntu 24.10.

--
Thiago
J
J
James Smith wrote on 21 Jan 02:37 +0100
(name . Thiago Jung Bauermann via Bug reports for GNU Guix)(address . bug-guix@gnu.org)
86a5bl54md.fsf@disroot.org
Hi,

Thiago Jung Bauermann via Bug reports for GNU Guix <bug-guix@gnu.org> writes:

Toggle quote (44 lines)
> Since a recent "guix pull", Emacs (I tested with the emacs-pgtk package)
> can't start up anymore:
>
> $ emacs
> List contains a loop: ("/home/user/.guix-profile/lib/emacs/native-site-lisp" "/gnu/store/k62mmzkbmivw2r3wwlpcxs3lp9vwjyac-emacs-lsp-mode-9.0.0/lib/emacs/native-site-lisp" "/home/user/.guix-profile/lib/emacs/native-site-lisp" "/home/user/.guix-profile/lib/emacs/native-site-lisp" "/gnu/store/k62mmzkbmivw2r3wwlpcxs3lp9vwjyac-emacs-lsp-mode-9.0.0/lib/emacs/native-site-lisp" . #2)
> $ echo $?
> 255
>
> The root cause of the problem is that I have duplicate path entries in
> these environment variables:
>
> $ env | grep EMACS
> EMACSNATIVELOADPATH=/home/sademeo/.guix-profile/lib/emacs/native-site-lisp:/home/sademeo/.guix-profile/lib/emacs/native-site-lisp
> EMACSLOADPATH=/home/sademeo/.guix-profile/share/emacs/site-lisp:/home/sademeo/.guix-profile/share/emacs/site-lisp
>
> If I remove the duplicate entries, Emacs starts correctly again.
>
> I suppose this is a common problem (it's surprisingly hard to ensure a
> given shell initialization snippet will run only once), and also it's
> hardly a fatal or unrecoverable error. IMHO it should warrant at most a
> warning message (if that), not a complete abort of the program.
>
> With that in mind, I bisected Guix and arrived at this commit:
>
> e9b13294700de7082ee23aa6e1c17b4a8c8828ec is the first bad commit
> commit e9b13294700de7082ee23aa6e1c17b4a8c8828ec
>
> profiles: emacs-subdirs: Also expand native-comp-eln-load-path.
>
> To reproduce the problem, it's enough to install emacs-pgtk and
> emacs-ccls in your profile. It might be necessary to remove them and
> then install them again, not sure why.
>
> Guix version:
>
> $ guix describe
> Generation 17 jan 20 2025 18:48:17 (current)
> guix e9b1329
> repository URL: https://git.savannah.gnu.org/git/guix.git
> commit: e9b13294700de7082ee23aa6e1c17b4a8c8828ec
>
> It's probably irrelevant, but just for completeness: Guix is installed
> on top of Ubuntu 24.10.

I've encountered the same issue on Guix System, and found that only
duplicate paths in $EMACSNATIVELOADPATH causes this ($EMACSLOADPATH
doesn't seem to be causing any issues).

Here's the relevant variables on my system:
#+begin_src bash
EMACSNATIVELOADPATH=/home/ubuntuxp/.guix-profile/lib/emacs/native-site-lisp:/home/ubuntuxp/.guix-profile/lib/emacs/native-site-lisp:/home/ubuntuxp/.guix-profile/lib/emacs/native-site-lisp
EMACSLOADPATH=/home/ubuntuxp/.guix-profile/share/emacs/site-lisp:/home/ubuntuxp/.guix-profile/share/emacs/site-lisp:/home/ubuntuxp/.guix-profile/share/emacs/site-lisp
#+end_src

James Smith
L
L
Liliana Marie Prikler wrote on 22 Jan 19:19 +0100
Re: Emacs fails to start with "List contains a loop" error
d0eea0518ae95d733a04a8904a6dd86d944f3287.camel@gmail.com
Hi Thiago

Am Montag, dem 20.01.2025 um 19:43 -0300 schrieb Thiago Jung Bauermann:
Toggle quote (30 lines)
>
> Since a recent "guix pull", Emacs (I tested with the emacs-pgtk
> package)
> can't start up anymore:
>
> $ emacs
> List contains a loop: ("/home/user/.guix-profile/lib/emacs/native-
> site-lisp" "/gnu/store/k62mmzkbmivw2r3wwlpcxs3lp9vwjyac-emacs-lsp-
> mode-9.0.0/lib/emacs/native-site-lisp" "/home/user/.guix-
> profile/lib/emacs/native-site-lisp" "/home/user/.guix-
> profile/lib/emacs/native-site-lisp"
> "/gnu/store/k62mmzkbmivw2r3wwlpcxs3lp9vwjyac-emacs-lsp-mode-
> 9.0.0/lib/emacs/native-site-lisp" . #2)
> $ echo $?
> 255
>
> The root cause of the problem is that I have duplicate path entries
> in these environment variables:
>
> $ env | grep EMACS
> EMACSNATIVELOADPATH=/home/sademeo/.guix-profile/lib/emacs/native-
> site-lisp:/home/sademeo/.guix-profile/lib/emacs/native-site-lisp
> EMACSLOADPATH=/home/sademeo/.guix-profile/share/emacs/site-
> lisp:/home/sademeo/.guix-profile/share/emacs/site-lisp
>
> If I remove the duplicate entries, Emacs starts correctly again.
>
> I suppose this is a common problem (it's surprisingly hard to ensure
> a given shell initialization snippet will run only once), and also
> it's hardly a fatal or unrecoverable error. 
You quite likely have redundant code in your shell init scripts. Note
that your Guix profile should already be sourced on Guix System without
adding anything to them.

Toggle quote (9 lines)
> IMHO it should warrant at most a warning message (if that), not a
> complete abort of the program.
>
> With that in mind, I bisected Guix and arrived at this commit:
>
> e9b13294700de7082ee23aa6e1c17b4a8c8828ec is the first bad commit
> commit e9b13294700de7082ee23aa6e1c17b4a8c8828ec
> […]

Try replacing nconc with append and see whether it fixes your issue.
You can reproduce this more easily with

$ guix shell emacs-pgtk emacs-dash \
--with-input=emacs-minimal=emacs-pgtk -- \
sh -c 'source $GUIX_ENVIRONMENT/etc/profile && emacs'

Cheers
A
A
Alexandre Hannud Abdo wrote on 23 Jan 00:01 +0100
also with guix home
(address . 75709@debbugs.gnu.org)
2580af52-c4fc-4c66-a4ef-b7266c10da2e@member.fsf.org
Ni! Hi everyone.

Having the same issue here.

I'm using `emacs-pgtk` with Guix Home on Guix System, so it's Guix (Home) itself is producing all my profile variables and shell init scripts.

My home configuration is very plain and doesn't touch shell init in any relevant way. Here's the bash-config part:

```
(home-bash-configuration
                   (aliases '(("ema" . "emacs -nw")
                              ("emc" . "emacsclient -nw")))
                   (environment-variables '(("EDITOR" . "emacs"))))
```

And here's my EMACS vars after starting a fresh session:

```
$ env | grep EMACS
EMACSNATIVELOADPATH=/home/user/.guix-home/profile/lib/emacs/native-site-lisp:/home/user/.guix-home/profile/lib/emacs/native-site-lisp
EMACSLOADPATH=/home/user/.guix-home/profile/share/emacs/site-lisp:/home/user/.guix-home/profile/share/emacs/site-lisp
```

And just in case, here are the list of 'emacs-' packages in my home profile:

```
"emacs-atomic-chrome"
"emacs-company"
"emacs-geiser"
"emacs-geiser-guile"
"emacs-guix"
"emacs-ibuffer-vc"
"emacs-magit"
"emacs-marginalia"
"emacs-markdown-mode"
"emacs-nov-el"
"emacs-olivetti"
"emacs-paredit"
"emacs-pgtk"
"emacs-python-black"
"emacs-undo-tree"
"emacs-yaml-mode"
"emacs-yasnippet"
"emacs-yasnippet-snippets"
```

Does this help spot something? What can I do to help?

ale

.~´
T
T
Thiago Jung Bauermann wrote on 23 Jan 04:07 +0100
Re: Emacs fails to start with "List contains a loop" error
(name . Liliana Marie Prikler)(address . liliana.prikler@gmail.com)
86h65qfcsd.fsf@kolabnow.com
Hello Liliana,

Liliana Marie Prikler <liliana.prikler@gmail.com> writes:

Toggle quote (21 lines)
> Am Montag, dem 20.01.2025 um 19:43 -0300 schrieb Thiago Jung Bauermann:
>>
>> The root cause of the problem is that I have duplicate path entries
>> in these environment variables:
>>
>> $ env | grep EMACS
>> EMACSNATIVELOADPATH=/home/sademeo/.guix-profile/lib/emacs/native-
>> site-lisp:/home/sademeo/.guix-profile/lib/emacs/native-site-lisp
>> EMACSLOADPATH=/home/sademeo/.guix-profile/share/emacs/site-
>> lisp:/home/sademeo/.guix-profile/share/emacs/site-lisp
>>
>> If I remove the duplicate entries, Emacs starts correctly again.
>>
>> I suppose this is a common problem (it's surprisingly hard to ensure
>> a given shell initialization snippet will run only once), and also
>> it's hardly a fatal or unrecoverable error. 
>
> You quite likely have redundant code in your shell init scripts. Note
> that your Guix profile should already be sourced on Guix System without
> adding anything to them.

Yes, after I opened the bug I dug a bit and found that I had two
slightly different copies of guix.sh in /etc/profile.d/, one of which
forgotten there from some old experimentation. After I removed it, the
EMACS environment variables above were correct again.

Toggle quote (11 lines)
>> IMHO it should warrant at most a warning message (if that), not a
>> complete abort of the program.
>>
>> With that in mind, I bisected Guix and arrived at this commit:
>>
>> e9b13294700de7082ee23aa6e1c17b4a8c8828ec is the first bad commit
>> commit e9b13294700de7082ee23aa6e1c17b4a8c8828ec
>> […]
>
> Try replacing nconc with append and see whether it fixes your issue.

Yes, it does fix it. Thanks!

Toggle quote (6 lines)
> You can reproduce this more easily with
>
> $ guix shell emacs-pgtk emacs-dash \
> --with-input=emacs-minimal=emacs-pgtk -- \
> sh -c 'source $GUIX_ENVIRONMENT/etc/profile && emacs'

Thank you for providing this command. Indeed it made checking the fix
easier.

--
Thiago
T
T
Thiago Jung Bauermann wrote on 23 Jan 17:23 +0100
Re: bug#75709: also with guix home
(name . Alexandre Hannud Abdo)(address . abdo@member.fsf.org)(address . 75709@debbugs.gnu.org)
86ldv1zegm.fsf@kolabnow.com
Hello Alexandre,

Alexandre Hannud Abdo <abdo@member.fsf.org> writes:

Toggle quote (15 lines)
> Having the same issue here.
>
> I'm using `emacs-pgtk` with Guix Home on Guix System, so it's Guix (Home) itself is
> producing all my profile variables and shell init scripts.
>
> My home configuration is very plain and doesn't touch shell init in any relevant
> way. Here's the bash-config part:
>
> ```
> (home-bash-configuration
>                    (aliases '(("ema" . "emacs -nw")
>                               ("emc" . "emacsclient -nw")))
>                    (environment-variables '(("EDITOR" . "emacs"))))
> ```

I don't use Guix System nor Guix Home, so it's unwise for me to
speculate. But I'll do it anyway. :)

Perhaps you have Emacs packages installed in both the system configuration
and the home configuration? Perhaps that could be causing the
environment variable to be set at two different places?

In any case, there does seem to be some issue with Guix System or Guix Home.

Toggle quote (25 lines)
> And just in case, here are the list of 'emacs-' packages in my home profile:
>
> ```
> "emacs-atomic-chrome"
> "emacs-company"
> "emacs-geiser"
> "emacs-geiser-guile"
> "emacs-guix"
> "emacs-ibuffer-vc"
> "emacs-magit"
> "emacs-marginalia"
> "emacs-markdown-mode"
> "emacs-nov-el"
> "emacs-olivetti"
> "emacs-paredit"
> "emacs-pgtk"
> "emacs-python-black"
> "emacs-undo-tree"
> "emacs-yaml-mode"
> "emacs-yasnippet"
> "emacs-yasnippet-snippets"
> ```
>
> Does this help spot something? What can I do to help?

The issue in the Emacs package was already spotted by Liliana, but to
spot what could be the problem with Guix System / Guix Home, the best
option is to give enough information so that someone else can reproduce
the problem you're seeing.

That would be either your full system and home configurations (if you
are comfortable providing them), or (even better) a trimmed down version
of the system and home ocnfigurations that still reproduce the problem.

--
Thiago
R
R
Rostislav Svoboda wrote on 23 Jan 17:53 +0100
Re: Emacs fails to start with "List contains a loop" error
(address . 75709@debbugs.gnu.org)
CAEtmmezPh20F=f+GcEnOnvzsMcth2HCNyy0wf1P4b6AS3vHk+g@mail.gmail.com
Toggle quote (2 lines)
> You quite likely have redundant code in your shell init scripts.

Or your terminal is configured to run as a login shell. E.g. for
xfce4-terminal see:
Edit > Preferences > Advanced -> "Run command as login shell."

Cheers, Bost
J
J
Jakob Honal wrote on 23 Jan 18:27 +0100
hello there :)
(address . 75709@debbugs.gnu.org)
trinity-b8e78177-84e1-43c0-9fcf-5b16d666a943-1737653231282@trinity-msg-rest-gmx-gmx-live-bbc95d94c-s8f5s
Hello everyone,

I have the same problem here.
'unset EMACSNATIVELOADPATH' is a usable (but dirty) workaround for me
I'm running guix home on arch because I don't have the time to package t2-linux for guix right now.
In case it helps, you can find the complete configuration for the system here:
L
L
Liliana Marie Prikler wrote on 23 Jan 22:51 +0100
Re: Emacs fails to start with "List contains a loop" error
(name . Thiago Jung Bauermann)(address . bauermann@kolabnow.com)
f1791f966e8357f2ff1fe49214d5f7c788ad00d3.camel@gmail.com
Am Donnerstag, dem 23.01.2025 um 00:07 -0300 schrieb Thiago Jung
Bauermann:
Toggle quote (6 lines)
> […]
> >
> > Try replacing nconc with append and see whether it fixes your
> > issue.
>
> Yes, it does fix it. Thanks!
Would you like to submit this as a patch, then? :)

Cheers
A
A
Alexandre Hannud Abdo wrote on 24 Jan 01:13 +0100
Re: bug#75709: also with guix home
(name . Thiago Jung Bauermann)(address . bauermann@kolabnow.com)(address . 75709@debbugs.gnu.org)
8bbb8680-371b-404c-9642-65200fa1a9b0@member.fsf.org
Ni! Thanks for your comments, Thiago. Emacs is not installed by my system config. And as I said my sisem is very plain and any details I haven't provided are unrelated to emacs. .~´

Le 23/01/2025 à 17:23, Thiago Jung Bauermann a écrit :
Toggle quote (62 lines)
> Hello Alexandre,
>
> Alexandre Hannud Abdo <abdo@member.fsf.org> writes:
>
>> Having the same issue here.
>>
>> I'm using `emacs-pgtk` with Guix Home on Guix System, so it's Guix (Home) itself is
>> producing all my profile variables and shell init scripts.
>>
>> My home configuration is very plain and doesn't touch shell init in any relevant
>> way. Here's the bash-config part:
>>
>> ```
>> (home-bash-configuration
>>                    (aliases '(("ema" . "emacs -nw")
>>                               ("emc" . "emacsclient -nw")))
>>                    (environment-variables '(("EDITOR" . "emacs"))))
>> ```
> I don't use Guix System nor Guix Home, so it's unwise for me to
> speculate. But I'll do it anyway. :)
>
> Perhaps you have Emacs packages installed in both the system configuration
> and the home configuration? Perhaps that could be causing the
> environment variable to be set at two different places?
>
> In any case, there does seem to be some issue with Guix System or Guix Home.
>
>> And just in case, here are the list of 'emacs-' packages in my home profile:
>>
>> ```
>> "emacs-atomic-chrome"
>> "emacs-company"
>> "emacs-geiser"
>> "emacs-geiser-guile"
>> "emacs-guix"
>> "emacs-ibuffer-vc"
>> "emacs-magit"
>> "emacs-marginalia"
>> "emacs-markdown-mode"
>> "emacs-nov-el"
>> "emacs-olivetti"
>> "emacs-paredit"
>> "emacs-pgtk"
>> "emacs-python-black"
>> "emacs-undo-tree"
>> "emacs-yaml-mode"
>> "emacs-yasnippet"
>> "emacs-yasnippet-snippets"
>> ```
>>
>> Does this help spot something? What can I do to help?
> The issue in the Emacs package was already spotted by Liliana, but to
> spot what could be the problem with Guix System / Guix Home, the best
> option is to give enough information so that someone else can reproduce
> the problem you're seeing.
>
> That would be either your full system and home configurations (if you
> are comfortable providing them), or (even better) a trimmed down version
> of the system and home ocnfigurations that still reproduce the problem.
>
> --
> Thiago
T
T
Thiago Jung Bauermann wrote 7 days ago
Re: Emacs fails to start with "List contains a loop" error
(name . Liliana Marie Prikler)(address . liliana.prikler@gmail.com)
86ed0rn709.fsf@kolabnow.com
Liliana Marie Prikler <liliana.prikler@gmail.com> writes:

Toggle quote (10 lines)
> Am Donnerstag, dem 23.01.2025 um 00:07 -0300 schrieb Thiago Jung
> Bauermann:
>> […]
>> >
>> > Try replacing nconc with append and see whether it fixes your
>> > issue.
>>
>> Yes, it does fix it. Thanks!
> Would you like to submit this as a patch, then? :)

Ah! I didn't think that would be appropriate since it's your fix, but
since you suggested it, I just did:


--
Thiago
L
L
Ludovic Courtès wrote 4 days ago
control message for bug #75709
(address . control@debbugs.gnu.org)
87ikq0ps74.fsf@gnu.org
merge 75709 75749
quit
L
L
Ludovic Courtès wrote 4 days ago
(address . control@debbugs.gnu.org)
87cyg8ps0n.fsf@gnu.org
severity 75709 important
quit
?
Your comment

Commenting via the web interface is currently disabled.

To comment on this conversation send an email to 75709@debbugs.gnu.org

To respond to this issue using the mumi CLI, first switch to it
mumi current 75709
Then, you may apply the latest patchset in this issue (with sign off)
mumi am -- -s
Or, compose a reply to this issue
mumi compose
Or, send patches to this issue
mumi send-email *.patch