Ingo Karkat wrote:
> >> Hello Vim developers,
> >>
> >> I just noticed a regression when using a custom command's
> >> complete function that is file-based. When I do :echo
> >> glob('dir/*/'), I expect the result to only include directories,
> >> because of the trailing "/" path separator (same when using "\"
> >> btw.), but in recent Windows builds, it also includes *all
> >> files*. For example, from the Vim repository root dir, I get:
> >>
> >> ,----[ bad ]---- | src\arabic.c\ | src\arabic.h\ | src\ascii.h\ |
> >> src\auto\ | src\bigvim.bat\ | ... `----
> >>
> >> instead of
> >>
> >> ,----[ good ]---- | src\auto\ | ... `----
> >>
> >> With this command:
> >>
> >> src\vim.exe -N -u NONE -c "if len(glob('src/*/',0,1)) > 20 |
> >> cquit | else | quit | endif"
> >>
> >> I've bisected this problem to the following patch:
> >>
> >> ,----[ bad change ]---- | 7.3.1182 'backupcopy' default on
> >> MS-Windows does not work for links `----
> >>
> >> I still see this in the latest 7.4.295 (HUGE build, using
> >> Make_mvc.mak with the Windows SDK 7.1 compiler) on Windows/x64.
> >> No problems on Linux.
> >
> > Can you do some debugging to find out what part of that patch
> > causes this? Perhaps one of the ways to expand a file name removes
> > the trailing slash? Considering the output above, it looks like
> > the slash is added back afterwards, also after normal files.
>
> I've finally found the problem and a possible fix. The root cause is
> that patch 7.3.1182 replaces the implementation of mch_getperm() in
> os_win32.c that uses the native GetFileAttributes() with a call to
> mch_stat(). That one (in vim_stat() from os_mswin.c) is documented to
> remove a trailing path separator. dos_expandpath() just checks for a
> successful stat() call, so it now accepts files just as well as
> directories.
>
> When reverting mch_getperm() to the previous implementation, the
> problem is gone, but I guess the change was done for a reason :-)
> While attempting to add filtering for actual directories, I happened
> upon a related comment "On Solaris stat() accepts "file/" as if it was
> "file"." in macros.h, and it appeared to me that applying the
> illegal_slash() function (adapted for Windows by also checking for a
> backslash) to the mch_stat() macro is the correct solution.
>
> Attached is a patch and a test for the problem.
Thanks. I'll look into it later.
--
Well, you come from nothing, you go back to nothing... What have you
lost? Nothing!
-- Monty Python: The life of Brian
/// Bram Moolenaar -- [email protected] -- http://www.Moolenaar.net \\\
/// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\ an exciting new programming language -- http://www.Zimbu.org ///
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///
--
--
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].
For more options, visit https://groups.google.com/d/optout.