Subject: bug#60996: 29.0.60; Native compile fails to remove temp file for trampoline

From: Andrea Corallo <[email-masked]>
Date: Mon, 23 Jan 2023 17:04:30 +0000

Andy Moreton <[email-masked]> writes:

> On Sun 22 Jan 2023, Eli Zaretskii wrote:
>
>>> Date: Sat, 21 Jan 2023 22:12:10 +0000
>>> From: Andy Moreton <[email-masked]>
>>> 
>>> Recently emacs 29 (and master) has started showing an error and
>>> backtrace during startup:
>>> 
>>> Debugger entered--Lisp error: (permission-denied "Removing old name" 
>>> "Permission denied" "c:/Users/ajm/AppData/Local/Temp/comp-lambda-MTAMbr...")
>>> delete-file("c:/Users/ajm/AppData/Local/Temp/comp-lambda-MTAMbr...")
>>
>> We need a reproducible recipe to investigate this, or results of such
>> investigation by you: which code has the file open when we try
>> deleting it, and why that other code has it open?
>>
>> For a recipe, it should be enough to present a minimal init file which
>> causes the problem (but pleased make it really minimal: as few lines
>> as strictly needed for reproduction)
>
> It may take considerable time and effort to reduce my init file down to a
> simple reproducer...
>
>> Btw, "comp-lambda-MTAMbr..." seems to tell that it's some part of
>> comp.el, which sounds strange: comp.el is supposed to be
>> natively-compiled during the build, and that includes the trampolines
>> for it.  Hmm...
>
> The backtrace always seems to contain:
>
>   delete file("path/to/comp-lambda-XXXXX.eln")
>   comp--native-compile((lambda (...) ...))
>   comp-trampoline-compile(function-name)
>   comp-subr-trampoline-install(function-name)
>   advice--add-function(...)
>   advice-add(function-name ...)
>
> So it looks very much like compiling trampolines is involved.

Hello all,

yes I confirm that's a trampoline compilation.  The file starts with
"lambda" as the mechanism is the same used for compiling function not
not defined in source files.

  Andrea