[ruby-core:68005] [ruby-trunk - Bug #10822] make-snapshot breaks during download of bundled gems

From: v.ondruch@...
Date: 2015-02-04 11:33:05 UTC
List: ruby-core #68005
Issue #10822 has been updated by Vit Ondruch.


Nobuyoshi Nakada wrote:
> It is right, the built rbconfig.rb must be loaded, not already installed one.
> Why is `RbConfig::CONFIG['vendordir']` `nil`?

Because this is the rbconfig.rb file which is picked up from the checkout directory?

~~~
# cat '/tmp/ruby-snapshot20150204-19701-jaoxi6/ruby-2.3.0-r49494/rbconfig.rb' 

# This file was created by mkconfig.rb when ruby was built.  Any
# changes made to this file will be lost the next time ruby is built.

module RbConfig
  RUBY_VERSION == "2.2.0" or
    raise "ruby lib version (2.2.0) doesn't match executable version (#{RUBY_VERSION})"

  TOPDIR = File.dirname(__FILE__).chomp!("")
  DESTDIR = '' unless defined? DESTDIR
  CONFIG = {}
  CONFIG["DESTDIR"] = DESTDIR
  CONFIG["MAJOR"] = "2"
  CONFIG["MINOR"] = "3"
  CONFIG["TEENY"] = "0"
  CONFIG["PATCHLEVEL"] = "-1"
  CONFIG["ruby_install_name"] = ""
  CONFIG["EXEEXT"] = ""
  CONFIG["ruby_install_name"] = ""
  CONFIG["RUBY_INSTALL_NAME"] = ""
  CONFIG["RUBY_SO_NAME"] = ""
  CONFIG["configure_args"] = ""
  CONFIG["EXTOUT"] = "tmp"
  CONFIG["bindir"] = "$(DESTDIR)"
  CONFIG["ARCH_FLAG"] = ""
  CONFIG["CFLAGS"] = ""
  CONFIG["CPPFLAGS"] = ""
  CONFIG["CXXFLAGS"] = ""
  CONFIG["LDFLAGS"] = ""
  CONFIG["DLDFLAGS"] = ""
  CONFIG["LIBEXT"] = "a"
  CONFIG["OBJEXT"] = "o"
  CONFIG["LIBRUBY"] = "libruby.a"
  CONFIG["LIBRUBY_A"] = "libruby.a"
  CONFIG["RM"] = "rm -f"
  CONFIG["CP"] = "cp"
  CONFIG["rubyarchdir"] = "$(DESTDIR)"
  CONFIG["rubylibprefix"] = ""
  CONFIG["ruby_version"] = ""
  CONFIG["archdir"] = "$(rubyarchdir)"
  CONFIG["topdir"] = File.dirname(__FILE__)
  MAKEFILE_CONFIG = {}
  CONFIG.each{|k,v| MAKEFILE_CONFIG[k] = v.dup}
  def RbConfig::expand(val, config = CONFIG)
    newval = val.gsub(/\$\$|\$\(([^()]+)\)|\$\{([^{}]+)\}/) {
      var = $&
      if !(v = $1 || $2)
	'$'
      elsif key = config[v = v[/\A[^:]+(?=(?::(.*?)=(.*))?\z)/]]
	pat, sub = $1, $2
	config[v] = false
	config[v] = RbConfig::expand(key, config)
	key = key.gsub(/#{Regexp.quote(pat)}(?=\s|\z)/n) {sub} if pat
	key
      else
	var
      end
    }
    val.replace(newval) unless newval == val
    val
  end
  CONFIG.each_value do |val|
    RbConfig::expand(val)
  end

  # returns the absolute pathname of the ruby command.
  def RbConfig.ruby
    File.join(
      RbConfig::CONFIG["bindir"],
      RbConfig::CONFIG["ruby_install_name"] + RbConfig::CONFIG["EXEEXT"]
    )
  end
end
CROSS_COMPILING = nil unless defined? CROSS_COMPILING
~~~

and this is content of config.status, which is I believe used by mkconfig.rb to produce rbconfig.rb:

~~~
# cat /tmp/ruby-snapshot20150204-19701-jaoxi6/ruby-2.3.0-r49494/config.status
s,@configure_args@,|#_!!_#|,g
s,@EXTOUT@,|#_!!_#|tmp,g
s,@bindir@,|#_!!_#|,g
s,@ruby_install_name@,|#_!!_#|,g
s,@ARCH_FLAG@,|#_!!_#|,g
s,@CFLAGS@,|#_!!_#|,g
s,@CPPFLAGS@,|#_!!_#|,g
s,@CXXFLAGS@,|#_!!_#|,g
s,@LDFLAGS@,|#_!!_#|,g
s,@DLDFLAGS@,|#_!!_#|,g
s,@LIBEXT@,|#_!!_#|a,g
s,@OBJEXT@,|#_!!_#|o,g
s,@EXEEXT@,|#_!!_#|,g
s,@LIBRUBY@,|#_!!_#|libruby.a,g
s,@LIBRUBY_A@,|#_!!_#|libruby.a,g
s,@RM@,|#_!!_#|rm -f,g
s,@CP@,|#_!!_#|cp,g
s,@rubyarchdir@,|#_!!_#|,g
s,@rubylibprefix@,|#_!!_#|,g
s,@ruby_version@,|#_!!_#|,g
~~~

There is nothing to take the information from.

Please note that I am running the make-snapshot in fresh checkout if and it is doing its own export from SVN if I am not mistaken.

----------------------------------------
Bug #10822: make-snapshot breaks during download of bundled gems
https://bugs.ruby-lang.org/issues/10822#change-51396

* Author: Vit Ondruch
* Status: Third Party's Issue
* Priority: Normal
* Assignee: 
* ruby -v: ruby-2.3.0-r49483
* Backport: 2.0.0: UNKNOWN, 2.1: UNKNOWN, 2.2: UNKNOWN
----------------------------------------
~~~
... snip ...

downloading config.sub ... done
Downloading bundled gem files...
/usr/share/rubygems/rubygems/defaults/operating_system.rb:9:in `previous_but_one_dir_to': undefined method `split' for nil:NilClass (NoMethodError)
	from /usr/share/rubygems/rubygems/defaults/operating_system.rb:30:in `default_locations'
	from /usr/share/rubygems/rubygems/defaults/operating_system.rb:47:in `default_dirs'
	from /usr/share/rubygems/rubygems/defaults/operating_system.rb:70:in `default_dir'
	from /usr/share/rubygems/rubygems/basic_specification.rb:33:in `default_specifications_dir'
	from /usr/share/rubygems/rubygems/specification.rb:770:in `load_defaults'
	from /usr/share/rubygems/rubygems.rb:1239:in `<top (required)>'
	from /tmp/ruby-snapshot20150203-18908-5qkpah/ruby-2.3.0-r49483/tool/downloader.rb:41:in `require'
	from /tmp/ruby-snapshot20150203-18908-5qkpah/ruby-2.3.0-r49483/tool/downloader.rb:41:in `download'
	from -e:4:in `<main>'
/tmp/GmEfPzNs:1423: recipe for target 'update-gems' failed
make: *** [update-gems] Error 1
prerequisites failed
~~~

This is due to Ruby picking up rbconfig.rb from the current checkout, since $(RUNRUBY) adds the current directory on the load path [1]. I don't think this is right in this case.

You can reproduce this issue with Fedora's operating_system.rb [2].


[1] https://github.com/ruby/ruby/blob/trunk/common.mk#L920
[2] http://pkgs.fedoraproject.org/cgit/ruby.git/tree/operating_system.rb



-- 
https://bugs.ruby-lang.org/

In This Thread

Prev Next