Adnan Zafar wrote:

> Hi vim_dev!
> 
> Consider the following commands (globpath is used but the same happens
> with glob):
> 
> :echo globpath(&rtp, '{')
> :echo globpath(&rtp, '\{')
> :echo globpath(&rtp, '{*')
> :echo globpath(&rtp, '\{*')
> 
> The first command returns correct results, but it shells out on Unix
> and that can be slow. The second doesn't shell out, but it returns all
> possible results instead of only those that exist. The third and
> fourth both return correct results but both also shell out. Similar
> situations happen with backticks, single quotes, and dollar signs.
> 
> The attached patch both (I hope) ensures glob and globpath only return
> files that exist, and additionally it no longer shells out when one of
> these characters is escaped with a backslash. Instead of calling
> mch_expand_wildcards from gen_expand_wilcdards whenever one of these
> characters is simply present in the glob, it checks whether or not the
> character is escaped first.
> 
> This is my first time poking around Vim's source, and my C is rusty. I
> hope I did everything correctly. Thanks, everyone, for all the work
> you do on Vim!

Thanks.  This is tricky stuff, can you please add a test?
One that partly fails before this patch.
I know that's not easy, but manually testing this is also
not a good idea.
It's OK if the test only works on Unix.

-- 
hundred-and-one symptoms of being an internet addict:
55. You ask your doctor to implant a gig in your brain.

 /// 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/groups/opt_out.


Raspunde prin e-mail lui