Project

General

Profile

Bug #18398

Updated by Tietew (Toru Iwase) 6 months ago

`bundle install` gives up installing `digest` gem 
 due to trying to write `digest.so` in global site_ruby directory (not writable). 

 # How to reproduce 

 In clean directory, create a following Gemfile: 
 ``` ruby 
 source 'https://rubygems.org' 
 gem 'net-smtp' 
 ``` 

 Set bundle path to `vendor/bundle` and install. 

 ``` 
 $ bundle -v 
 Bundler version 2.3.0.dev 
 $ bundle config set --local --set path vendor/bundle vendor 
 $ bundle install 
 ``` 

 # Expected result 

 All gems are successfully installed in `vendor/bundle`. 

 # Actual result 

 ``` 
 $ bundle install 
 Fetching gem metadata from https://rubygems.org/. 
 Using bundler 2.3.0.dev 
 Using io-wait 0.2.1 
 Using timeout 0.2.0 
 Fetching digest 3.0.0 
 Using net-protocol 0.1.2 
 Installing digest 3.0.0 with native extensions 
 Gem::Ext::BuildError: ERROR: Failed to build gem native extension. 

 current directory: 
 /***/test/ruby31/vendor/bundle/ruby/3.1.0/gems/digest-3.0.0/ext/digest 
 /usr/local/anyenv/envs/rbenv/versions/3.1.0-dev/bin/ruby -I 
 /usr/local/anyenv/envs/rbenv/versions/3.1.0-dev/lib/ruby/3.1.0 -r 
 ./siteconf20211209-660991-1c5c0k.rb extconf.rb 
 creating Makefile 

 current directory: 
 /***/test/ruby31/vendor/bundle/ruby/3.1.0/gems/digest-3.0.0/ext/digest 
 make DESTDIR\= clean 

 current directory: 
 /***/test/ruby31/vendor/bundle/ruby/3.1.0/gems/digest-3.0.0/ext/digest 
 make DESTDIR\= 
 compiling digest.c 
 linking shared-object digest.so 

 current directory: 
 /***/test/ruby31/vendor/bundle/ruby/3.1.0/gems/digest-3.0.0/ext/digest 
 make DESTDIR\= install 
 /usr/bin/install -c -m 0755 digest.so ./.gem.20211209-660991-1jo093 
 /usr/bin/mkdir: cannot create directory 
 ‘/usr/local/anyenv/envs/rbenv/versions/3.1.0-dev/include/ruby-3.1.0/site_ruby’: Permission denied 
 make: *** [Makefile:212: .sitehdrdir.time] Error 1 

 make install failed, exit code 2 

 Gem files will remain installed in 
 /***/test/ruby31/vendor/bundle/ruby/3.1.0/gems/digest-3.0.0 for 
 inspection. 
 Results logged to 
 /***/test/ruby31/vendor/bundle/ruby/3.1.0/extensions/x86_64-linux/3.1.0-static/digest-3.0.0/gem_make.out 

 /usr/local/anyenv/envs/rbenv/versions/3.1.0-dev/lib/ruby/3.1.0/rubygems/ext/builder.rb:95:in `run' 
 /usr/local/anyenv/envs/rbenv/versions/3.1.0-dev/lib/ruby/3.1.0/rubygems/ext/builder.rb:44:in `block in make' 
 /usr/local/anyenv/envs/rbenv/versions/3.1.0-dev/lib/ruby/3.1.0/rubygems/ext/builder.rb:36:in `each' 
 /usr/local/anyenv/envs/rbenv/versions/3.1.0-dev/lib/ruby/3.1.0/rubygems/ext/builder.rb:36:in `make' 
 /usr/local/anyenv/envs/rbenv/versions/3.1.0-dev/lib/ruby/3.1.0/rubygems/ext/ext_conf_builder.rb:63:in `block in build' 
 /usr/local/anyenv/envs/rbenv/versions/3.1.0-dev/lib/ruby/3.1.0/tempfile.rb:317:in `open' 
 /usr/local/anyenv/envs/rbenv/versions/3.1.0-dev/lib/ruby/3.1.0/rubygems/ext/ext_conf_builder.rb:26:in `build' 
 /usr/local/anyenv/envs/rbenv/versions/3.1.0-dev/lib/ruby/3.1.0/rubygems/ext/builder.rb:161:in `build_extension' 
 /usr/local/anyenv/envs/rbenv/versions/3.1.0-dev/lib/ruby/3.1.0/rubygems/ext/builder.rb:195:in `block in build_extensions' 
 /usr/local/anyenv/envs/rbenv/versions/3.1.0-dev/lib/ruby/3.1.0/rubygems/ext/builder.rb:192:in `each' 
 /usr/local/anyenv/envs/rbenv/versions/3.1.0-dev/lib/ruby/3.1.0/rubygems/ext/builder.rb:192:in `build_extensions' 
 /usr/local/anyenv/envs/rbenv/versions/3.1.0-dev/lib/ruby/3.1.0/rubygems/installer.rb:837:in `build_extensions' 
 /usr/local/anyenv/envs/rbenv/versions/3.1.0-dev/lib/ruby/3.1.0/bundler/rubygems_gem_installer.rb:71:in `build_extensions' 
 /usr/local/anyenv/envs/rbenv/versions/3.1.0-dev/lib/ruby/3.1.0/bundler/rubygems_gem_installer.rb:28:in `install' 
 /usr/local/anyenv/envs/rbenv/versions/3.1.0-dev/lib/ruby/3.1.0/bundler/source/rubygems.rb:204:in `install' 
 /usr/local/anyenv/envs/rbenv/versions/3.1.0-dev/lib/ruby/3.1.0/bundler/installer/gem_installer.rb:54:in `install' 
 /usr/local/anyenv/envs/rbenv/versions/3.1.0-dev/lib/ruby/3.1.0/bundler/installer/gem_installer.rb:16:in `install_from_spec' 
 /usr/local/anyenv/envs/rbenv/versions/3.1.0-dev/lib/ruby/3.1.0/bundler/installer/parallel_installer.rb:186:in `do_install' 
 /usr/local/anyenv/envs/rbenv/versions/3.1.0-dev/lib/ruby/3.1.0/bundler/installer/parallel_installer.rb:177:in `block in worker_pool' 
 /usr/local/anyenv/envs/rbenv/versions/3.1.0-dev/lib/ruby/3.1.0/bundler/worker.rb:62:in `apply_func' 
 /usr/local/anyenv/envs/rbenv/versions/3.1.0-dev/lib/ruby/3.1.0/bundler/worker.rb:57:in `block in process_queue' 
 /usr/local/anyenv/envs/rbenv/versions/3.1.0-dev/lib/ruby/3.1.0/bundler/worker.rb:54:in `loop' 
 /usr/local/anyenv/envs/rbenv/versions/3.1.0-dev/lib/ruby/3.1.0/bundler/worker.rb:54:in `process_queue' 
 /usr/local/anyenv/envs/rbenv/versions/3.1.0-dev/lib/ruby/3.1.0/bundler/worker.rb:91:in `block (2 levels) in create_threads' 

 An error occurred while installing digest (3.0.0), and Bundler cannot 
 continue. 

 In Gemfile: 
   net-smtp was resolved to 0.3.0, which depends on 
     digest 
 ``` 

 digest-3.0.0/gem_make.out 

 ``` 
 current directory: /***/test/ruby31/vendor/bundle/ruby/3.1.0/gems/digest-3.0.0/ext/digest 
 /usr/local/anyenv/envs/rbenv/versions/3.1.0-dev/bin/ruby -I /usr/local/anyenv/envs/rbenv/versions/3.1.0-dev/lib/ruby/3.1.0 -r ./siteconf20211209-660991-1c5c0k.rb extconf.rb 
 creating Makefile 

 current directory: /***/test/ruby31/vendor/bundle/ruby/3.1.0/gems/digest-3.0.0/ext/digest 
 make DESTDIR\= clean 

 current directory: /***/test/ruby31/vendor/bundle/ruby/3.1.0/gems/digest-3.0.0/ext/digest 
 make DESTDIR\= 
 compiling digest.c 
 linking shared-object digest.so 

 current directory: /***/test/ruby31/vendor/bundle/ruby/3.1.0/gems/digest-3.0.0/ext/digest 
 make DESTDIR\= install 
 /usr/bin/install -c -m 0755 digest.so ./.gem.20211209-660991-1jo093 
 /usr/bin/mkdir: cannot create directory ‘/usr/local/anyenv/envs/rbenv/versions/3.1.0-dev/include/ruby-3.1.0/site_ruby’: Permission denied 
 make: *** [Makefile:212: .sitehdrdir.time] Error 1 

 make install failed, exit code 2 
 ```

Back