[vim/vim] MS-Windows: "*.vim" also matches files with a longer extension (PR #20899)
h_east (Vim Github Repository) <[email protected]> Fri, 31 Jul 2026 12:24:50 -0700
| Newsgroups | gmane.editors.vim.devel |
|---|---|
| Message-ID | <vim/vim/pull/[email protected]> |
```
Problem: On MS-Windows a pattern like "path/*.vim" also matches files such
as "foo.vim9", because the 8.3 short name "FOO~1.VIM" is used for
matching as well. These files are then sourced.
Solution: Only match against the short name when the pattern contains a '~'.
```
---
This was in todo.txt, the entry is removed.
On MS-Windows, with a directory containing "bar.vim", "foo.vim9" and
"foo.vimx" on a volume where 8.3 short names are created:
glob('plugin/*.vim') -> bar.vim, foo.vim9, foo.vimx
:runtime! plugin/*.vim -> all three are sourced
The short name of "foo.vim9" is "FOO~1.VIM", which matches "*.vim", and
dos_expandpath() matches the pattern against both the long and the short
name. The only guard was for names ending in `'~'`.
With this change the short name is only used when the pattern contains a
'~', which is how the function already recognizes a short name, see the
comment about "a wildcard or a ~1" at the top. Both now find only
"bar.vim", while a pattern that is a short name still matches:
glob('FOO~1.VIM') -> foo.vim9
The test skips when the volume does not create short names, checked with
":p:8".
You can view, comment on, or merge this pull request online at:
https://github.com/vim/vim/pull/20899
-- Commit Summary --
* MS-Windows: "*.vim" also matches files with a longer extension
-- File Changes --
M runtime/doc/todo.txt (4)
M src/filepath.c (8)
M src/testdir/test_shortpathname.vim (22)
-- Patch Links --
https://github.com/vim/vim/pull/20899.patch
https://github.com/vim/vim/pull/20899.diff
--
Reply to this email directly or view it on GitHub:
https://github.com/vim/vim/pull/20899
You are receiving this because you are subscribed to this thread.
Message ID: <vim/vim/pull/[email protected]>
--
--
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
---
You received this message because you are subscribed to the Google Groups "vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
To view this discussion visit https://groups.google.com/d/msgid/vim_dev/vim/vim/pull/20899%40github.com.