From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Andrea Corallo Newsgroups: gmane.emacs.bugs Subject: bug#48079: Temporary files while building after native-comp merge Date: Thu, 06 Jan 2022 16:10:37 +0000 Message-ID: References: <835z06hanw.fsf@gnu.org> <83y2d2fv6c.fsf@gnu.org> <83wnslekok.fsf@gnu.org> <83lf91e9bq.fsf@gnu.org> <83zgocbv2u.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="20801"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) Cc: stefan@marxist.se, Stefan Monnier , 48079@debbugs.gnu.org To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Thu Jan 06 17:11:25 2022 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1n5VMK-0005DU-Mg for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 06 Jan 2022 17:11:24 +0100 Original-Received: from localhost ([::1]:58306 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1n5VMI-0002DD-RW for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 06 Jan 2022 11:11:22 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:58508) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1n5VLz-0002C9-O0 for bug-gnu-emacs@gnu.org; Thu, 06 Jan 2022 11:11:04 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]:49117) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1n5VLy-0003ze-8G for bug-gnu-emacs@gnu.org; Thu, 06 Jan 2022 11:11:03 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1n5VLx-0005aE-WC for bug-gnu-emacs@gnu.org; Thu, 06 Jan 2022 11:11:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Andrea Corallo Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 06 Jan 2022 16:11:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 48079 X-GNU-PR-Package: emacs Original-Received: via spool by 48079-submit@debbugs.gnu.org id=B48079.164148544421434 (code B ref 48079); Thu, 06 Jan 2022 16:11:01 +0000 Original-Received: (at 48079) by debbugs.gnu.org; 6 Jan 2022 16:10:44 +0000 Original-Received: from localhost ([127.0.0.1]:42020 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1n5VLg-0005Ze-5F for submit@debbugs.gnu.org; Thu, 06 Jan 2022 11:10:44 -0500 Original-Received: from mx.sdf.org ([205.166.94.24]:51568) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1n5VLc-0005ZS-H7 for 48079@debbugs.gnu.org; Thu, 06 Jan 2022 11:10:42 -0500 Original-Received: from ma.sdf.org (ma.sdf.org [205.166.94.33]) by mx.sdf.org (8.15.2/8.14.5) with ESMTPS id 206GAbNY019223 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256 bits) verified NO); Thu, 6 Jan 2022 16:10:38 GMT In-Reply-To: <83zgocbv2u.fsf@gnu.org> (Eli Zaretskii's message of "Mon, 03 Jan 2022 19:14:17 +0200") X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:223736 Archived-At: Eli Zaretskii writes: >> From: Stefan Monnier >> Cc: Eli Zaretskii , stefan@marxist.se, 48079@debbugs.gnu.org >> Date: Sun, 02 Jan 2022 18:38:41 -0500 >> >> Hmm... IIUC the situation is the following: >> >> In the plain old byte-compiler, these files are *very* short lived >> because they're not created during the compilation itself but only at >> the very end when we save the result to a file (and we just do it by >> first saving to `foo.elcNNMMPP` and then renaming that to `foo.elc`). >> >> Now with `batch-byte-native-compile-for-bootstrap` apparently we "suspend >> the byte-compiler" right in the middle of this small time window, i.e. after >> writing to `foo.elcNNMMPP` but before its renamed. Then we call the >> native compiler and only once the native compiler is done, we resume the >> byte compilation which just renames the file and exits. >> >> If that understanding is correct, then I think we may be able to fix the >> problem by just changing the moment at which we suspend the byte-compiler: >> suspend it *before* it writes to `foo.elcNNMMPP`. > > Are you sure your description above is accurate? We have a backtrace > in bug#48978 that shows when we create the .elcXXX temporary file. My > reading of that backtrace is that it's the other way around: > native-compilation invokes byte-compile-file, which compiles the Lisp > into bytecode, creates the file with make-temp-file, and writes out > the bytecode. It is true that we then defer renaming of the temporary > file in this case That's correct, and we do that on purpose in order not to produce the .elc file before the .eln one is produced. Otherwise in case of interruption we might mess-up the build as 'make' is looking at the .elc files only as targets. BR Andrea