Public bug reported:

The Ruby script addon-manager.rb contains an error in the code for the
remove command. This bug causes certain addons where the ~/.vim
directory is actually a symbolic link to another directory. This is the
case for the Vim R plugin, distributed as a Debian package here:

http://sites.google.com/site/jalvesaq/vimrplugin

Removal will fail because it attempts to invoke a rmdir on the
symbolically-linked ~/.vim file, which causes a Ruby exception.

Steps to reproduce the behavior:
1) Install vim-addon-manager
2) Install the Vim R plugin DEB package from 
http://sites.google.com/site/jalvesaq/vimrplugin
3) Move the ~/.vim folder to another location, such as ~/vimbak
4) Create a temporary folder ~/tmpvim
5) Create a symbolic link with "ln -s ~/tmpvim ~/.vim"
6) Run "vim-addons install r-plugin"
7) Run "vim-addons remove r-plugin"
8) Observe an error message like the following

Info: removing installed addon 'r-plugin' from /home/chris/.vim
/usr/lib/ruby/1.8/fileutils.rb:264:in `rmdir': Not a directory - 
/home/chris/.vim (Errno::ENOTDIR)
        from /usr/lib/ruby/1.8/fileutils.rb:264:in `rmdir'
        from /usr/lib/ruby/1.8/fileutils.rb:263:in `each'
        from /usr/lib/ruby/1.8/fileutils.rb:263:in `rmdir'
        from /usr/lib/ruby/1.8/vim/addon-manager.rb:68:in `remove'
        from /usr/lib/ruby/1.8/set.rb:194:in `each'
        from /usr/lib/ruby/1.8/set.rb:194:in `each_key'
        from /usr/lib/ruby/1.8/set.rb:194:in `each'
        from /usr/lib/ruby/1.8/vim/addon-manager.rb:80:in `remove'
        from /usr/lib/ruby/1.8/vim/addon-manager.rb:75:in `each'
        from /usr/lib/ruby/1.8/vim/addon-manager.rb:75:in `remove'
        from /usr/bin/vim-addons:264:in `send'
        from /usr/bin/vim-addons:264


The problem is that the while-loop on line 66 is written "while paths.size", 
which, in Ruby, will always evaluate to be true, because even the value "0" is 
considered true in Ruby. See:

http://ruby-doc.org/docs/Newcomers/ruby.html#boolean

Were it not for a fluke exception-handling within the loop, and
exception raising in the case when the ~/.vim directory is a symbolic
link, this would actually result in an infinite-loop. The loop should be
changed to "while paths.size > 0".

This bug affects the upstream Debian package of vim-addon-manager, too.

ProblemType: Bug
DistroRelease: Ubuntu 11.04
Package: vim-addon-manager 0.4.3
ProcVersionSignature: Ubuntu 2.6.38-8.42-generic 2.6.38.2
Uname: Linux 2.6.38-8-generic x86_64
NonfreeKernelModules: nvidia wl
Architecture: amd64
Date: Sat Jun 25 16:24:17 2011
InstallationMedia: Ubuntu 10.04 LTS "Lucid Lynx" - Release amd64 (20100429)
PackageArchitecture: all
ProcEnviron:
 LC_TIME=en_DK.UTF-8
 LANGUAGE=en_US:en
 PATH=(custom, user)
 LANG=en_US.UTF-8
 SHELL=/bin/bash
SourcePackage: vim-addon-manager
UpgradeStatus: Upgraded to natty on 2011-04-30 (56 days ago)

** Affects: vim-addon-manager (Ubuntu)
     Importance: Undecided
         Status: New


** Tags: apport-bug natty

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/802036

Title:
  remove command can fail for addons, contains possible infinite loop

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/vim-addon-manager/+bug/802036/+subscriptions

-- 
ubuntu-bugs mailing list
ubuntu-bugs@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to