From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#60996: 29.0.60; Native compile fails to remove temp file for trampoline Date: Mon, 23 Jan 2023 16:58:28 +0200 Message-ID: <83r0vli9gr.fsf@gnu.org> References: <74d13c46-5b26-9dd8-45dc-32b7fda25421@gmail.com> <833583ks9t.fsf@gnu.org> <86wn5evv70.fsf@gmail.com> Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="6809"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 60996@debbugs.gnu.org To: Andy Moreton Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Mon Jan 23 15:59:22 2023 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 1pJyI5-0001b0-LM for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 23 Jan 2023 15:59:21 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pJyHp-0006Cu-4c; Mon, 23 Jan 2023 09:59:05 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pJyHn-0006CS-O0 for bug-gnu-emacs@gnu.org; Mon, 23 Jan 2023 09:59:03 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pJyHm-0004Rw-Gn for bug-gnu-emacs@gnu.org; Mon, 23 Jan 2023 09:59:03 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1pJyHm-0003Tg-8b for bug-gnu-emacs@gnu.org; Mon, 23 Jan 2023 09:59:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 23 Jan 2023 14:59:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 60996 X-GNU-PR-Package: emacs Original-Received: via spool by 60996-submit@debbugs.gnu.org id=B60996.167448590813324 (code B ref 60996); Mon, 23 Jan 2023 14:59:02 +0000 Original-Received: (at 60996) by debbugs.gnu.org; 23 Jan 2023 14:58:28 +0000 Original-Received: from localhost ([127.0.0.1]:55049 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pJyHE-0003Sp-B9 for submit@debbugs.gnu.org; Mon, 23 Jan 2023 09:58:28 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:48900) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pJyHC-0003Sc-V2 for 60996@debbugs.gnu.org; Mon, 23 Jan 2023 09:58:27 -0500 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pJyH7-00049M-L5; Mon, 23 Jan 2023 09:58:21 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=D8eQaFXvXCQWntjHNLY8YKDv97OKeXrSU7JwOfvfngM=; b=HFEV2N06Gdwc 8XA2gEnKeeSmbkhg8UOtvyQTczcfi9AcpE4nTtbZP+n3b8GW6+cjH0hSELjpXrHwbfTz+OnGLlHKY D9LnCOhG7vf/kCB08qp9Z/9T6779cZw+oFU4T+Sa6c650RHn/wNvwJVu6jnG/Ha8mlULS1arBQVMB simzTD/qUNbf5chys/9ZyNM7sl0yVqbpqgimIhksrtv7tS14U6OWaUkFU0aGhMsExRwBjg7Tycfr6 tIqd4wUhPouowa7+55hIg+ObwG4MGmOZTLgdqYSnCLQIY9hS2izlX/qW+qQpWVJcM/LzE+cBE2u8/ xU+To2R+FlcdW3tEL4AG8Q==; Original-Received: from [87.69.77.57] (helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pJyH6-0000ln-Me; Mon, 23 Jan 2023 09:58:21 -0500 In-Reply-To: <86wn5evv70.fsf@gmail.com> (message from Andy Moreton on Mon, 23 Jan 2023 02:30:43 +0000) 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-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:254003 Archived-At: > From: Andy Moreton > Date: Mon, 23 Jan 2023 02:30:43 +0000 > > >From more expermenting with a debug build in gdb, it seem to be related > to this code in native-elisp-load: > > /* If in this session there was ever a file loaded with this > name, rename it before loading, to make sure we always get a > new handle! */ > Lisp_Object tmp_filename = > Fmake_temp_file_internal (filename, Qnil, build_string (".eln.tmp"), > Qnil); > if (NILP (Ffile_writable_p (tmp_filename))) > comp_u->handle = dynlib_open_for_eln (SSDATA (encoded_filename)); > else > { > Frename_file (filename, tmp_filename, Qt); > comp_u->handle = dynlib_open_for_eln (SSDATA (ENCODE_FILE (tmp_filename))); > Frename_file (tmp_filename, filename, Qnil); > } > > The renaming results in the ".eln.tmp" suffixed name having an open > handle. That handle is still open when other code tries to delete > the renamed ".eln" file, which fails. The question is: why is that .eln.tmp file still open when we are trying to delete it? I hoped we'd be able to establish that, so that we could decide what to do about it. But I don't yet see the information which would explain why the file is still open. Do these *.eln.tmp file remain in %TEMP% after Emacs startup? If they remain there, then what happens if you exit Emacs and restart it? do these files remain there or are they deleted? IOW, if we just ignore these errors (e.g., by ignore-error), would the problem be fixed, or will there be left-overs? > The attached .csv file shows filesystem activity captured by Process > Monitor for the relevant "...\comp-lambda-*" temp files during emacs > startup. (It may be easier to read if imported into a spreadsheet). Maybe I don't understand how to read this, but I cannot find any traces for the failed deletion of a .eln.tmp file. The only failure to delete is this: > "14:15:24.8773402","emacs.exe","6452","SetDispositionInformationEx","C:\Users\ajm\AppData\Local\Temp\comp-lambda-SGvFx7.eln","CANNOT DELETE","Flags: FILE_DISPOSITION_DELETE, FILE_DISPOSITION_POSIX_SEMANTICS, FILE_DISPOSITION_FORCE_IMAGE_SECTION_CHECK" and it names a .eln file, not .eln.tmp. I also don't see any RenameFile calls, but maybe they appear under different names in this captured activity? > > We need to know which code opened it the last time and didn't close > > it. Can you figure that out? All the files Emacs opens go through 2 > > functions in w32.c: sys_fopen and sys_open, so by running with 2 > > breakpoints there that show the backtrace and continue, you should be > > able to see the culprit, and we can then take it from there. > > As noted above, I think it is the code in native-elisp-load interacting > woth the way that the files are renamed (and if those operations have > specified posix semantics or not). I don't think I follow. The snippet from native-elisp-load you show doesn't call Fdelete_file, it only renames files, and renaming should work on MS-Windows like it works on Posix systems in this case. The problem, as the error message evidences, is in Fdelete_file. Frename_file indeed can call Fdelete_file, but rename-file is not in the backtraces you posted, so I don't think this code is involved directly. You seem to say this code somehow "interferes" with deleting files, but how does it interfere with that? Also, AFAIK this part of comp.c didn't change since Emacs 28, so whatever caused the problem is not this code directly, but something else. IOW, I'd still like to understand in more detail what changed lately that causes these errors in your case. > >> I am not sure excactly when this issue started, but I did not see it in > >> emacs-29 or master bootstrapped before this month. > > > > Could be because we now compile trampolines differently (to avoid the > > danger of the "fork bomb" due to recursive compilation of > > trampolines by async subprocesses). > > Any idea when those changes were committed, and which changesets ? IT > doesn't apper obvios from the commit history. See commit 1a8015b837. Maybe also commit 5fec9182db. Thanks.