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!

--Adnan

-- 
-- 
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.


Attachment: glob-escape-fix.patch
Description: Binary data

Raspunde prin e-mail lui