[vim/vim] MS-Windows: "*.vim" also matches files with a longer extension (PR #20899)

2 views
Skip to first unread message

h_east

unread,
3:25 PM (7 hours ago) 3:25 PM
to vim/vim, Subscribed
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

  • 4e8feab MS-Windows: "*.vim" also matches files with a longer extension

File Changes

(3 files)

Patch Links:


Reply to this email directly, view it on GitHub, or unsubscribe.
Triage notifications, keep track of coding agent tasks and review pull requests on the go with GitHub Mobile for iOS and Android. Download it today!
You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/20899@github.com>

Reply all
Reply to author
Forward
0 new messages