Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Gem install minitest on NFS fails #1161

Closed
EHadoux opened this issue Feb 5, 2015 · 24 comments
Closed

Gem install minitest on NFS fails #1161

EHadoux opened this issue Feb 5, 2015 · 24 comments

Comments

@EHadoux
Copy link

EHadoux commented Feb 5, 2015

Hi,

installing minitest, hoe or whatever gems from seattlerb on a nfs partition fails, e.g.:

/home/hadouxe/testruby/bin/gem install minitest
ERROR:  While executing gem ... (Errno::EACCES)
    Permission denied @ rb_sysopen - /home/hadouxe/.gems/gems/minitest-5.5.1/History.txt

This seems independent to rbenv (the example above does not use it).
You can see at minitest/minitest#435 all the tests and why I am opening this issue here.
I honestly do not know if the bug comes from minitest or rubygems.

Anyways, thank you very much.

@jirutka
Copy link

jirutka commented Feb 6, 2015

IMO the bug comes from this hoe crap, that is what the seattlerb gems have in common.

@EHadoux
Copy link
Author

EHadoux commented Feb 6, 2015

I guess it is. Is there any ways to skip the minitest part in ruby installation?
It seems mandatory and that prevents me from installing new rubies.

@zenspider
Copy link
Contributor

@jirutka crap? "humble" opinion? interesting...

@zenspider
Copy link
Contributor

@drbrain, I believe this to be a bug in rubygems' tar support. I've verified that it is NOT an issue with NFS by manually untarring a minitest gem on one of the affected hosts w/ NFS and then used gem unpack to reproduce. Details below:

