Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Simple fix for running specs as root. #2061

Merged
merged 1 commit into from

3 participants

@Flameeyes

This test would fail on default Gentoo installs as the package is
executed as root.

@Flameeyes Flameeyes spec: do not check for /usr/bin not to be writable when running as root.
This test would fail on default Gentoo installs as the package is
executed as root.
433b4bc
@travisbot

This pull request fails (merged 433b4bc into 3a1121a).

@Flameeyes

Uhm I think travisbot is wrong, given that error reported is:

Error: #<NativeException: org.virtualbox_4_1.VBoxException: The function "powerDown" returned an error condition: "The virtual machine is being powered down"  (0x80bb0002)>
@indirect
Owner

Um... the tests also fail if they are run outside a git repo. Does gentoo run the package tests from inside a git repo?

@Flameeyes

We have workarounds for those — I didn't want to submit those just yet, but this one seems to be valid anyway: it's just avoiding a non-writeable check, that would then always fail, when running as root.

@indirect
Owner

Is the "fix" to just disable all tests that depend on being inside a git repo when the tests run? Either way, I'd be interested in a pull with those changes. A subset of the tests that pass would be an improvement over tests that can't pass from inside an installed gem.

As for this test, it seems okay. I personally would be terrified of running any test suite as root, though. :P

@indirect indirect merged commit d97ada4 into bundler:master
@Flameeyes

Not really a fix, yes I think it's disabling quite a few of the git tests, and I agree, a subset passing is better than not being able to run them. I'll try to put them in shape to be merged (right now they are unconditional).

As for running as root, we're moving toward a default of not doing so but.. a number of packages actually expect root :( Luckily we use a pre-loaded library to sandbox the execution, so it's "safe enough".

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Aug 14, 2012
  1. @Flameeyes

    spec: do not check for /usr/bin not to be writable when running as root.

    Flameeyes authored
    This test would fail on default Gentoo installs as the package is
    executed as root.
This page is out of date. Refresh to see the latest.
Showing with 1 addition and 1 deletion.
  1. +1 −1  spec/install/gems/simple_case_spec.rb
View
2  spec/install/gems/simple_case_spec.rb
@@ -796,7 +796,7 @@ def set_bundle_path(type, location)
# On OS X, Gem.bindir defaults to /usr/bin, so system_bindir is useful if
# you want to avoid sudo installs for system gems with OS X's default ruby
it "overrides Gem.bindir" do
- Pathname.new("/usr/bin").should_not be_writable
+ Pathname.new("/usr/bin").should_not be_writable unless Process::euid == 0
gemfile <<-G
require 'rubygems'
def Gem.bindir; "/usr/bin"; end
Something went wrong with that request. Please try again.