Subject: Re: bug#68083: 30.0.50; Intermittent build failure with native compilation

From: Eli Zaretskii <[email-masked]>
Date: Sat, 30 Dec 2023 20:46:08 +0200

> From: Aaron Jensen <[email-masked]>
> Date: Sat, 30 Dec 2023 13:06:55 -0500
> Cc: [email-masked], [email-masked], [email-masked]
> 
> On Sat, Dec 30, 2023 at 12:43 PM Eli Zaretskii <[email-masked]> 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.