Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

if a BUNDLE_GEMFILE is specified noexec aborts... #20

Closed
ebertech opened this Issue · 3 comments

2 participants

@ebertech

Hi

Maybe I'm not using BUNDLE_GEMFILE properly but when it's set Bundler.setup is never called. So, in the code for noexec.rb

  def setup
      log "Noexec"
      return if %w(bundle rubygems-bundler-uninstaller).include?(File.basename($0))
      return if ENV['BUNDLE_GEMFILE'] # <--- bail out?
      return if %w(0 skip).include?( ENV['NOEXEC'] )
      gemfile = File.join(CURRENT, "Gemfile")
      while true
        if File.exist?(gemfile)
          log "Examining #{gemfile}"
          if Noexec.candidate?(gemfile, File.basename($0))
            log "Using #{gemfile}"
            ENV['BUNDLE_GEMFILE'] = gemfile
            Bundler.setup # <----- never get here
            return
          end
        end
      #and so on

Is there a reason for breaking out that fast? What I have is a custom Gemfile that's set and this is a gem from git (yes, I realize this is an edge case on top of an edge case).

I got it to work by doing this:

    def setup
      log "Noexec"
      return if %w(bundle rubygems-bundler-uninstaller).include?(File.basename($0))
      # removed return if ENV['BUNDLE_GEMFILE'] 
      return if %w(0 skip).include?( ENV['NOEXEC'] )
      gemfile = ENV['BUNDLE_GEMFILE'] || File.join(CURRENT, "Gemfile") # <-- and put it here

But I don't want to submit a pull request as you are MUCH more familiar with Gem and Bundler internals by now. Am I being dense?

@mpapis mpapis was assigned
@mpapis
Owner

the line should be improved:

return if ENV['BUNDLE_GEMFILE'] # <--- bail out?

check https://github.com/rails/rails/pull/6332/files#L0R255 for list of 3 variables which if all set will allow detecting that Bundler was already loaded and we should skip detecting:

# skip detection if Bundler is already setup
return if ENV['BUNDLE_GEMFILE'] && ENV['BUNDLE_BIN_PATH'] && ENV['RUBYOPT']

Feel free to open a pull request with the fix as you found the problem.

Thank you,
Michal

@ebertech

Done and done

@mpapis
Owner

merged, thank you again! <3

@mpapis mpapis closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.