-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA512

On March 5, 2015 3:36:26 PM EAT, Bram Moolenaar <[email protected]> wrote:
>
>ZyX wrote:
>
>> Try the following code:
>>
>>     echo "echomsg 42" > '$HOME'
>>     vim -u NONE -i NONE -S '$HOME'
>>
>> . It will show “E484: Can't open file /home/zyx”, while it should
>just
>> echo 42. Worse things will happen if file happens to contain pipe: as
>> `-S …` is translated to `so …` without escaping anything this will
>run
>> some commands.
>>
>> I think that instead `do_source` needs to be called directly on `-S`,
>> with another boolean value to disable expansion of anything.
>
>The order of execution is important, calling do_source() directly
>probably changes it.

Depends on implementation. If you add yet another list of arguments and process 
this separately then it will change. If you transform array of char* into array 
of structs (initial intention) which contain the kind of the argument and the 
argument itself then it will not.

>
>We could escape special characters in the argument, but that's easy to
>get wrong.  Perhaps it's time we add a command modifier that disables
>any wildcard expansion?  So it would be ":nowild so $HOME".

There is still a problem with ends_excmd and space characters. I suggested 
calling do_source directly because it is easier:

1. No code for escaping.
2. No code for allocating string.
3. No code for putting so and escaped string together.
4. No code for freeing allocated string.

>
>Note that on MS-Windows we do have to expand wildcards, since the shell
>doesn't do that for us.

I thought this is done on another layer. I also sometimes use tricks like

    vim -S foo.vim{,}

, expanding them in do_source breaks such tricks.

By the way, where %VARNAME% is being expanded on Windows? Expanding $HOME does 
not seem right, Windows convention is %HOME%. Current code will do expansions 
of $HOME because it uses Vim conventions.
-----BEGIN PGP SIGNATURE-----
Version: APG v1.1.1

iQI1BAEBCgAfBQJU+G77GBxaeVggPHp5eC52aW1AZ21haWwuY29tPgAKCRCf3UKj
HhHSviQQD/4mk13jdVclBySz5dATwE43vEZJCDgjpcYq9sK9rjXa6iDFBs2ziSDB
TKOEnGtnu3th+UwoOWmy9VvT0d7e11XW/hFZR3pB7A0hhZLZoyRmPPKou/lZvNGT
qdrgQmp3pgLywVapvd8cE61n8TelW3/IZQHgqUFF+5/yy/x/mIyGeACHebYVs6ck
U0opOzSSgll+9vscQSt+kI9Gg54o3bOXUftttWZnqKQkvrE3kHnXoiqV5BO9wJOv
QH+zlpVBcX3FmesZ8y70LIVf24Neae/zxPBH02Gsv89X3gPxMlOAEhU54aguArmH
Sy6K/42uh0FpLP7FirPnN+S8sZAcK3x8NyIaV+Bdn44pMzeCUROSgw9KctJh7RP9
p+lWQtExGHUXY9Yu2mbL5YVRdFj98HP47SBEM9Hjc5wpVZaTFfR6cGHn1nwVFT8Z
Py2nRENnrq7IMKygM+1VLsgVtwz0vSuaMaYxmVs1X2mby1ZoyeRASbcvwAr1WxD3
5rh+wix6nkdfwLnEqTWZq0kUOxWkhtgvr1uZGQ+fBtGaohn2bdPxo8booY0v1X9c
yKdn2hZfsEXSXjrdF7hXk174+uq6XiadZALsYCezMSoYwcdw9rpdpcZDCSzzsK/G
yd2J3zu33JCtjhnBhxpHopFcvIIR8TsB8pKfUbmck86e258T4Jc7QA==
=I0Ss
-----END PGP SIGNATURE-----

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

Raspunde prin e-mail lui