progfolio / elpaca

An elisp package manager
GNU General Public License v3.0
632 stars 31 forks source link

[Bug]: auto-save directory created when installing packages #32

Closed Luis-Henriquez-Perez closed 1 year ago

Luis-Henriquez-Perez commented 1 year ago

Emacs Version

GNU Emacs 27.2 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.24, cairo version 1.16.0)

Operating System

Guix System 371aa5777a3805a3886f3feea5f1960fe3fe4219 x86_64

Bug Description

auto-save-list directory created when bootstrapping elpaca.

My recommendation is to add (setq auto-save-list-file-prefix nil) to the bootstrap code or maybe to the build steps of packages. For me the former prevented it from being created. I don't think it's appropriate for this directory to be created as a result of installing packages.

Relevant log output

No response

progfolio commented 1 year ago

Thanks for the report.

According to https://www.gnu.org/software/emacs/manual/html_node/emacs/Recover.html that folder is created when an Emacs session is interrupted. (e.g. a session started from the terminal is exited sent an interrupt signal via Ctrl-C).

A minimal bootstrap on my machine did not create the folder. If you have a way to reliably reproduce this, I can look into it.

My recommendation is to add (setq auto-save-list-file-prefix nil) to the bootstrap code or maybe to the build steps of packages.

If anything, I would let-bind it so that the value was only modified for the duration of such functions. setq-ing a user option is too drastic a fix.

I don't think it's appropriate for this directory to be created as a result of installing packages.

We need to pinpoint what is causing the folder to be created. If it's the result of an interrupted session, than the folder is being created as it should be.

Luis-Henriquez-Perez commented 1 year ago

I would let-bind it so that the value was only modified for the duration of such functions. setq-ing a user option is too drastic a fix.

Agreed.

A minimal bootstrap on my machine did not create the folder.

That's strange, it's always been happening for me. I'll try to get reproduction steps.

If it's the result of an interrupted session, than the folder is being created as it should be.

Hmm...I don't think I have been interrupting the sessions. I'll investigate this.

Luis-Henriquez-Perez commented 1 year ago

Ok upon using a minimal bootstrapping, I think you're right. My config not setting this variable to nil looks like the culprit for creating this directory.

I will note, however, I get the compilation error from elapca:

Symbol's variable is void `auto-save-list-file-prefix`

It is the only package that doesn't say that it's finished. All my other packages have been installed so I don't know to what extent this caused something to go wrong--like if the compilation was not completed and what consequences this could have.

progfolio commented 1 year ago

That's an unusual error, since auto-save-list-file-prefix is defined in startup.el. You shouldn't have to explicitly set it to prevent it from being void.

I'm not all that familiar with Guix. Could this be related?:

https://github.com/nix-community/emacs-overlay/issues/64

EDIT: looks like that would not apply to your Emacs version.

What recipe are you using for Elpaca? It would also be useful if you could share the full log for the Elpaca package.

Luis-Henriquez-Perez commented 1 year ago

I might have spoken too soon about the auto-save directory. It was created for me again, despite not loading my config. But I'll assume for now it's related to the compilation error.

These are my init file contents. I have commented out loading my config. To try to get a minimal example.

One thing I wondered is whether it's caused by specifying elpaca twice.

'(elpaca :protocol https :remotes "origin" :inherit t :depth 1 :fetcher github :repo "progfolio/elpaca" :package "elpaca" :files (:defaults) :ref "2805a2e2e8ab28a447e1b885669cbda0ae7359c9")

I need to update the :ref (I've been writing a function to do this for me). But (not sure if this is a bug or not) I've checked the revision of elpaca post-installation and it is the latest one despite registering this recipe. Might be as expected as I do specify this first: (elpaca :host github :repo "progfolio/elpaca").

(defun oo-read-recipes ()
  "Try to see if I have a recipe registered."
  (with-temp-buffer
    (insert-file-contents "~/dotfiles/recipes.org")
    (goto-char (point-min))
    (let (orders)
      (while (re-search-forward "#\\+begin_src emacs-lisp\n\\(?1:.+\\)\n#\\+end_src" nil t)
    (push (cadr (car (read-from-string (match-string 1)))) orders))
      orders)))

(declare-function elpaca-generate-autoloads "elpaca")

(let* ((elpaca-dir (expand-file-name "elpaca/" user-emacs-directory))
       (elpaca-repo (expand-file-name "repos/elpaca" elpaca-dir))
       (elpaca-build (expand-file-name "builds/elpaca" elpaca-dir))
       (elpaca-url "https://www.github.com/progfolio/elpaca.git")
       (buffer nil)
       (recipes (oo-read-recipes))
       (gc-cons-threshold most-positive-fixnum))
  (push (if (file-exists-p elpaca-build) elpaca-build elpaca-repo) load-path)
  (unless (file-exists-p elpaca-repo)
    (setq buffer (get-buffer-create "*elpaca-bootstrap*"))
    (condition-case-unless-debug err
    (progn
      (unless (zerop (call-process "git" nil buffer t "clone" elpaca-url elpaca-repo))
        (error "%s" (list (with-current-buffer buffer (buffer-string)))))
      (byte-recompile-directory elpaca-repo 0 'force)
      (require 'elpaca)
      (elpaca-generate-autoloads "elpaca" elpaca-repo)
      (kill-buffer buffer))
      ((error)
       (delete-directory elpaca-directory 'recursive)
       (with-current-buffer buffer
     (goto-char (point-max))
     (insert (format "\n%S" err))
     (display-buffer buffer)))))
  (require 'elpaca)
  (elpaca (elpaca :host github :repo "progfolio/elpaca"))
  (require 'elpaca-autoloads)
  (dolist (recipe recipes)
    (eval `(elpaca ,recipe) t))
  ;; (add-hook 'elpaca-after-init-hook
  ;;        (lambda () (load (expand-file-name "config.el" user-emacs-directory))))
  (elpaca-process-queues))

This is the full log.

 Package Status Info Time ▼ 
elpaca                         autoloads            Symbol’s value as variable is void: auto-save-list-file-prefix                   120.330160
aggressive-indent              finished             ✓ 108.908 secs                                                                   144.894899
anaphora                       finished             ✓ 108.913 secs                                                                   144.897819
async                          finished             ✓ 109.872 secs                                                                   145.877793
auth-source-pass               finished             ✓ 109.895 secs                                                                   145.879052
auto-capitalize                finished             ✓ 109.897 secs                                                                   145.880029
avy                            finished             ✓ 109.899 secs                                                                   145.918007
bind-key                       finished             ✓ 109.944 secs                                                                   145.925560
buffer-expose                  finished             ✓ 109.946 secs                                                                   145.926654
corfu                          finished             ✓ 109.958 secs                                                                   145.938711
dashboard                      finished             ✓ 109.961 secs                                                                   145.939752
decide                         finished             ✓ 109.964 secs                                                                   145.941190
default-text-scale             finished             ✓ 109.974 secs                                                                   145.950968
dirvish-subtree                finished             ✓ 110.254 secs                                                                   146.227799
dmenu                          finished             ✓ 110.295 secs                                                                   146.267965
doct                           finished             ✓ 110.307 secs                                                                   146.280336
edit-indirect                  finished             ✓ 110.331 secs                                                                   146.303604
ednc                           finished             ✓ 110.362 secs                                                                   146.334342
el-mock                        finished             ✓ 110.372 secs                                                                   146.343444
elfeed                         finished             ✓ 110.381 secs                                                                   146.413913
elfeed-org                     finished             ✓ 110.445 secs                                                                   146.415028
elisp-demos                    finished             ✓ 110.461 secs                                                                   146.433927
engine-mode                    finished             ✓ 110.509 secs                                                                   146.474883
eros                           finished             ✓ 110.534 secs                                                                   146.499790
eshell-up                      finished             ✓ 111.171 secs                                                                   147.136221
eshell-z                       finished             ✓ 111.173 secs                                                                   147.138384
expand-region                  finished             ✓ 111.193 secs                                                                   147.155246
exwm-edit                      finished             ✓ 111.205 secs                                                                   147.166633
figlet                         finished             ✓ 111.211 secs                                                                   147.170451
fortune-cookie                 finished             ✓ 111.212 secs                                                                   147.171527
frame-fns                      finished             ✓ 111.220 secs                                                                   147.201981
gcmh                           finished             ✓ 111.257 secs                                                                   147.214863
gif-screencast                 finished             ✓ 111.266 secs                                                                   147.222676
git-auto-commit-mode           finished             ✓ 111.289 secs                                                                   147.246077
goto-chg                       finished             ✓ 111.299 secs                                                                   147.254711
grugru                         finished             ✓ 111.320 secs                                                                   147.274797
hide-mode-line                 finished             ✓ 111.347 secs                                                                   147.298739
highlight-quoted               finished             ✓ 111.368 secs                                                                   147.318563
idle-require                   finished             ✓ 111.383 secs                                                                   147.330704
iedit                          finished             ✓ 111.392 secs                                                                   147.338643
key-chord                      finished             ✓ 111.420 secs                                                                   147.364852
keyfreq                        finished             ✓ 111.434 secs                                                                   147.377551
kv                             finished             ✓ 111.449 secs                                                                   147.433923
leaf                           finished             ✓ 111.493 secs                                                                   147.481563
let-alist                      finished             ✓ 111.599 secs                                                                   147.540119
log4e                          finished             ✓ 111.615 secs                                                                   147.552681
lv                             finished             ✓ 111.623 secs                                                                   147.837994
macrostep                      finished             ✓ 111.903 secs                                                                   147.839417
map                            finished             ✓ 111.920 secs                                                                   147.894410
marginalia                     finished             ✓ 112.015 secs                                                                   147.947442
memoize                        finished             ✓ 112.042 secs                                                                   147.974207
mmt                            finished             ✓ 112.065 secs                                                                   147.995229
org-journal                    finished             ✓ 112.173 secs                                                                   148.100705
org-link-minor-mode            finished             ✓ 112.209 secs                                                                   148.134976
org-super-links                finished             ✓ 112.215 secs                                                                   148.137845
org-superstar                  finished             ✓ 112.234 secs                                                                   148.155129
ov                             finished             ✓ 112.259 secs                                                                   148.178595
paredit                        finished             ✓ 112.281 secs                                                                   148.198886
password-generator             finished             ✓ 112.323 secs                                                                   148.239521
peg                            finished             ✓ 112.433 secs                                                                   148.346282
pinentry                       finished             ✓ 112.450 secs                                                                   148.362508
plural                         finished             ✓ 112.528 secs                                                                   148.439180
popup                          finished             ✓ 112.533 secs                                                                   148.443487
popwin                         finished             ✓ 112.590 secs                                                                   148.499584
rainbow-delimiters             finished             ✓ 112.630 secs                                                                   148.538739
redacted                       finished             ✓ 112.640 secs                                                                   148.547281
restart-emacs                  finished             ✓ 112.691 secs                                                                   148.598234
s                              finished             ✓ 112.737 secs                                                                   148.643547
search-web                     finished             ✓ 112.770 secs                                                                   148.674969
shut-up                        finished             ✓ 112.787 secs                                                                   148.690515
spacemacs-theme                finished             ✓ 112.794 secs                                                                   148.696208
spell-number                   finished             ✓ 112.811 secs                                                                   148.712138
super-save                     finished             ✓ 112.834 secs                                                                   148.734232
svg-lib                        finished             ✓ 112.864 secs                                                                   148.910818
tablist                        finished             ✓ 113.785 secs                                                                   149.799256
tempel                         finished             ✓ 113.948 secs                                                                   149.843562
toc-org                        finished             ✓ 113.965 secs                                                                   149.859454
transient                      finished             ✓ 114.055 secs                                                                   150.083268
transpose-frame                finished             ✓ 114.200 secs                                                                   150.093433
undo-tree                      finished             ✓ 114.242 secs                                                                   150.133923
which-key                      finished             ✓ 114.323 secs                                                                   150.210939
with-emacs                     finished             ✓ 114.338 secs                                                                   150.224548
workgroups2                    finished             ✓ 114.374 secs                                                                   150.260289
xelb                           finished             ✓ 114.395 secs                                                                   150.334077
xr                             finished             ✓ 114.463 secs                                                                   150.347185
zone-matrix                    finished             ✓ 114.522 secs                                                                   150.431173
zone-rainbow                   finished             ✓ 114.564 secs                                                                   150.447251
zone-sl                        finished             ✓ 114.673 secs                                                                   150.555166
zoom-window                    finished             ✓ 114.770 secs                                                                   150.650661
zoutline                       finished             ✓ 114.848 secs                                                                   150.726633
vertico                        finished             ✓ 116.597 secs                                                                   152.510001
dirvish-media                  finished             ✓ 116.831 secs                                                                   152.823224
dirvish-icons                  finished             ✓ 116.971 secs                                                                   152.946004
dirvish-collapse               finished             ✓ 117.056 secs                                                                   153.031824
markdown-mode                  finished             ✓ 124.459 secs                                                                   160.447907
emms                           finished             ✓ 124.487 secs                                                                   160.453786
annalist                       finished             ✓ 124.470 secs                                                                   160.454719
org-auto-tangle                finished             ✓ 124.478 secs                                                                   160.466773
evil-easymotion                finished             ✓ 124.504 secs                                                                   160.468308
ace-window                     finished             ✓ 124.491 secs                                                                   160.478883
elfeed-score                   finished             ✓ 124.510 secs                                                                   160.479811
embark                         finished             ✓ 124.513 secs                                                                   160.480671
frame-cmds                     finished             ✓ 124.524 secs                                                                   160.493793
db                             finished             ✓ 124.517 secs                                                                   160.495065
ppp                            finished             ✓ 124.587 secs                                                                   160.496450
hydra                          finished             ✓ 124.550 secs                                                                   160.498692
orderless                      finished             ✓ 124.583 secs                                                                   160.510837
svg-tag-mode                   finished             ✓ 124.614 secs                                                                   160.512115
pdf-tools                      finished             ✓ 124.778 secs                                                                   160.692230
dirvish                        finished             ✓ 124.719 secs                                                                   160.694829
exwm                           finished             ✓ 124.765 secs                                                                   160.826086
ialign                         finished             ✓ 124.846 secs                                                                   160.836018
consult                        finished             ✓ 124.890 secs                                                                   160.870880
el-get                         finished             ✓ 124.916 secs                                                                   160.887049
vertico-buffer                 finished             ✓ 126.574 secs                                                                   162.463998
vertico-quick                  finished             ✓ 126.576 secs                                                                   162.465465
ef-themes                      finished             ✓ 126.536 secs                                                                   162.507528
with-editor                    finished             ✓ 126.631 secs                                                                   162.534431
zoom-frm                       finished             ✓ 128.358 secs                                                                   164.239323
exwm-float                     finished             ✓ 128.280 secs                                                                   164.240412
exwm-firefox-core              finished             ✓ 128.286 secs                                                                   164.246758
org-transclusion               finished             ✓ 129.850 secs                                                                   165.771030
password-store                 finished             ✓ 129.856 secs                                                                   165.793528
ivy                            finished             ✓ 130.944 secs                                                                   166.897906
all-the-icons                  finished             ✓ 131.789 secs                                                                   167.782836
password-store-otp             finished             ✓ 131.869 secs                                                                   167.784022
dash                           finished             ✓ 131.812 secs                                                                   168.310013
swiper                         finished             ✓ 135.341 secs                                                                   171.263538
all-the-icons-completion       finished             ✓ 136.965 secs                                                                   172.950868
dash-functional                finished             ✓ 136.973 secs                                                                   173.014517
ts                             finished             ✓ 137.123 secs                                                                   173.015508
origami                        finished             ✓ 137.097 secs                                                                   173.017281
mini-modeline                  finished             ✓ 137.087 secs                                                                   173.018268
ht                             finished             ✓ 137.082 secs                                                                   173.114638
f                              finished             ✓ 137.156 secs                                                                   173.196399
elisp-refs                     finished             ✓ 137.245 secs                                                                   173.276399
aggressive-fill-paragraph      finished             ✓ 140.076 secs                                                                   176.062762
counsel                        finished             ✓ 140.312 secs                                                                   176.402460
smartparens                    finished             ✓ 140.502 secs                                                                   176.404595
org-ml                         finished             ✓ 140.497 secs                                                                   176.422661
separedit                      finished             ✓ 142.071 secs                                                                   177.975250
dbc                            finished             ✓ 141.999 secs                                                                   177.976625
pass                           finished             ✓ 142.060 secs                                                                   177.977673
ellocate                       finished             ✓ 142.010 secs                                                                   177.978622
helpful                        finished             ✓ 142.030 secs                                                                   177.982505
org-super-agenda               finished             ✓ 142.552 secs                                                                   178.489766
org-ql                         finished             ✓ 151.926 secs                                                                   187.850707
lispy                          finished             ✓ 153.545 secs                                                                   189.484304
modus-themes                   finished             ✓ 154.806 secs                                                                   190.735183
magit-section                  finished             ✓ 199.030 secs                                                                   234.964454
git-commit                     finished             ✓ 199.367 secs                                                                   235.332897
git-gutter+                    finished             ✓ 201.381 secs                                                                   237.336414
magit                          finished             ✓ 203.469 secs                                                                   239.404519
emojify                        finished             ✓ 236.755 secs                                                                   272.721800
evil                           finished             ✓ 256.972 secs                                                                   293.045791
evil-surround                  finished             ✓ 260.055 secs                                                                   296.017520
evil-magit                     finished             ✓ 260.063 secs                                                                   296.026466
evil-goggles                   finished             ✓ 260.064 secs                                                                   296.027408
lispyville                     finished             ✓ 260.783 secs                                                                   296.721048
exwm-firefox-evil              finished             ✓ 260.761 secs                                                                   296.721951
evil-cleverparens              finished             ✓ 260.759 secs                                                                   296.723775
evil-collection                finished             ✓ 261.130 secs                                                                   297.094282
helm-core                      finished             ✓ 274.148 secs                                                                   310.117898
helm                           finished             ✓ 277.714 secs                                                                   313.672735
swiper-helm                    finished             ✓ 278.492 secs                                                                   314.388516

recipe file: recipes.txt

progfolio commented 1 year ago

One thing I wondered is whether it's caused by specifying elpaca twice.

That could be.

I've checked the revision of elpaca post-installation and it is the latest one despite registering this recipe.

During the initial bootstrap the latest version of Elpaca will be downloaded. It should be possible to unload that version of Elpaca after it builds the version of Elpaca you've requested, then load the built version. I haven't experimented with this myself yet.

I'm still not sure why the auto-save-list would be created if a subprocess fails. I've tried testing locally by intentionally causing a batch process to fail and it does not create the directory:

emacs --init-directory=. --batch --eval "void"

outputs

Error: void-variable (void)
  debug-early-backtrace()
  debug-early(error (void-variable void))
  command-line-1(("--eval" "void"))
  command-line()
  normal-top-level()
Symbol’s value as variable is void: void

and no directory is created:

ls -lah
total 0
drwxr-xr-x  2 n    n      40 Nov 25 14:17 .
drwxrwxrwt 29 root root 1.2K Nov 25 14:17 ..

That's not to say the failed subprocess isn't the cause, I'm just not sure why if it is.

Luis-Henriquez-Perez commented 1 year ago

It should be possible to unload that version of Elpaca after it builds the version of Elpaca you've requested, then load the built version.

I probably have to do this regardless of this issue, because the commit of elpaca does not correspond to the :ref I have specified in my recipe file, probably because I already load the latest version of elpaca in the bootstrapping. I'm in the middle of a migration of sorts where I'm setting up/refining my dotfiles so I haven't had a time to tighten this up. Also elpaca is still changing a often so maybe not too much of a deal for now. But it is important for guaranteeing full reproducibility.

Now that we mention the bootstrapping I think I read that you intend to update the bootstrapping code. Perhaps the bootstrapping code should optionally specify the commit of elpaca too.

That's not to say the failed subprocess isn't the cause, I'm just not sure why if it is.

Ok. Thank you for investigating. Since you aren't able to reproduce the problem, I propose we close this for now.

I'll research this further and ask to reopen if I figure it out.

progfolio commented 1 year ago

Now that we mention the bootstrapping I think I read that you intend to update the bootstrapping code. Perhaps the bootstrapping code should optionally specify the commit of elpaca too.

You could replace the section which just clones the bootstrap version of Elpaca so that it also checks out your desired commit. e.g.

(condition-case-unless-debug err
    (progn
      (unless (zerop (call-process "git" nil buffer t "clone" elpaca-url elpaca-repo))
        (error "%s" (list (with-current-buffer buffer (buffer-string)))))
      ;; Check out a specific ref
      (let ((default-directory elpaca-repo))
        (unless (zerop (call-process "git" nil buffer t "checkout" "YOUR-REF-HERE"))
          (error "%s" (list (with-current-buffer buffer (buffer-string))))))
      (byte-recompile-directory elpaca-repo 0 'force)
      (require 'elpaca)
      (elpaca-generate-autoloads "elpaca" elpaca-repo)
      (kill-buffer buffer))
  ((error)
   (delete-directory elpaca-directory 'recursive)
   (with-current-buffer buffer
     (goto-char (point-max))
     (insert (format "\n%S" err))
     (display-buffer buffer))))

Since you aren't able to reproduce the problem, I propose we close this for now. I'll research this further and ask to reopen if I figure it out.

OK. That sounds good. We can always look into it more if you or anyone else is able to reproduce reliably.

progfolio commented 1 year ago

FYI: I've updated the bootstrapping snippet in e9e6766. It includes an elpaca-order recipe. You can change the :ref and/or :url keywords to clone/checkout the desired version of Elpaca.