all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Eli Zaretskii <eliz@gnu.org>
To: Andy Moreton <andrewjmoreton@gmail.com>, Andrea Corallo <akrl@sdf.org>
Cc: 60996@debbugs.gnu.org
Subject: bug#60996: 29.0.60; Native compile fails to remove temp file for trampoline
Date: Tue, 24 Jan 2023 14:56:00 +0200	[thread overview]
Message-ID: <83wn5cgkgv.fsf@gnu.org> (raw)
In-Reply-To: <86edrku3w6.fsf@gmail.com> (message from Andy Moreton on Tue, 24 Jan 2023 01:18:01 +0000)

> From: Andy Moreton <andrewjmoreton@gmail.com>
> Date: Tue, 24 Jan 2023 01:18:01 +0000
> 
> >>       /* 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.
> 
> The file handle is returned from dynlib_open_for_eln (which came from a
> LoadLibrary call in dylib_open). More below.
> 
> > 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 ".eln.tmp" suffixed files are only renamed temporarily, and the files
> only fleetingly have that name. The ".eln" suffixed file names persist
> after the failed delete, so will accumulate unless removed manually.

So we are trying to delete a .eln file that is still being loaded into
this same Emacs session?  That sounds like a bug to me.

Andrea, could you see if this situation can happen?  IIUC, it should
also happen on Unix when we compile a trampoline on the flight
(perhaps when a previous outdated version of the trampoline exists?),
except that on Unix the deletion silently succeeds and the file is
removed when the session ends, which doesn't happen on Windows.  On
Windows, we need to unload the .eln file first, but can we do that
with a trampoline?

But first, I'd like to understand whether indeed it could happen that
we are deleting a temporary .eln file for a trampoline we just
compiled when we are still using that .eln file.  If this happens,
we'd need to find a way to delay the deletion till Emacs is about to
exit or something.





  reply	other threads:[~2023-01-24 12:56 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-01-21 22:12 bug#60996: 29.0.60; Native compile fails to remove temp file for trampoline Andy Moreton
2023-01-22  6:17 ` Eli Zaretskii
2023-01-22 12:51   ` Andy Moreton
2023-01-23 17:04     ` Andrea Corallo
2023-01-23 17:11       ` Eli Zaretskii
2023-01-26 16:50         ` Andrea Corallo
2023-01-26 18:38           ` Eli Zaretskii
2023-01-26 19:46             ` Andrea Corallo
2023-01-26 20:03               ` Eli Zaretskii
2023-01-26 20:25                 ` Andrea Corallo
2023-01-27 13:00                 ` Eli Zaretskii
2023-01-27 13:56                   ` Andrea Corallo
2023-01-26 20:35             ` Eli Zaretskii
2023-01-27  9:51               ` Andrea Corallo
2023-01-28 21:15                 ` Andy Moreton
2023-01-29  7:01                   ` Eli Zaretskii
2023-01-29  7:23                     ` Eli Zaretskii
2023-01-30 10:11                       ` Andrea Corallo
2023-01-29  7:47                   ` Eli Zaretskii
2023-01-29 11:37                     ` Andy Moreton
2023-01-29 13:50                       ` Eli Zaretskii
2023-01-29 13:50                       ` Eli Zaretskii
2023-01-23  2:30   ` Andy Moreton
2023-01-23 14:58     ` Eli Zaretskii
2023-01-24  1:18       ` Andy Moreton
2023-01-24 12:56         ` Eli Zaretskii [this message]
2023-01-24 17:50           ` Eli Zaretskii
2023-01-24 19:12             ` Eli Zaretskii
2023-01-24 22:32               ` Andy Moreton
2023-01-25 11:58                 ` Eli Zaretskii
2023-01-25 23:49                   ` Andy Moreton
2023-01-26  6:51                     ` Eli Zaretskii
2023-01-26 16:57             ` Andrea Corallo

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=83wn5cgkgv.fsf@gnu.org \
    --to=eliz@gnu.org \
    --cc=60996@debbugs.gnu.org \
    --cc=akrl@sdf.org \
    --cc=andrewjmoreton@gmail.com \
    /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.