remove command can fail for addons, contains possible infinite loop

Bug #802036 reported by Chris Lasher
10
This bug affects 1 person
Affects Status Importance Assigned to Milestone
vim-addon-manager (Debian)
Fix Released
Unknown
vim-addon-manager (Ubuntu)
Fix Released
Undecided
Unassigned
Lucid
Won't Fix
Undecided
Daniel T Chen
Maverick
Won't Fix
Undecided
Daniel T Chen
Natty
Won't Fix
Undecided
Daniel T Chen
Oneiric
Fix Released
Undecided
Unassigned

Bug Description

SRU Impact statement:

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.

Patch / Resolution:

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

The fixed version is already available in Oneiric (0.4.3ubuntu1), and the patch has been forwarded to Debian.

Patch for natty-proposed: https://bugs.launchpad.net/ubuntu/lucid/+source/vim-addon-manager/+bug/802036/+attachment/2221173/+files/vim-addon-manager_0.4.3ubuntu0.11.04.0.debdiff
Patch for maverick-proposed: https://bugs.launchpad.net/ubuntu/lucid/+source/vim-addon-manager/+bug/802036/+attachment/2221174/+files/vim-addon-manager_0.4.3ubuntu0.10.10.0.debdiff
Patch for lucid-proposed: https://bugs.launchpad.net/ubuntu/lucid/+source/vim-addon-manager/+bug/802036/+attachment/2221175/+files/vim-addon-manager_0.4.3ubuntu0.10.04.0.debdiff

TEST CASE:

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

Regression risk:

Slim to none. The patch does not affect other code paths.

From the original bug description:

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)

Revision history for this message
Chris Lasher (chris.lasher) wrote :
Revision history for this message
Chris Lasher (chris.lasher) wrote :

Here is a patch that should be applied to the file addon-manager.rb

The patch fixes the errant while-loop.

tags: added: patch
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package vim-addon-manager - 0.4.3ubuntu1

---------------
vim-addon-manager (0.4.3ubuntu1) oneiric; urgency=low

  * Apply patch from Chris Lasher fixing incorrect handling
    in the remove command for ~/.vim being a symlink. Thanks,
    Chris! (LP: #802036)
 -- Daniel T Chen <email address hidden> Mon, 18 Jul 2011 16:52:11 -0400

Changed in vim-addon-manager (Ubuntu Oneiric):
status: New → Fix Released
Daniel T Chen (crimsun)
tags: added: patch-forwarded-debian
removed: patch
Revision history for this message
Daniel T Chen (crimsun) wrote :
Changed in vim-addon-manager (Ubuntu Natty):
assignee: nobody → Daniel T Chen (crimsun)
Changed in vim-addon-manager (Ubuntu Maverick):
assignee: nobody → Daniel T Chen (crimsun)
Changed in vim-addon-manager (Ubuntu Lucid):
assignee: nobody → Daniel T Chen (crimsun)
Revision history for this message
Daniel T Chen (crimsun) wrote :
Revision history for this message
Daniel T Chen (crimsun) wrote :
description: updated
Revision history for this message
Clint Byrum (clint-fewbar) wrote : Please test proposed package

Hello Chris, or anyone else affected,

Accepted vim-addon-manager into natty-proposed, the package will build now and be available in a few hours. Please test and give feedback here. See https://wiki.ubuntu.com/Testing/EnableProposed for documentation how to enable and use -proposed. Thank you in advance!

Changed in vim-addon-manager (Ubuntu Natty):
status: New → Fix Committed
tags: added: verification-needed
Changed in vim-addon-manager (Ubuntu Maverick):
status: New → Fix Committed
Revision history for this message
Clint Byrum (clint-fewbar) wrote :

Hello Chris, or anyone else affected,

Accepted vim-addon-manager into maverick-proposed, the package will build now and be available in a few hours. Please test and give feedback here. See https://wiki.ubuntu.com/Testing/EnableProposed for documentation how to enable and use -proposed. Thank you in advance!

Changed in vim-addon-manager (Ubuntu Lucid):
status: New → Fix Committed
Revision history for this message
Clint Byrum (clint-fewbar) wrote :

Hello Chris, or anyone else affected,

Accepted vim-addon-manager into lucid-proposed, the package will build now and be available in a few hours. Please test and give feedback here. See https://wiki.ubuntu.com/Testing/EnableProposed for documentation how to enable and use -proposed. Thank you in advance!

Changed in vim-addon-manager (Debian):
status: Unknown → New
Changed in vim-addon-manager (Debian):
status: New → Fix Released
tags: added: testcase
Revision history for this message
Ubuntu Foundations Team Bug Bot (crichton) wrote : Verification still needed

The fix for the this bug has been awaiting testing feedback in the -proposed repository for lucid for more than 90 days. Please test this fix and update the bug appropriately with the results. In the event that the fix for this bug is still not verified 15 days from now the package will be removed from the -proposed repository.

Changed in vim-addon-manager (Ubuntu Maverick):
status: Fix Committed → Won't Fix
Changed in vim-addon-manager (Ubuntu Natty):
status: Fix Committed → Won't Fix
tags: added: removal-candidate
Revision history for this message
Brian Murray (brian-murray) wrote :

The version of vim-addon-manager in lucid-proposed has been removed as this bug report was not verified in a timely fashion.

tags: removed: verification-needed
tags: removed: removal-candidate
Changed in vim-addon-manager (Ubuntu Lucid):
status: Fix Committed → Triaged
Revision history for this message
Rolf Leggewie (r0lf) wrote :

lucid has seen the end of its life and is no longer receiving any updates. Marking the lucid task for this ticket as "Won't Fix".

Changed in vim-addon-manager (Ubuntu Lucid):
status: Triaged → Won't Fix
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.