MarcWeber / vim-addon-manager

manage and install vim plugins (including their dependencies) in a sane way. If you have any trouble contact me. Usually I reply within 24 hours
Other
660 stars 59 forks source link

Check if p expansion is results in valid string #122

Closed joninvski closed 11 years ago

joninvski commented 11 years ago

If the downloaded file is a zip file, the expand function of the zip file path sometimes gave a empty string.

This happened in vim version 7.3.

It happened on YankRing plugin for example.

This code, checks if the expanded path string is empty. If it is, it uses the non expanded string.

MarcWeber commented 11 years ago

Can you tell us which expand input yields an empty string ? I can install YankRing without problems. Which OS are you using?

Eg try to reproduce it by

:echo expand('some stringc')

yielding "". I'm interested in that 'some string'. Thanks for providing feedback.

Marc Weber

joninvski commented 11 years ago

In both my systems. Debian and mint, vim 7.2 and 7.3

:echom expand('.zip') gives an empty string.

In concrete installing Yankring with VAM gives this in line 58 of utils.vim: p value -> /home/jtrindade/.vim/vim-addons/YankRing/archive/yankring_170.zip fnameescape(p) value -> /home/jtrindade/.vim/vim-addons/YankRing/archive/yankring_170.zip expand(fnameescape(p)) value -> (nothing)

That's why I suggested the pull request

On Fri, Jun 7, 2013 at 7:13 PM, Marc Weber notifications@github.com wrote:

Can you tell us which expand input yields an empty string ? I can install YankRing without problems. Which OS are you using?

Eg try to reproduce it by

:echo expand('some stringc')

yielding "". I'm interested in that 'some string'. Thanks for providing feedback.

Marc Weber

— Reply to this email directly or view it on GitHubhttps://github.com/MarcWeber/vim-addon-manager/pull/122#issuecomment-19123700 .

João Trindade trindade.joao@gmail.com Researcher at INESC-ID - Communications Network Mobility Group Mobile phone: +351 93 561 39 10 http://cnm.tagus.inesc-id.pt/joao+trindade

MarcWeber commented 11 years ago

bairui told me about your short chat @ #vim which I then found in my logs.

Which operating system are you using? It looks like you're the only one obseving this behaviour.

AFAIK we're using expand because it normalizes / \ for all operating systems. We don't care that much about expanding any sepcial chars.

So maybe the true fix is to stop using expand for this purpose.

Anyway before I take action I'd like to understand what's going on.

Can you try this?

:echo map(['.zip','.zi','.z','.','/z9c','file-does-not-exist'], 'expand(v:val)')

and paste the result? Quoting you:

just reduced the original string to the bare to show the error
. I just reduced the original string to the bare to show the error

So I wonder why you stopped at '.zip' when reducing?

Marc Weber

joninvski commented 11 years ago

Hi

On Fri, Jun 7, 2013 at 11:46 PM, Marc Weber notifications@github.comwrote:

bairui told me about your short chat @ #vim which I then found in my logs.

Which operating system are you using? It looks like you're the only one obseving this behaviour.

Mint 13 and Debian 6.0

I tried in bash and zsh

But yes, it is starting to look as it is an error of something I configure on my PCs.

AFAIK we're using expand because it normalizes / \ for all operating systems. We don't care that much about expanding any sepcial chars.

So maybe the true fix is to stop using expand for this purpose.

Anyway before I take action I'd like to understand what's going on.

Can you try this?

:echo map(['.zip','.zi','.z','.','/z9c','file-does-not-exist'], 'expand(v:val)')

Result is: ['', '.zi', '.z', '.', '/z9c', 'file-does-not-exist']

and paste the result? Quoting you:

just reduced the original string to the bare to show the error . I just reduced the original string to the bare to show the error

So I wonder why you stopped at '.zip' when reducing?

This only happens if the string has exactly the .zip substring.

Just a note: If i run vim with --noplugin flag exactly the same happens

Marc Weber

— Reply to this email directly or view it on GitHubhttps://github.com/MarcWeber/vim-addon-manager/pull/122#issuecomment-19137032 .

João Trindade trindade.joao@gmail.com Researcher at INESC-ID - Communications Network Mobility Group Mobile phone: +351 93 561 39 10 http://cnm.tagus.inesc-id.pt/joao+trindade

MarcWeber commented 11 years ago

Use such to run vim in a "clean" way: vimClean () { vim -u NONE -U NONE -N "$@"; }

My :shell setting is zsh, and it still works as expected.

I've tried stracing vim (getpid), but the only thing vim did was statting '.zip'

On your system try:

Can you find a case which works as expected this way? There is not much more which comes to my mind.

joninvski commented 11 years ago

It worked perfectly with vimClean()

With this in mind I went looking in my vimrc and saw that .zip was used in wildignore.

If I take it out then expand runs correctly.

This is a bug right? The documentation of expand does not seem to indicate this behavior.

Thanks for all the help!

On Sat, Jun 8, 2013 at 12:20 AM, Marc Weber notifications@github.comwrote:

Use such to run vim in a "clean" way: vimClean () { vim -u NONE -U NONE -N "$@"; }

My :shell setting is zsh, and it still works as expected.

I've tried stracing vim (getpid), but the only thing vim did was statting '.zip'

On your system try:

  • env -i =vim -u NONE -U NONE -N (assuming you're using zsh) These are less likely to make a difference:
  • Retry from a different "current directory"
  • retry as new user/ or root?

Can you find a case which works as expected this way? There is not much more which comes to my mind.

— Reply to this email directly or view it on GitHubhttps://github.com/MarcWeber/vim-addon-manager/pull/122#issuecomment-19138104 .

João Trindade trindade.joao@gmail.com Researcher at INESC-ID - Communications Network Mobility Group Mobile phone: +351 93 561 39 10 http://cnm.tagus.inesc-id.pt/joao+trindade