From ac017df2ae59801fb4e99f82fb64ef79c7bb3f13 Mon Sep 17 00:00:00 2001 From: Philip Harrison Date: Tue, 16 Mar 2021 12:37:07 +0000 Subject: [PATCH] Bundler: Fix permission error when vendoring gems This fixes a permissions error when vendoring gems, when `GEM_HOME` was unset it defaulted to `/var/lib` which isn't writeable. Attempting to fix the discrepancy between ci and updater here: https://github.com/dependabot/dependabot-core/pull/3279 --- bundler/lib/dependabot/bundler/native_helpers.rb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/bundler/lib/dependabot/bundler/native_helpers.rb b/bundler/lib/dependabot/bundler/native_helpers.rb index 1b743597b9..d5f7bfdf30 100644 --- a/bundler/lib/dependabot/bundler/native_helpers.rb +++ b/bundler/lib/dependabot/bundler/native_helpers.rb @@ -17,7 +17,9 @@ def self.run_bundler_subprocess(function:, args:, bundler_version:) # Bundler will pick the matching installed major version "BUNDLER_VERSION" => bundler_version, "BUNDLE_GEMFILE" => File.join(versioned_helper_path(bundler_version: bundler_version), "Gemfile"), - "BUNDLE_PATH" => File.join(versioned_helper_path(bundler_version: bundler_version), ".bundle") + "BUNDLE_PATH" => File.join(versioned_helper_path(bundler_version: bundler_version), ".bundle"), + # Prevent the GEM_HOME from being set to a folder owned by root + "GEM_HOME" => File.join(versioned_helper_path(bundler_version: bundler_version), ".bundle") } ) end