all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Aaron Jensen <aaronjensen@gmail.com>
To: Eli Zaretskii <eliz@gnu.org>
Cc: 68083@debbugs.gnu.org, acorallo@gnu.org, jschmidt4gnu@vodafonemail.de
Subject: bug#68083: 30.0.50; Intermittent build failure with native compilation
Date: Sat, 30 Dec 2023 10:29:16 -0500	[thread overview]
Message-ID: <CAHyO48yHsfN=efOhtmquWThSkfPLvC1B-=v_xs=ySf1fR7poiQ@mail.gmail.com> (raw)
In-Reply-To: <835y0g5gq8.fsf@gnu.org>

On Sat, Dec 30, 2023 at 1:47 AM Eli Zaretskii <eliz@gnu.org> wrote:
>
> > From: Aaron Jensen <aaronjensen@gmail.com>
> > Date: Fri, 29 Dec 2023 16:07:38 -0500
> > Cc: Eli Zaretskii <eliz@gnu.org>, 68083@debbugs.gnu.org,
> >       Jens Schmidt <jschmidt4gnu@vodafonemail.de>
> >
> > Just to confirm, adding macroexpand to native-comp-never-optimize-functions allows me to build
> > successfully.
> >
> > It also looks like comp-delete-or-replace-file can be updated to protect rename-file against
> > file-already-exists like it does for Windows. That would also likely solve the problem if you want to be
> > able to optimize macroexpand.
>
> Are you sure?  We do that on Windows because Windows doesn't allow us
> to delete a file that is open by another program.  That shouldn't
> happen on Posix systems, so I think what you see here is due to a race
> between checking whether a file exists and renaming it, which is a
> different problem.
>
> However, feel free to try the same trick we use on Windows and see
> whether it helps.

This fixes it for me:

diff --git a/lisp/emacs-lisp/comp.el b/lisp/emacs-lisp/comp.el
index 3b2fd25e61c..80088f935a4 100644
--- a/lisp/emacs-lisp/comp.el
+++ b/lisp/emacs-lisp/comp.el
@@ -3341,7 +3341,11 @@ comp-delete-or-replace-file
         ;; is currently loaded.
         (t (delete-file oldfile)
            (when newfile
-             (rename-file newfile oldfile)))))
+             (condition-case _
+                 (rename-file newfile oldfile)
+               (file-already-exists
+                (delete-file newfile)
+                t))))))

 (defun comp--native-compile (function-or-file &optional with-late-load output)
   "Compile FUNCTION-OR-FILE into native code.

I imagine that this is worth doing just to make this operation
parallel-safe, but I wonder why macroexpand is the only instance of
this happening. I don't know if macroexpand should still be in
native-comp-never-optimize-functions or not (i.e., is there another
reason it was there other than to avoid this crash?)

Aaron





  reply	other threads:[~2023-12-30 15:29 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-12-28 14:05 bug#68083: 30.0.50; Intermittent build failure with native compilation Aaron Jensen
2023-12-28 15:12 ` Eli Zaretskii
2023-12-29 18:43   ` Andrea Corallo
2023-12-29 19:09     ` Aaron Jensen
2023-12-29 20:17       ` Andrea Corallo
2023-12-29 20:26         ` Aaron Jensen
2023-12-29 21:07           ` Aaron Jensen
2023-12-30  6:47             ` Eli Zaretskii
2023-12-30 15:29               ` Aaron Jensen [this message]
2023-12-30 17:42                 ` Eli Zaretskii
2023-12-30 18:06                   ` Aaron Jensen
2023-12-30 18:46                     ` Eli Zaretskii
2023-12-30 20:54                       ` Aaron Jensen
2023-12-30 23:08                         ` Aaron Jensen
2023-12-31  6:26                         ` Eli Zaretskii
2024-01-01 19:39                           ` Andrea Corallo
2024-01-01 20:12                             ` Eli Zaretskii
2023-12-31 20:30         ` Jens Schmidt via Bug reports for GNU Emacs, the Swiss army knife of text editors

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAHyO48yHsfN=efOhtmquWThSkfPLvC1B-=v_xs=ySf1fR7poiQ@mail.gmail.com' \
    --to=aaronjensen@gmail.com \
    --cc=68083@debbugs.gnu.org \
    --cc=acorallo@gnu.org \
    --cc=eliz@gnu.org \
    --cc=jschmidt4gnu@vodafonemail.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.