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

:UpdateActivatedAddons fails with updating vim-addon-manager-known-repositories #109

Closed Massimo-B closed 11 years ago

Massimo-B commented 11 years ago

Hi,

my plugin_root_dir is /etc/vim/vim-addons. If there is no vim-addon-manager-known-repositories the update works. But if vim-addon-manager-known-repositories already exists it fails:

Considering vim-addon-manager-known-repositories for update
Plugin: vim-addon-manager-known-repositories
Home page: https://github.com/MarcWeber/vim-addon-manager-known-repositories
Source URL: http://github.com/MarcWeber/vim-addon-manager-known-repositories/tarball/master (type archive)
archive_name: 'vim-addon-manager-known-repositories-tip.tar.gz'
Target: /etc/vim/vim-addons/vim-addon-manager-known-repositories
Origin: archive http://github.com/MarcWeber/vim-addon-manager-known-repositories/tarball/master
Install plugin `vim-addon-manager-known-repositories'?
[Y]es, (N)o: 
Y
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100   178  100   178    0     0    778      0 --:--:-- --:--:-- --:--:--   784
100   161  100   161    0     0    227      0 --:--:-- --:--:-- --:--:--  1219
100  181k  100  181k    0     0  80322      0  0:00:02  0:00:02 --:--:--  229k
Press ENTER or type command to continue

Press ENTER or type command to continue

Press ENTER or type command to continue

Press ENTER or type command to continue
curl: (37) Couldn't open file /etc/vim/vim-addons/vim-addon-manager-known-repositories-

shell returned 37

Press ENTER or type command to continue
gzip: /etc/vim/vim-addons/vim-addon-manager-known-repositories/archive/vim-addon-manager-known-repositories-tip.tar.gz: No such file or directory

shell returned 1

Press ENTER or type command to continue
tar: /etc/vim/vim-addons/vim-addon-manager-known-repositories/archive/vim-addon-manager-known-repositories-tip.tar: Cannot open: No such file or directory
tar: Error is not recoverable: exiting now

shell returned 2

Press ENTER or type command to continue
Error detected while processing function vam#install#Update..vam#install#UpdateAddon..vam#install#RunHook..vam#install#CreatePatch..vam#install#Checkout..vam#utils#Unpack..vam#utils#Unpac
k..vam#utils#ExecInDir..<SNR>52_Cmd:
line   11:
E605: Exception not caught: Command “cd '/etc/vim/vim-addons/vim-addon-manager-known-repositories' && tar -xf '/etc/vim/vim-addons/vim-addon-manager-known-repositories/archive/vim-addon-m
anager-known-repositories-tip.tar'” exited with error code 2
Error detected while processing function vam#install#Update..vam#install#UpdateAddon..vam#install#RunHook..vam#install#CreatePatch..vam#install#Checkout..vam#utils#Unpack..vam#utils#Unpac
k..vam#utils#ExecInDir:
line   15:
E171: Missing :endif
Error detected while processing function vam#install#Update..vam#install#UpdateAddon..vam#install#RunHook..vam#install#CreatePatch..vam#install#Checkout..vam#utils#Unpack..vam#utils#Unpac
k:
line   80:
E171: Missing :endif
Error detected while processing function vam#install#Update..vam#install#UpdateAddon..vam#install#RunHook..vam#install#CreatePatch..vam#install#Checkout..vam#utils#Unpack:
line   68:
E171: Missing :endif
Error detected while processing function vam#install#Update..vam#install#UpdateAddon..vam#install#RunHook..vam#install#CreatePatch..vam#install#Checkout:
line   24:
E171: Missing :endif
Error detected while processing function vam#install#Update..vam#install#UpdateAddon..vam#install#RunHook..vam#install#CreatePatch:
line   32:
E171: Missing :endif
Error detected while processing function vam#install#Update..vam#install#UpdateAddon..vam#install#RunHook:
line    5:
E170: Missing :endfor
Error detected while processing function vam#install#Update..vam#install#UpdateAddon:
line   54:
E171: Missing :endif
Error detected while processing function vam#install#Update:
line    4:
E171: Missing :endif

Afterwards it looks like this:

$ ls -ald /etc/vim/vim-addons/*known*
drwxr-xr-x 3 root root 4,0K Jan 18 13:17 /etc/vim/vim-addons/vim-addon-manager-known-repositories/
drwxr-xr-x 8 root root 4,0K Jan 18 13:17 /etc/vim/vim-addons/vim-addon-manager-known-repositories-?/

I can't find why this path is created. Maybe due to my proxy adaption as proposed in your docs:

fun! SetupVAM()
     let g:vim_addon_manager = {'scms': {'git': {}}}
     fun! MyGitCheckout(repository, targetDir)
         let a:repository.url = substitute(a:repository.url, '^git://github', 'http://github', '')
         return vam#utils#RunShell('git clone --depth=1 $.url $p', a:repository, a:targetDir)
     endfun
     let g:vim_addon_manager.scms.git.clone=['MyGitCheckout']
"...
MarcWeber commented 11 years ago

In order to reproduce an error there is one thing you have to provide: your .vimrc. Contact me by irc or mail so that I can reproduce your issues on my virtual server. We'll find a fix fast then.

ZyX-I commented 11 years ago

@MarcWeber Try checking it out without git in $PATH.

@Massimo-B

my plugin_root_dir is /etc/vim/vim-addons.

a) Why?

b) Do you have permissions to write there (you should not unless you are working under root and you must not work under root as there are security issues in this case)?

I see everything is going fine until

curl: (37) Couldn't open file /etc/vim/vim-addons/vim-addon-manager-known-repositories-

. Much likely this is meaning that you don’t have permissions to write to /etc/vim/vim-addons. Using VAM with plugin_root_dir set to not writable directory won’t ever be supported.

c) Why Github does not autocomplete your name when using @Mass…

Massimo-B commented 11 years ago

a) Why not. I like to have a global VAM installation. I thought about setting my rtp to /usr/loca/share/vim or something. But then the global custom vimrc for gentoo is /etc/vim/vimrc.local so I put the add-ons there. Shouldn't matter.

b) I have. I would only Update the addons as root. The user should only have "read-only" access. For this issue here, the user is not involved. If this is going to work for users and if users vim add-ons are going to write there, I need to figure out...

$ ls -al /etc/vim/vim-addons
total 84K
drwxr-xr-x 21 root root 4,0K Jan 18 13:37 ./
drwxr-xr-x  4 root root 4,0K Jan 18 13:21 ../
drwxr-xr-x  7 root root 4,0K Jan 16 16:21 bash-support/
drwxr-xr-x  4 root root 4,0K Jan 18 13:24 BlockDiff/
drwxr-xr-x  9 root root 4,0K Jan 18 13:32 c%213/
drwxr-xr-x  8 root root 4,0K Jan 18 13:32 clang_complete/
drwxr-xr-x  4 root root 4,0K Jan 18 10:21 Distinguished/
drwxr-xr-x  5 root root 4,0K Jan 16 16:07 matchit.zip/
drwxr-xr-x  8 root root 4,0K Jan 16 16:26 perl-support/
drwxr-xr-x  7 root root 4,0K Jan 18 10:15 Powerline/
drwxr-xr-x  9 root root 4,0K Jan 17 16:19 snipmate/
drwxr-xr-x  4 root root 4,0K Jan 18 13:32 snipmate-snippets/
drwxr-xr-x  5 root root 4,0K Jan 18 13:23 SuperTab%1643/
drwxr-xr-x  5 root root 4,0K Jan 18 13:32 taglist/
drwxr-xr-x  7 root root 4,0K Jan 18 13:31 The_NERD_tree/
drwxr-xr-x  9 root root 4,0K Jan 18 13:10 tlib/
drwxr-xr-x  7 root root 4,0K Jan 16 14:27 vim-addon-manager/
drwxr-xr-x  3 root root 4,0K Jan 18 13:32 vim-addon-manager-known-repositories/
drwxr-xr-x  8 root root 4,0K Jan 18 13:32 vim-addon-manager-known-repositories-?/
drwxr-xr-x  5 root root 4,0K Jan 18 13:32 vim-addon-mw-utils/
drwxr-xr-x  4 root root 4,0K Jan 16 16:06 xml/
ZyX-I commented 11 years ago

I cannot reproduce the issue when using non-git VAM-kr URL, it checkouts fine. Thus you need to check whom are you launching update from, error 37 means “FILE couldn't read file. Failed to open the file. Permissions?” (though on my system attempt to write to read-only directory returns error 23 “Write error. Curl couldn't write data to a local filesystem or similar.”). Though it is strange, it should’ve failed earlier (when creating new directory) if you did not have right permissions. Is it possible that something drops privileges of curl?

By the way,

I can't find why this path is created. Maybe due to my proxy adaption as proposed in your docs:

It is to preserve local changes, see :h VAM-do_diff and :h VAM-hooks.

ZyX-I commented 11 years ago

Though it looks like it is being downloaded fine and without warnings (like “Failed to create the file /etc/tty”). Another idea: do you have enough space on device holding /etc?

MarcWeber commented 11 years ago

Massimo-B modified the VAM code always using the !executable('git') branch int vam.vim line 82. Thus this might be turned into a bug "why does updating VAM not work if you pretend to not have git". If somebody has this issue - I'll work on it. I'm lazy for now.

ZyX-I commented 11 years ago

@MarcWeber Did I miss @Massimo-B posting his dotfiles? Anyway, it must work with both sources defined near line 82. In fact it works on my system, I don’t have much ideas how he could make it fail halfway with such weird message.

MarcWeber commented 11 years ago

No, I talked to him by irc. Anyway, can be closed now