GNU bug report logs -
#78306
[PATCH] Skip the non-exists path when loading a file on Windows
Previous Next
Reported by: Lin Sun <sunlin7 <at> hotmail.com>
Date: Thu, 8 May 2025 00:25:02 UTC
Severity: normal
Tags: patch
Done: Eli Zaretskii <eliz <at> gnu.org>
Bug is archived. No further changes may be made.
Full log
View this message in rfc822 format
> From: Michael Albinus <michael.albinus <at> gmx.de>
> Cc: Lin Sun <sunlin7 <at> hotmail.com>, 78306 <at> debbugs.gnu.org, Stefan Monnier
> <monnier <at> iro.umontreal.ca>
> Date: Thu, 08 May 2025 09:38:15 +0200
>
> Eli Zaretskii <eliz <at> gnu.org> writes:
>
> > FOR_EACH_TAIL_SAFE (path)
> > {
> > ptrdiff_t baselen, prefixlen;
> >
> > if (EQ (path, just_use_str))
> > filename = str;
> > else
> > filename = Fexpand_file_name (str, XCAR (path));
> > if (!complete_filename_p (filename))
> > /* If there are non-absolute elts in PATH (eg "."). */
> > /* Of course, this could conceivably lose if luser sets
> > default-directory to be something non-absolute... */
> > {
> > filename = Fexpand_file_name (filename, BVAR (current_buffer, directory));
> > if (!complete_filename_p (filename))
> > /* Give up on this path element! */
> > continue;
> > }
> >
> > we verify that 'XCAR (path)' (and possibly also the current buffer's
> > default-directory') is an accessible directory, e.g. by using
> > file-accessible-directory-p. This might benefit Posix platforms as
> > well, but we should benchmark the results before we decide. (We
> > should also consider how likely it is that load-path will include
> > non-directories or directories that don't exist.)
> >
> > Btw, did you benchmark the result of your proposed patch, and if so,
> > what is the speedup from this change?
>
> 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.
It could, yes. In which case, depending on the speedups we measure in
local cases, we could only do this for local directories, or maybe
even only on MS-Windows.
This bug report was last modified 47 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.