-
Notifications
You must be signed in to change notification settings - Fork 151
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
Killing Emacs while straight.el is cloning and buildng packages can leave things in a bad state? #1134
Comments
I think what you ran into is the result of the way Lines 2625 to 2630 in b3760f5
The repository is written to disk by Emacs, then initialized by git. When Emacs is killed via SIGINT, its subprocesses are sent SIGHUP (which Git should handle gracefully on its own. In this case, the directory would not be present): https://www.gnu.org/software/emacs/manual/html_node/elisp/Signals-to-Processes.html
The signals we're interested in can be handled during |
Reasonable enough. Of course, it is impossible to make any atomic guarantee about cloning since a system may halt at any time. It may be better to clone to a temporary directory (say, the repository directly plus |
I was able to verify that at least My simple Also, it's easy to increase the scope of the atomicity by just moving the (EDIT: occurs to me that the "do everything in a temp dir and then move it" solution of @raxod502 probably also handles an increased scope of atomicity, by just doing the |
I don't think there need be any concern about a build system hardcoding things, since we'll only need this renaming solution to handle cloning the repository. It is possible for a build command to get interrupted partway through, but it will be re-run the next time the package is loaded, because the fact of the successful build will not be written to the build cache of |
What's wrong
I'm in the process of porting my whole config to use-package+straight.el, with a focus on reproducibility (I had gotten into some weird state using use-package+package.el before, and want to avoid that). My test is to reinstall all the packages in my config in a sandbox, and this takes a long time. At one point I killed Emacs (Ctrl-C in the terminal I started Emacs from) while straight.el was installing packages, and I think it left things in a bad state: after that I was getting errors about "couldn't load package " (or similar, I don't remember the exact wording), and was eventually able to solve the problem by running
M-x straight-pull-package
on the failing package and confirming that I wanted to clean up its repo which was in a "dirty" state.Directions to reproduce
Unfortunately, I don't have an easy way to reproduce this, as it must depend on exactly when you press Ctrl-C. So, this is not a very good bug report, and feel free to close it. In fact, I'm not even 100% sure that me killing Emacs with Ctrl-C was the source of the problem. However, my hope is that the maintainers might know if such a possibility of ending up in a bad state exists, and if so add a fix that prevents it, since it seems useful to be able to abort and restart a long install.
Searching through the existing issues, I found an issue where a user got confused that their package didn't get updated automatically when they changed the recipe, and the maintainers explained that this was because there's a simple check to see if the package's repo is already checked out, in which case nothing is done automatically (manually running something like
straight-pull-package
is needed, as in my case, but my case was more confusing, since I hadn't changed any recipe): #166 (comment) .So, I'm wondering if this same check is to blame here: the repo exists, but is not fully cloned, but straight.el is assuming it was fully cloned. The fix could be to wrap calls to
git pull
(or whatever) in some kind of temporary "mark repo as dirty" state. E.g. something like (pseudo code):and then modify the startup check for the existence of
<repo>
to also check for the existence of<repo>.is-dirty
file, and if so act as tho<repo>
didn't exist.Version information
The text was updated successfully, but these errors were encountered: