persistent-scratch icon indicating copy to clipboard operation
persistent-scratch copied to clipboard

file error

Open mclearc opened this issue 8 years ago • 5 comments

I intermittently, but consistently so, am getting the following error.

Error running timer ‘persistent-scratch-save’: (file-missing "Renaming" "No such file or directory" "/Users/roambot/.emacs.d/.cache/persistent-scratch.new" "/Users/roambot/.emacs.d/.cache/persistent-scratch")

This is also typically accompanied by data loss. I've been using persistent-scratch.el for almost a year, and this error is new in the last month or so, so I'm wondering what might have prompted the change. I'm using emacs 26.0.5 and the most recent version of persistent-scratch.el. My setup is as follows:

  (use-package persistent-scratch
    :init
    (setq persistent-scratch-backup-directory (concat user-cache-directory "scratch-backups"))
    (setq persistent-scratch-save-file (concat user-cache-directory "persistent-scratch"))
    ;; keep backups not older than a month
    (setq persistent-scratch-autosave-interval 60)
    (setq persistent-scratch-backup-filter
      (persistent-scratch-keep-backups-not-older-than
       (days-to-time 90)))
    :config
    (ignore-errors (persistent-scratch-setup-default)))

mclearc avatar Sep 13 '17 17:09 mclearc

(file-missing "Renaming" "No such file or directory" "/Users/roambot/.emacs.d/.cache/persistent-scratch.new" "/Users/roambot/.emacs.d/.cache/persistent-scratch")

So write-region succeeded, but rename-file failed? Odd.

this error is new in the last month or so

Honestly, I suspect a faulty disk or file system. Are you sure both are okay?

Fanael avatar Sep 13 '17 18:09 Fanael

The computer this is on is new (2016 macbook pro) and I've seen no other file-system or disk problems. other files saved to .cache are fine (and this is most of the emacs system files and other junk). So yeah, weird.

mclearc avatar Sep 13 '17 18:09 mclearc

The computer this is on is new (2016 macbook pro) and I've seen no other file-system or disk problems.

I'd check just to be sure.

Does /Users/roambot/.emacs.d/.cache/ exist? Does the following succeed?

(dotimes (_ 1000)
  (write-region "" nil (concat user-cache-directory "persistent-scratch.new"))
  (rename-file (concat user-cache-directory "persistent-scratch.new") (concat user-cache-directory "persistent-scratch") t))

Fanael avatar Sep 13 '17 18:09 Fanael

There is such a directory, and emacs finds the value of the variable user-cache-directory fine when I query it. And the above succeeds when I evaluate it. Specifically, the message is: Wrote /Users/roambot/.emacs.d/.cache/persistent-scratch.new [1000 times]

mclearc avatar Sep 13 '17 18:09 mclearc