Subject: Re: bug#78306: [PATCH] Skip the non-exists path when loading a file on Windows

From: Lin Sun <[email-masked]>
Date: Thu, 8 May 2025 14:46:42 +0000

Hi Eli, Stefan, Michael,

Thanks for all your comments that let me research more on this this patch, and the non-exists dir in path is not a bug, it do has risk on behavior changing, so this patch should not to be applied.   Removing non-exists dir from load-path is better way.

From: Eli Zaretskii <[email-masked]>
Sent: Thursday, May 8, 2025 05:44 AM
> Thanks, but I'm against this change.  faccessat is a general-purpose
> function, so changing the errno it returns on Windows will affect a
> lot of places in Emacs, with consequences we cannot predict.

The errno was used on function file_directory_p after sys_faccessat for windows, other cases only use its return value. 

> If you want to skip directories that don't exist, or exist as files
> that are non-directories, IMO the right way is to modify the loop in
> openp such that in the following snippet:
....
> ... (We
> should also consider how likely it is that load-path will include
> non-directories or directories that don't exist.)

Yes, should check why non-exists dir in the load-path.

From: Michael Albinus <[email-masked]>
Sent: Thursday, May 8, 2025 07:38 AM
> I don't know whether the snippet above is also relevant for remote
> files. If yes, adding a call of file-accessible-directory-p might
> influence performance.

File related APIs on windows is slow, it will influence the perormance.

From: Stefan Monnier <[email-masked]>
Sent: Thursday, May 8, 2025 01:13 PM
> You don't say why you think it's a problem.  It's been doing that for
> decades, and it's quite common to have a non-existing directory in
> `load-path` (e.g. the `<ROOT>/share/emacs/<VERSION>/site-lisp` if you're
> running Emacs "in place") yet it's never been seen as a problem.

I use a emacs distribution which contains several non-exists dirs in the load-path, and I found the issue by investigate its performance; no bug related to this, just for performance concern. 

Please feel free to close this ticket. Thank you!