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

Previous Next

Package: emacs;

Reported by: "N. Jackson" <njackson <at> posteo.net>

Date: Mon, 30 Dec 2024 18:49:01 UTC

Severity: normal

Found in version 30.0.93

Full log


Message #170 received at 75209 <at> debbugs.gnu.org (full text, mbox):

From: "N. Jackson" <njackson <at> posteo.net>
To: Ihor Radchenko <yantar92 <at> posteo.net>
Cc: Eli Zaretskii <eliz <at> gnu.org>, 75209 <at> debbugs.gnu.org
Subject: Re: bug#75209: 30.0.93; Emacs reader failed to read data in
 "/home/nlj/.cache/org-persist/gc-lock.eld"
Date: Sat, 15 Mar 2025 18:03:00 +0000
At 17:43 +0000 on Saturday 2025-03-15, Ihor Radchenko wrote:
>
> "N. Jackson" <njackson <at> posteo.net> writes:
>
>> By the way, the previous diff (for the atomic write juggle for
>> Windows systems) results in errors like these:
>>
>> Error running timer `org-persist--refresh-gc-lock': (file-already-exists "File already exists" "/tmp/org-persist-1p8805")
>> ...
>> I think you need the 'overwrite flag in the call to rename-file.
>> I.e.:
>>
>>       (let ((tmp-file-2 (make-temp-file "org-persist-")))
>>         ;; Just renaming may still not be atomic on Windows, so we do
>>         ;; a bit more complex juggle.
>>         (rename-file file tmp-file-2 'overwrite)
>>         (rename-file tmp-file file 'overwrite)
>>         (delete-file tmp-file-2)))
>
> Ouch. Not 'overwrite flag, but `make-temp-name' instead of `make-temp-file'.

For tmp-file you are using make-temp-file and then you use
'overwrite.  I suppose it's probably best if tmp-file-2 is handled
similarly.  (Unless there's a reason not to that I'm missing.)
Also, in the doc string:

  There is a race condition between calling `make-temp-name' and
  later creating the file, which opens all kinds of security holes.
  For that reason, you should normally use `make-temp-file' instead.





This bug report was last modified 1 day ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.