minitestgem@ssh:~$ rm -rf xxx; mkdir xxx; tar zxf data.tar.gz -C xxx
minitestgem@ssh:~$ ls -l xxx
total 68
-r--r--r-- 1 minitestgem minitestgem  1918 2015-01-10 01:35 design_rationale.rb
-r--r--r-- 1 minitestgem minitestgem 32911 2015-01-10 01:35 History.txt
drwxrwxr-x 4 minitestgem minitestgem    65 2015-02-07 14:20 lib
-r--r--r-- 1 minitestgem minitestgem   617 2015-01-10 01:35 Manifest.txt
-r--r--r-- 1 minitestgem minitestgem  2003 2015-01-10 01:35 Rakefile
-r--r--r-- 1 minitestgem minitestgem 19794 2015-01-10 01:35 README.txt
drwxrwxr-x 3 minitestgem minitestgem    29 2015-02-07 14:20 test
minitestgem@ssh:~$ rm -rf xxx
minitestgem@ssh:~$ rm -rf minitest-5.5.1; gem unpack minitest-5.5.1.gem --backtrace
ERROR:  While executing gem ... (Errno::EACCES)
    Permission denied @ rb_sysopen - /nfs/http7/minitestgem/minitest-5.5.1/.autotest
    /home/minitestgem/.rvm/rubies/ruby-2.1.0/lib/ruby/site_ruby/2.1.0/rubygems/package.rb:369:in `initialize'
    /home/minitestgem/.rvm/rubies/ruby-2.1.0/lib/ruby/site_ruby/2.1.0/rubygems/package.rb:369:in `open'
    /home/minitestgem/.rvm/rubies/ruby-2.1.0/lib/ruby/site_ruby/2.1.0/rubygems/package.rb:369:in `block (2 levels) in extract_tar_gz'
    /home/minitestgem/.rvm/rubies/ruby-2.1.0/lib/ruby/site_ruby/2.1.0/rubygems/package/tar_reader.rb:64:in `each'
    /home/minitestgem/.rvm/rubies/ruby-2.1.0/lib/ruby/site_ruby/2.1.0/rubygems/package.rb:351:in `block in extract_tar_gz'
    /home/minitestgem/.rvm/rubies/ruby-2.1.0/lib/ruby/site_ruby/2.1.0/rubygems/package.rb:444:in `block in open_tar_gz'
    /home/minitestgem/.rvm/rubies/ruby-2.1.0/lib/ruby/site_ruby/2.1.0/rubygems/package.rb:441:in `wrap'
    /home/minitestgem/.rvm/rubies/ruby-2.1.0/lib/ruby/site_ruby/2.1.0/rubygems/package.rb:441:in `open_tar_gz'
    /home/minitestgem/.rvm/rubies/ruby-2.1.0/lib/ruby/site_ruby/2.1.0/rubygems/package.rb:350:in `extract_tar_gz'
    /home/minitestgem/.rvm/rubies/ruby-2.1.0/lib/ruby/site_ruby/2.1.0/rubygems/package.rb:331:in `block (2 levels) in extract_files'
    /home/minitestgem/.rvm/rubies/ruby-2.1.0/lib/ruby/site_ruby/2.1.0/rubygems/package/tar_reader.rb:64:in `each'
    /home/minitestgem/.rvm/rubies/ruby-2.1.0/lib/ruby/site_ruby/2.1.0/rubygems/package.rb:328:in `block in extract_files'
    /home/minitestgem/.rvm/rubies/ruby-2.1.0/lib/ruby/site_ruby/2.1.0/rubygems/package/file_source.rb:29:in `open'
    /home/minitestgem/.rvm/rubies/ruby-2.1.0/lib/ruby/site_ruby/2.1.0/rubygems/package/file_source.rb:29:in `with_read_io'
    /home/minitestgem/.rvm/rubies/ruby-2.1.0/lib/ruby/site_ruby/2.1.0/rubygems/package.rb:325:in `extract_files'
    /home/minitestgem/.rvm/rubies/ruby-2.1.0/lib/ruby/site_ruby/2.1.0/rubygems/commands/unpack_command.rb:92:in `block in execute'
    /home/minitestgem/.rvm/rubies/ruby-2.1.0/lib/ruby/site_ruby/2.1.0/rubygems/commands/unpack_command.rb:65:in `each'
    /home/minitestgem/.rvm/rubies/ruby-2.1.0/lib/ruby/site_ruby/2.1.0/rubygems/commands/unpack_command.rb:65:in `execute'
    /home/minitestgem/.rvm/rubies/ruby-2.1.0/lib/ruby/site_ruby/2.1.0/rubygems/command.rb:307:in `invoke_with_build_args'
    /home/minitestgem/.rvm/rubies/ruby-2.1.0/lib/ruby/site_ruby/2.1.0/rubygems/command_manager.rb:168:in `process_args'
    /home/minitestgem/.rvm/rubies/ruby-2.1.0/lib/ruby/site_ruby/2.1.0/rubygems/command_manager.rb:138:in `run'
    /home/minitestgem/.rvm/rubies/ruby-2.1.0/lib/ruby/site_ruby/2.1.0/rubygems/gem_runner.rb:54:in `run'
    /home/minitestgem/.rvm/rubies/ruby-2.1.0/bin/gem:21:in `<main>'
minitestgem@ssh:~$ 

I tried futzing with the mkdir_p to not use :mode and to push it underneath the file write and it still blew up... OH... but maybe it blew up on the second file, since this is a flat run. Ugh.

OK. I tried this and it works (rubygems/package.rb:369) :

        open destination, 'wb' do |out|
          out.write entry.read
          File.chmod entry.header.mode, destination
        end if entry.file?

@zenspider
Copy link
Contributor

Fix incoming...

@zenspider zenspider self-assigned this Feb 7, 2015
@jirutka
Copy link

jirutka commented Feb 7, 2015

Well, if it’s a bug in RubyGems, then why the problem occurs only with seattlerb gems (that uses hoe) and not any normal gems that uses RubyGems’ GemSpec?

@zenspider
Copy link
Contributor

@drbrain, this is fixed and tested live against NFS. I can't realistically write a test against this, but all tests pass fwiw.

This bug blocks installing newer versions of ruby, because they blow up installing minitest. I highly doubt that ruby's install is flexible enough to grab newer versions of rubygems, so this is still stuck until this gets released AND ruby gets updated to point to it.

@zenspider
Copy link
Contributor

@jirutka because of hoe crap, according to you.

@jirutka
Copy link

jirutka commented Feb 7, 2015

@zenspider This is only my guess. You’ve told that the bug is in RubyGems, not hoe, so a logical question arises — why it affects only seattlerb gems?

@excalq
Copy link

excalq commented Apr 17, 2015

This is also breaking rbenv installations of 2.2.0 on an NFS mounted /home directory on Ubuntu server 14.04

@zenspider
Copy link
Contributor

@excalq this fix shipped in 2.4.6 / 2015-02-05.

@zenspider
Copy link
Contributor

@drbrain can we get this backported/updated in ruby 2.2.x?

drbenmorgan added a commit to SuperNEMO-DBD/cadfaelbrew that referenced this issue Nov 4, 2015
Rubygems may fail when installing on NFS filesystems as reported in
Issue #1161:

rubygems/rubygems#1161

Apply patch supplied for that issue into ruby's version of rubygems.
@mathuin
Copy link

mathuin commented Jul 6, 2016

This is still affecting me today. Ubuntu 16.04, Ruby 2.2.1, home directory mounted on NFS.

@zenspider
Copy link
Contributor

@mathuin what version of rubygems? Can you upgrade and try again? gem update --system

@mathuin
Copy link

mathuin commented Jul 6, 2016

I ran sudo gem update --system which installed rubygems 2.6.6. Glanced through the release notes (pleasantly surprised to see them displayed!) but didn't see that particular fix.

Still doesn't work on 2.2.1:

/tmp/ruby-build.20160706155517.31540/ruby-2.2.1/lib/rubygems/package.rb:369:in `initialize': Permission denied @ rb_sysopen - /home/jmt/.rbenv/versions/2.2.1/lib/ruby/gems/2.2.0/gems/minitest-5.4.3/.autotest (Errno::EACCES)

