Subject: Re: bug#75209: 30.0.93; Emacs reader failed to read data in "/home/nlj/.cache/org-persist/gc-lock.eld"

From: Stefan Monnier <[email-masked]>
Date: Sat, 11 Jan 2025 10:19:25 -0500

>>   Warning (emacs): Emacs reader failed to read data in
>>   "/home/nlj/.cache/org-persist/gc-lock.eld". The error was: "End of
>>   file during parsing"
>> 
>> The `gc-lock' part suggests this might have something to do with
>> garbage collection, whereas `org-persist' suggests Org mode, but
>> I could find nothing in the Org manual about org-persist or about
>> gc-lock.
>
> Does the file exist?  If so, what is its content (assuming you can
> post it here)?

FWIW, I've seen such errors enough times that I changed the code:

    @@ -444,8 +443,9 @@ org-persist--read-elisp-file
              (if (string-match-p "Invalid read syntax" (error-message-string err))
                  (message "Emacs reader failed to read data in %S. The error was: %S"
                           buffer-or-file (error-message-string err))
    -           (warn "Emacs reader failed to read data in %S. The error was: %S"
    -                 buffer-or-file (error-message-string err)))
    +           (warn "Emacs reader failed to read data in %S. The error was: %S\nFrom startpos %S in text (at %s):\n%S"
    +                 buffer-or-file (error-message-string err)
    +                 startpos (format-time-string "%F %T") (buffer-string)))
              nil)))))
     
     ;; FIXME: `pp' is very slow when writing even moderately large datasets

[ The "time" part is because it seems to happen mostly while I'm not
  using Emacs.  ]

The `buffer-string` is always empty in that error message, for me.
Maybe it's because the file doesn't exist, I have not investigated that far.

        Stefan