On Sat, Jul 07, 2012 at 02:53:13PM +0200, Bastian Blank wrote: > vim-addons respects umask a bit too much. It creates anything in > /var/lib/vim, aka for any user, respecting the umask of the calling > process, 027 in my case. So no user can read the stuff.
Attached patch uses a specific mode when installing an addon as root. However, this doesn't correctly handle the case of an actual root user installing addons for themself. This would be better handled by tracking whether it's a "system" install or not, instead of an install being performed by root. -- James GPG Key: 4096R/331BA3DB 2011-12-05 James McCoy <james...@debian.org>
From 0498dfe00250def766d3b5629e6729f928362eaf Mon Sep 17 00:00:00 2001 From: James McCoy <james...@debian.org> Date: Tue, 10 Jul 2012 22:10:49 -0400 Subject: [PATCH] Use a standard directory mode when installing an addon as root. Closes: #680624 Signed-off-by: James McCoy <james...@debian.org> --- debian/changelog | 7 +++++++ lib/vim/addon_manager/addon.rb | 9 +++++++++ lib/vim/addon_manager/addon/directory.rb | 2 +- lib/vim/addon_manager/addon/legacy.rb | 3 +-- 4 files changed, 18 insertions(+), 3 deletions(-) diff --git a/debian/changelog b/debian/changelog index cd22508..35ff444 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,10 @@ +vim-addon-manager (0.5.1) UNRELEASED; urgency=low + + * Use a standard directory mode when installing an addon as root. (Closes: + #680624) + + -- James McCoy <james...@debian.org> Tue, 10 Jul 2012 21:46:56 -0400 + vim-addon-manager (0.5.0) unstable; urgency=low * Addons now can now use a new layout: instead of having its files symlinked diff --git a/lib/vim/addon_manager/addon.rb b/lib/vim/addon_manager/addon.rb index 9159c33..4291571 100644 --- a/lib/vim/addon_manager/addon.rb +++ b/lib/vim/addon_manager/addon.rb @@ -61,6 +61,15 @@ module Vim AddonStatus.new :unkonwn end + def mkdir(dest) + dest_dir = File.dirname dest + if Process.euid == 0 + FileUtils.mkdir_p dest_dir, :mode => 0755 + else + FileUtils.mkdir_p dest_dir + end + end + # Installs addon files into +target_dir+ and returns a list of installed # files. # diff --git a/lib/vim/addon_manager/addon/directory.rb b/lib/vim/addon_manager/addon/directory.rb index 18c8c5e..3e509b7 100644 --- a/lib/vim/addon_manager/addon/directory.rb +++ b/lib/vim/addon_manager/addon/directory.rb @@ -32,7 +32,7 @@ module Vim def install(target_dir) dest = destination(target_dir) - FileUtils.mkdir_p(File.dirname(dest)) + self.mkdir(dest) FileUtils.ln_sf(source, dest) files end diff --git a/lib/vim/addon_manager/addon/legacy.rb b/lib/vim/addon_manager/addon/legacy.rb index 6dcf4b7..a950f0a 100644 --- a/lib/vim/addon_manager/addon/legacy.rb +++ b/lib/vim/addon_manager/addon/legacy.rb @@ -56,8 +56,7 @@ module Vim installed_files = [] symlink = lambda do |file| dest = File.join(target_dir, file) - dest_dir = File.dirname dest - FileUtils.mkdir_p dest_dir + self.mkdir(dest) FileUtils.ln_sf(File.join(basedir, file), dest) end status = self.status(target_dir) -- 1.7.10.4
signature.asc
Description: Digital signature