]> git.ipfire.org Git - thirdparty/vim.git/commit
patch 9.1.2104: readdirex() might be slow v9.1.2104
authorYasuhiro Matsumoto <mattn.jp@gmail.com>
Wed, 21 Jan 2026 20:29:53 +0000 (20:29 +0000)
committerChristian Brabandt <cb@256bit.org>
Wed, 21 Jan 2026 20:29:53 +0000 (20:29 +0000)
commite89d97aaea0e2e94e07e24271976d0a8d2e23c38
treece5ef03afd31abadaa93056c83a4658b2723215c
parent95bb4ef7d1b07591ae1a7d3616432bbbe6858dd1
patch 9.1.2104: readdirex() might be slow

Problem:  readdirex() might be slow (Mao-Yining)
Solution: Avoid double slash in path concatenation in
          create_readdirex_item() (Yasuhiro Matsumoto)

On Cygwin and MSYS2, // has a special meaning: it is treated as a prefix
for accessing network computers.
For example, //wsl$/ is used to access WSL.

In the current Vim implementation, the directory path passed to
readdirex() and the file name found during traversal are concatenated
using "/".
When the directory path already ends with /, this results in paths like:

  "/" + "/" + "$Recycle.Bin"

which produces a //-prefixed path. Such paths are interpreted as network
paths, so Vim ends up trying to retrieve the file size of a network
computer named $Recycle.Bin, which is not intended.

From a correctness perspective on Windows, file size retrieval should be
skipped for paths of the following forms:

 //host
 //host/share

However, as a first step, we should avoid generating // paths caused by
redundant / concatenation in the first place.

This change addresses this by preventing unnecessary / insertion when
constructing paths.

fixes:  #19188
closes: #19241

Signed-off-by: Yasuhiro Matsumoto <mattn.jp@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
src/fileio.c
src/version.c