Saturday, April 29, 2023

Re: surprising glob() result on Windows

On 04/29/2023 10:51 AM, Mike wrote:
> On 04/28/2023 9:32 PM, Mike wrote:
>> Briefly, I have a case where glob("*.ext") returns more files than I
>> expect.
>>
>> To give an example, in a directory of your choice create two files
>> named "test.any" and "zest.anyother".  The important detail is that
>> the second filename's extension be prefixed by the first filename's
>> extension.
>>
>> Then launch Vim in that directory and run the command
>>     :echo glob("*.any")
>> Both files are returned, not just "test.any".
>>
>> I see this on Windows running vim 9.0.1240 with normal features built
>> with Visual C.  On the other hand, Vim on my linux box returns only
>> "test.any", as I would expect, so I don't think this a feature. :)
>
> I've since rebuilt Vim to include patches up to 1494 and still see the
> same results on my Windows 10 system.  I thought that patches 1400 and
> 1458 might help but they did not.

More potatoes for the stew.

Create 5 files: test.a, test.ab, test.abc, test.abcd and test.abcde.
Then, using gvim -u NONE -U NONE --noplugin or gvim --clean:
glob("*.a") returns test.a
glob("*.ab") returns test.ab
glob("*.abc") returns test.abc, test.abcd and test.abcde
glob("*.abcd") returns test.abcd

So the problem occurs when the glob pattern has a 3-character extension.

>
>>
>> Any comments?
>>
>> -mike
>>
>>
>
>


--
--
You received this message from the "vim_use" 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_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/vim_use/u2jd28%2417r6%241%40ciao.gmane.io.

No comments:

Post a Comment