On 04/29/2023 3:37 PM, Stan Brown wrote:


Stan Brown
Tehachapi, CA, USA
https://BrownMath.com

On 2023-04-29 08:28, Mike wrote:
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.

Mike, I saw someone answered this, but maybe their answer didn't reach you?

Short version: Windows is doing what it's supposed to, and so is Vim.

Just out of curiosity, I tried the same with python and tcl. Neither returns multiple files for the *.abc case so their behavior is different. I don't know why it differs but I would argue that their outputs do a better job of "meeting expectations".

Perhaps this is an issue I should raise with the vim developers for the following reasons. First, the Windows outputs are inconsistent with the linux outputs for the same directory contents. Second, it appears that vim is using this glob capability when sourcing plugins (I first noticed this using packadd) and so unwanted files could be sourced on Windows systems.


 stuff snipped



--
--
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+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/vim_use/u2r9ob%2416j2%241%40ciao.gmane.io.

Reply via email to