[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Finalizing 'inhibit-automatic-native-compilation'

From: Andrea Corallo
Subject: Re: Finalizing 'inhibit-automatic-native-compilation'
Date: Mon, 20 Feb 2023 16:07:59 +0000
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux)

Stefan Monnier <monnier@iro.umontreal.ca> writes:

>>> `make-temp-name` uses `O_EXCL | O_CREAT` so as to close the race
>>> condition: if someone predicated the filename, we detect it atomically
>>> and we try again.
>>> You might like to check
>>> https://wiki.sei.cmu.edu/confluence/display/c/FIO21-C.+Do+not+create+temporary+files+in+shared+directories
>> Thanks for the pointer.
>> I'm still not really convinced we have a problem here with trampolines.
>> With `make-temp-file' we are really only choosing the filename and
>> suggesting it to libgccjit, this last one will perform the file
>> creation.
> The important part is the use of `O_EXCL | O_CREAT` when creating
> the file.
> *BUT* `O_EXCL | O_CREAT` will fail if the file already exists.  Which is
> why `make-temp-file` needs `make-temp-name` to generate new names until
> we find one that really doesn't exist (not just at the time
> `make-temp-name` is called but the fraction of a millisecond later when
> we do try to create it).

We can't use this loop, we tipically pass a filename to be used to
libgccjit and we have no control after (also see my last comment).

>> I'd be surprised if GCC does not handle this correctly, and
>> in case shouldn't this be a GCC bug?
> I'd be surprised.

Surprised if it does or does not?

> If you tell it to write to a pre-existing file, does
> it fail with an error?

I believe it does not.

> If not, then I think it can't be used safely unless
> *you* pre-create the file (e.g. with `make-temp-file`).

Are we sure?

Also if I pre-create the file with make-temp-file can't someone just
replace it even more easily with the infamous link before libgccjit
comes in?



reply via email to

[Prev in Thread] Current Thread [Next in Thread]