Nazri Ramliy wrote:
> On Fri, Mar 6, 2009 at 10:09 AM, Nazri Ramliy <[email protected]> wrote: > > On Thu, Mar 5, 2009 at 11:07 AM, Bram Moolenaar <[email protected]> wrote: > >> Cycles in symbolic links are rare. The code should be able to handle > >> this, in a way that it doesn't drop all results that contain a symbolic > >> link. Thus symbolic links should be followed, unless getting to a > >> directory that was previously visited. > > [snip] > > >> Anyway, the patch adds a lot of code. I'm wondering if we can reuse > >> more of the existing code. How about using globpath()? Or use > >> find_file_in_path(), like ex_find() does (also accepting directories > >> though). The last one also takes care of removing duplicates. > >> > >> If your code is to be used, the chdir() calls are not safe. Look at the > >> mch_FullName() function in os_unix.c, lots of remarks about this. > >> Yet another reason to use as much of the existing code, that has been > >> debugged for a long time, instead of introducing new code which new > >> problems. > > [snip] > > >> Also, the functions potentially take a lot of time, so they should check > >> for CTRL-C now and then. That means calling ui_breakcheck() and > >> checking the got_int flag. > > [snip] > > > There's a couple more issues that I found out while using :find with the > > patch: > > > > 1. It doesn't honor the 'wildignore' setting in cases where there > > are more than one files matching the pattern and at least one of > > them would be excluded by 'wildignore'. The current behavior is > > that it will list all the files that match the pattern whether or > > not it matches 'wildignore'. > > > > 2. Doing :find a/*/hello.html gets uniquefied to hello.html, which > > may not be what we want as there might be other hello.html in > > 'path'. The solution to this might be to uniquefy the name based > > on the pattern, not by the fullpath alone. > > Here's the updated patch with all the above issues addressed: > > 1. Cycle resulting from symbolic links - I'm using globpath() and it > seems that this is no longer an issue anymore. > > 2. No more chdir() calls. > > 3. Call to ui_breakcheck() is done and got_int flag is checked > accordingly. > > 4. wildignore setting is already handled by globpath() > > 5. uniquefy_paths() uniquefies and shortens the fullpaths based on the > given pattern. Please check up on the FIXME note that I added in the > patch. > > If anyone could test the patch on other OS that would be great. I've > tested it on my linux and all seemed well. Thanks! I'll look into it later. -- In his lifetime van Gogh painted 486 oil paintings. Oddly enough, 8975 of them are to be found in the United States. /// Bram Moolenaar -- [email protected] -- http://www.Moolenaar.net \\\ /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\ \\\ download, build and distribute -- http://www.A-A-P.org /// \\\ help me help AIDS victims -- http://ICCF-Holland.org /// --~--~---------~--~----~------------~-------~--~----~ You received this message from the "vim_dev" maillist. For more information, visit http://www.vim.org/maillist.php -~----------~----~----~----~------~----~------~--~---