For what it's worth, I'm hitting the same bug in Ruby itself for version 2.3.1:

/tmp/ruby-build.20160706155659.10568/ruby-2.3.1/lib/fileutils.rb:1393:in `initialize': Permission denied @ rb_sysopen - /home/jmt/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/minitest-5.8.3/design_rationale.rb (Errno::EACCES)

@mathuin
Copy link

mathuin commented Jul 6, 2016

Is it possible that building Ruby 2.2.1 with rbenv most likely uses a version of rubygems that's before the fix you added?

@zenspider
Copy link
Contributor

I've confirmed that this fix is in ruby 2.2.0 and 2.3.1. (tho my installs might be tainted. I didn't look at the tarballs)

@zenspider
Copy link
Contributor

OK. No, not the case for 2.2:

https://github.com/ruby/ruby/blob/ruby_2_2/lib/rubygems/package.rb

but it is fixed for 2.3:

https://github.com/ruby/ruby/blob/ruby_2_3/lib/rubygems/package.rb

Not sure why this wasn't backported for 2.2. Someone on rubygems core will have to comment on that. @indirect ?

@segiddins
Copy link
Member

@zenspider it's up to the ruby core team what version of rubygems they bundle

@mathuin
Copy link

mathuin commented Jul 8, 2016

The right solution would be to fix whatever is broken in the underlying call to File.open() in Ruby, but I can't make a simple working example of the problem which makes it hard to report as a bug to the Ruby folks.

@zenspider
Copy link
Contributor

@segiddins yes and no. Last I checked there were ruby core members on rubygems core. If that is not the case, there still needs to be a request from rubygems to ruby core to backport/update and I doubt that happened.

@segiddins
Copy link
Member

@zenspider hsbt does all the backporting

@hsbt
Copy link
Member

hsbt commented Jul 9, 2016

@zenspider We will not backport all rubygems update. Only regression, security issue, critical defects are backported.

I try to backport this fix with 0a76e13 to next stable release aka 2.2.6

@hsbt
Copy link
Member

hsbt commented Jul 9, 2016

I addressed https://bugs.ruby-lang.org/issues/12579

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants