Subject: Re: bug#73318: 31.0.50; with-native-compilation=aot breaks exec -a emacs

From: Spencer Baugh <[email-masked]>
Date: Tue, 17 Sep 2024 18:31:05 -0400

Eli Zaretskii <[email-masked]> writes:

>> From: Ship Mints <[email-masked]>
>> Date: Tue, 17 Sep 2024 15:22:18 -0400
>> Cc: [email-masked], [email-masked], [email-masked], 
>> 	[email-masked]
>> I think the kind of "unreliability" in question is, for example, when a process starts and unlinks itself. I doubt
>> Emacs will ever do this. Using the proc file system is "technically" unreliable, unable to cover 100% of all
>> potential cases, but is practically reliable, especially in this case.
>
> I don't remember the details, sorry.  You are welcome to look up the
> past discussions in the archives.  I think they were triggered by look
> up of the pdumper file, but the results of that are also used by the
> code which decides where to look for the *.eln files.

I looked up /proc/self/exe in the archives and the only mention is
https://lists.gnu.org/archive/html/emacs-devel/2019-05/msg00951.html

Gnulib uses /proc/self/exe to provide support for relocatability (in
progreloc.c).  If it's reliable enough for Gnulib, it should be reliable
enough for Emacs.

With all due humility, I think I personally am enough of an expert on
Linux minutiae to say that /proc/self/exe will be substantially more
reliable than using argv[0].

I can provide a patch to make invocation-directory use /proc/self/exe,
why don't we just try installing it on master?  If it's worse, we should
learn soon enough.