Here's a patch, if helpful. I've tested it and can build with it.


Aaron


On Sat, Dec 30, 2023 at 3:54 PM, Aaron Jensen <aaronjensen@gmail.com> wrote:
Works for me, though is it still an outstanding question as to whether or not we should add macro expand back?

Also yeah if we add the t we can do what you suggested where it’s either a delete or rename force. 


Aaron

On Sat, Dec 30 2023 at 1:46 PM, Eli Zaretskii <eliz@gnu.org> wrote:

From: Aaron Jensen <aaronjensen@gmail.com>
Date: Sat, 30 Dec 2023 13:06:55 -0500
Cc: acorallo@gnu.org, 68083@debbugs.gnu.org, jschmidt4gnu@vodafonemail.de

On Sat, Dec 30, 2023 at 12:43 PM Eli Zaretskii <eliz@gnu.org> wrote:
>
> What happens if, instead of wrapping rename-file in condition-case,
> you change that to say
>
> (t (if newfile
> (rename-file newfile oldfile)
> (delete-file oldfile))

I don't really understand this change. The previous version of the code wraps the rename in a (when newfile) and deletes the oldfile right before that. The deletion would always be necessary if the oldfile exists unless OK-IF-ALREADY-EXISTS is specified in rename-file.

Sorry, I meant to add the OK-IF-ALREADY-EXISTS argument non-nil, of course.

The point is that you can rename a file if the OLDFILE exists with no problem, and that is supposed to be an atomic operation, so no race conditions.

Indeed, but we aren't specifying OK-IF-ALREADY-EXISTS, so if another process does the same compile at the same time (and therefore the same rename), they will conflict. We could specify OK-IF-ALREADY-EXISTS instead and that works as well:

Then I prefer this version.