Package: vim-addon-manager
Version: 0.5.2
Severity: normal
Tags: patch

Dear Maintainer,

when executing vam in an environment that does not include $HOME, it
errors out:

$ env -u HOME vam -w show foo
/usr/bin/vim-addon-manager:201:in `join': can't convert nil into String 
(TypeError)
        from /usr/bin/vim-addon-manager:201:in `parse_cmdline'
        from /usr/bin/vim-addon-manager:251:in `<top (required)>'
        from /usr/bin/vam:2:in `load'
        from /usr/bin/vam:2:in `<main>'
$

Why is this bad?

 * The error message does not tell the user what is wrong.
 * Other programs trying to access the users home default to using
   getent if $HOME is unavailable.
 * When passing the -w switch there is no need to access any home at
   all.

I propose to use look up the home directory using the 'etc' Ruby stdlib
module. Have a look at the attached patch for details.

Helmut
--- vim-addon-manager.orig	2013-10-14 17:36:06.000000000 +0200
+++ vim-addon-manager	2013-10-14 17:36:47.000000000 +0200
@@ -155,6 +155,7 @@
 
 =end
 
+require 'etc'
 require 'getoptlong'
 
 require 'vim/addon_manager'
@@ -198,7 +199,7 @@
     :registry_dir => '/usr/share/vim/registry',
     :source_dir   => '/usr/share/vim/addons',
     :system_dir   => '/var/lib/vim/addons',
-    :target_dir   => File.join(ENV['HOME'], '.vim'),
+    :target_dir   => File.join(ENV['HOME'] || (Etc.getpwnam Etc.getlogin).dir, '.vim'),
     :query        => false,
     :system_wide  => false,
   }

Reply via email to