Monday, June 9, 2014

Re: Apparent bug with file upward-search on Windows

On Monday, June 9, 2014 10:15:19 AM UTC-5, Ben Fritz wrote:
> On Sunday, June 8, 2014 2:16:03 PM UTC-5, Brett Stahlman wrote:
> > Hello,
> > I've read the section on upward search (:help file-searching), and believe I
> > understand how it's supposed to work. The example in the help works the way I
> > expect on Linux, but not on Windows.
> >
> > Specifically, I created the following set of files and directories to match
> > the example from the help:
> >
> > C:/Users/stahlmanb/tmp/u/user_x/work/release/test.c
> > C:/Users/stahlmanb/tmp/u/user_x/include/test.h
> >
> > Note: To make things work on Windows, I've simply replaced Linux `/' with the
> > following Windows path: C:/Users/stahlmanb/tmp/
> >
> > Then, within Vim...
> > cd C:/Users/stahlmanb/tmp/u/user_x/work/release
> > e test.c
> > set path=include;C:/Users/stahlmanb/tmp/u/user_x
> >
> > Hitting gf with the cursor positioned on test.h (inside test.c) produces...
> > E447: Can't find file "test.h" in path
> >
>
> I also get this behavior on Windows in 7.4.292; likewise :find errors and tab-completion of :find just beeps.
>
> I tried omitting the "C:", and also adding a trailing "/" character, because of this statement in :help 'path': "A directory name may end in a ':' or '/'."
>
> Neither change made any difference.
>
> I think the problem is that u/user_x/work/release/include directory did not exist.
>
> When I create that directory, the upward search works to find ../../include/test.h.
>
> I think the relative path given as the search directory prior to the stop directories, actually needs to exist.
>
> I'm not sure whether this is documented, or even intentional.

Yep. It works that way for me too. I'm thinking this pretty much confirms it to be a bug - not only because it works differently on Linux, but also because it's difficult to conceive of a rationale for the Windows behavior, which seems to be, "Search upwards for an 'include' directory containing file "test.h", if and only if the current directory contains an 'include' directory that *doesn't* contain a file named "test.h" (since if cwd contains test.h, the upward search is skipped).

I also wondered whether it could be a bug that has something to do with the Windows-specific characters in the absolute path...

Thanks,
Brett Stahlman

--
--
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.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment