Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"Caches are still outdated; something is seriously wrong" #437

Closed
ieure opened this issue Nov 21, 2019 · 13 comments
Closed

"Caches are still outdated; something is seriously wrong" #437

ieure opened this issue Nov 21, 2019 · 13 comments

Comments

@ieure
Copy link

ieure commented Nov 21, 2019

What's wrong

When I run straight-freeze-versions, I get prompted:

Caches are outdated, reload init-file? (y or n)

No matter if I answer y or n, I always get the error:

straight--ensure-profile-cache-valid: Caches are still outdated; something is seriously wrong

Directions to reproduce

  1. Start Emacs.
  2. Wait a while. It never happens on a fresh start of Emacs. This might happen after I edit a file or pull changes to a repo in in ~/.emacs.d/straight/repos, but I'm not 100% sure.
  3. Run M-x straight-freeze-versions.

Version information

  • Emacs version:

    GNU Emacs 26.1 (build 1, x86_64-pc-linux-gnu, X toolkit, Xaw3d scroll bars)

  • Operating system:

    Debian 10.2 "Buster"

@dericbytes
Copy link

I got the same problem. But I restarted emacs and ran again and it worked.

Any way to solve this without a restart.

Emacs: 28.0.50
Straight: Sun Aug 30 06:31:29 2020
Ubuntu: 18.04 4 LTS

@ieure
Copy link
Author

ieure commented Sep 5, 2020

Yep, it still happens for me. Always works on a clean start, never works on a session that's been running a while.

@raxod502
Copy link
Member

Is it possible that under some circumstances, loading your user-init-file will not result in the straight.el bootstrap getting run again? That would cause this behavior if you had interactively invoked straight-use-package between Emacs startup and running straight-freeze-versions.

@raxod502
Copy link
Member

Also, you can work around the bug by saying "no" when it asks to reload your init-file the first time, right?

@ieure
Copy link
Author

ieure commented Sep 19, 2020

Also, you can work around the bug by saying "no" when it asks to reload your init-file the first time, right?

No, the error happens no matter what I answer. The only workaround is to restart Emacs.

Is it possible that under some circumstances, loading your user-init-file will not result in the straight.el bootstrap getting run again?

Yes. My configuration is large, so I broke it out into separate files which get REQUIREd by init.el. Straight's bootstrap code is inside one of those files, so it wouldn't get evaluated again if the init file was reloaded.

That would cause this behavior if you had interactively invoked straight-use-package between Emacs startup and running straight-freeze-versions.

Possible, I have long-lived sessions and sometimes try out one thing or another.

@raxod502
Copy link
Member

the error happens no matter what I answer. The only workaround is to restart Emacs.

Based on the implementation of straight--ensure-profile-cache-valid, this seems impossible to me:

https://github.com/raxod502/straight.el/blob/d27ad625838a679e0184ddf327bfea62760ae2fe/straight.el#L5494-L5506

I have been surprised many times before, however. Would you mind double-checking, just to be sure that something inexplicable is happening?

Straight's bootstrap code is inside one of those files, so it wouldn't get evaluated again if the init file was reloaded.

Well, that's the problem. You need to change this for your configuration to be compatible with straight.el. I will update the documentation to be clear on this.

@ieure
Copy link
Author

ieure commented Sep 20, 2020

the error happens no matter what I answer. The only workaround is to restart Emacs.

Based on the implementation of straight--ensure-profile-cache-valid, this seems impossible to me:

I have been surprised many times before, however. Would you mind double-checking, just to be sure that something inexplicable is happening?

I'm not able to reproduce this now, perhaps it changed since I filed the original bug. It definitely was happening at that time.

Straight's bootstrap code is inside one of those files, so it wouldn't get evaluated again if the init file was reloaded.

Well, that's the problem. You need to change this for your configuration to be compatible with straight.el. I will update the documentation to be clear on this.

Is it sufficient to put only the bootstrap code in there (this stuff), or does straight expect every STRAIGHT-USE-PACKAGE to be reevaluated when the init file is reloaded?

@raxod502
Copy link
Member

does straight expect every STRAIGHT-USE-PACKAGE to be reevaluated when the init file is reloaded?

It expects every form to be re-evaluated. The reason for this is that otherwise there would be no way to identify which straight-use-package calls were part of your init-file, and which were part of random interactive experiments. straight.el tracks what happens in the course of loading your init-file, but if straight-use-package calls happen after init time, it needs to eval your init-file again to see what happens and if anything has changed, otherwise it would just be guesswork about what should be written into the lockfile.

@ieure
Copy link
Author

ieure commented Sep 21, 2020

does straight expect every STRAIGHT-USE-PACKAGE to be reevaluated when the init file is reloaded?

It expects every form to be re-evaluated. The reason for this is that otherwise there would be no way to identify which straight-use-package calls were part of your init-file, and which were part of random interactive experiments. straight.el tracks what happens in the course of loading your init-file, but if straight-use-package calls happen after init time, it needs to eval your init-file again to see what happens and if anything has changed, otherwise it would just be guesswork about what should be written into the lockfile.

That's unfortunate; my config is >4KLOC and I'm not jazzed about changing it, so I'm either going to have to live with the issue or abandon straight.

Instead of reloading the whole init file, what do you think about one or the other of:

  • Using called-interactively-p, or
  • Having a separate command (like straight-try-package) for the case where you want to demo a package without committing?

@raxod502
Copy link
Member

Unfortunately, both of your suggestions rely on the user remembering things. In my experience, this will never happen in the real world. As a concrete problem, my workflow for adding packages to my configuration is to write the (straight-use-package ...) form first, and then evaluate it with C-M-x. That would bypass both of your proposed checks.

I have to say, I'm not sure I understand why the config updates would be a burden. For example, you could just add a snippet of code at the top of your init-file to remove all your config's features from the features list. Then you can keep using require and it will work with straight.el.

@raxod502
Copy link
Member

This thread is being closed automatically by Tidier because it is labeled with "waiting on response" and has not seen any activity for 90 days. But don't worry—if you have any information that might advance the discussion, leave a comment and I will be happy to reopen the thread :)

@hrehfeld
Copy link

hrehfeld commented Feb 10, 2024

Is (use-package foo :straight foo) enough to trigger the reload? I was under the impression that use-package only requires on the second call?

@raxod502
Copy link
Member

Can you be more specific about what you mean by "the reload"?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

4 participants