Merge RubyGems-3.6.2 and Bundler-2.6.2
This commit is contained in:
parent
527cc73282
commit
9e0eb9778d
Notes:
git
2024-12-23 22:21:28 +00:00
@ -4,7 +4,7 @@
|
|||||||
.SH "NAME"
|
.SH "NAME"
|
||||||
\fBbundle\-lock\fR \- Creates / Updates a lockfile without installing
|
\fBbundle\-lock\fR \- Creates / Updates a lockfile without installing
|
||||||
.SH "SYNOPSIS"
|
.SH "SYNOPSIS"
|
||||||
\fBbundle lock\fR [\-\-update] [\-\-bundler[=BUNDLER]] [\-\-local] [\-\-print] [\-\-lockfile=PATH] [\-\-full\-index] [\-\-gemfile=GEMFILE] [\-\-add\-checkums] [\-\-add\-platform] [\-\-remove\-platform] [\-\-normalize\-platforms] [\-\-patch] [\-\-minor] [\-\-major] [\-\-pre] [\-\-strict] [\-\-conservative]
|
\fBbundle lock\fR [\-\-update] [\-\-bundler[=BUNDLER]] [\-\-local] [\-\-print] [\-\-lockfile=PATH] [\-\-full\-index] [\-\-gemfile=GEMFILE] [\-\-add\-checksums] [\-\-add\-platform] [\-\-remove\-platform] [\-\-normalize\-platforms] [\-\-patch] [\-\-minor] [\-\-major] [\-\-pre] [\-\-strict] [\-\-conservative]
|
||||||
.SH "DESCRIPTION"
|
.SH "DESCRIPTION"
|
||||||
Lock the gems specified in Gemfile\.
|
Lock the gems specified in Gemfile\.
|
||||||
.SH "OPTIONS"
|
.SH "OPTIONS"
|
||||||
|
@ -10,7 +10,7 @@ bundle-lock(1) -- Creates / Updates a lockfile without installing
|
|||||||
[--lockfile=PATH]
|
[--lockfile=PATH]
|
||||||
[--full-index]
|
[--full-index]
|
||||||
[--gemfile=GEMFILE]
|
[--gemfile=GEMFILE]
|
||||||
[--add-checkums]
|
[--add-checksums]
|
||||||
[--add-platform]
|
[--add-platform]
|
||||||
[--remove-platform]
|
[--remove-platform]
|
||||||
[--normalize-platforms]
|
[--normalize-platforms]
|
||||||
|
@ -84,8 +84,9 @@ module Bundler
|
|||||||
require "shellwords"
|
require "shellwords"
|
||||||
cmd = [*Shellwords.shellsplit(bundler_spec_original_cmd), *ARGV]
|
cmd = [*Shellwords.shellsplit(bundler_spec_original_cmd), *ARGV]
|
||||||
else
|
else
|
||||||
cmd = [Process.argv0, *ARGV]
|
argv0 = File.exist?($PROGRAM_NAME) ? $PROGRAM_NAME : Process.argv0
|
||||||
cmd.unshift(Gem.ruby) unless File.executable?(Process.argv0)
|
cmd = [argv0, *ARGV]
|
||||||
|
cmd.unshift(Gem.ruby) unless File.executable?(argv0)
|
||||||
end
|
end
|
||||||
|
|
||||||
Bundler.with_original_env do
|
Bundler.with_original_env do
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
# frozen_string_literal: false
|
# frozen_string_literal: false
|
||||||
|
|
||||||
module Bundler
|
module Bundler
|
||||||
VERSION = "2.6.1".freeze
|
VERSION = "2.6.2".freeze
|
||||||
|
|
||||||
def self.bundler_major_version
|
def self.bundler_major_version
|
||||||
@bundler_major_version ||= VERSION.split(".").first.to_i
|
@bundler_major_version ||= VERSION.split(".").first.to_i
|
||||||
|
@ -9,7 +9,7 @@
|
|||||||
require "rbconfig"
|
require "rbconfig"
|
||||||
|
|
||||||
module Gem
|
module Gem
|
||||||
VERSION = "3.6.1"
|
VERSION = "3.6.2"
|
||||||
end
|
end
|
||||||
|
|
||||||
# Must be first since it unloads the prelude from 1.9.2
|
# Must be first since it unloads the prelude from 1.9.2
|
||||||
|
@ -6,8 +6,17 @@ begin
|
|||||||
require "rdoc/rubygems_hook"
|
require "rdoc/rubygems_hook"
|
||||||
module Gem
|
module Gem
|
||||||
RDoc = ::RDoc::RubygemsHook
|
RDoc = ::RDoc::RubygemsHook
|
||||||
|
|
||||||
|
##
|
||||||
|
# Returns whether RDoc defines its own install hooks through a RubyGems
|
||||||
|
# plugin. This and whatever is guarded by it can be removed once no
|
||||||
|
# supported Ruby ships with RDoc older than 6.9.0.
|
||||||
|
|
||||||
|
def self.rdoc_hooks_defined_via_plugin?
|
||||||
|
Gem::Version.new(::RDoc::VERSION) >= Gem::Version.new("6.9.0")
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
Gem.done_installing(&Gem::RDoc.method(:generation_hook))
|
Gem.done_installing(&Gem::RDoc.method(:generation_hook)) unless Gem.rdoc_hooks_defined_via_plugin?
|
||||||
rescue LoadError
|
rescue LoadError
|
||||||
end
|
end
|
||||||
|
@ -22,7 +22,7 @@ class Gem::Requirement
|
|||||||
|
|
||||||
SOURCE_SET_REQUIREMENT = Struct.new(:for_lockfile).new "!" # :nodoc:
|
SOURCE_SET_REQUIREMENT = Struct.new(:for_lockfile).new "!" # :nodoc:
|
||||||
|
|
||||||
quoted = OPS.keys.map {|k| Regexp.quote k }.join "|"
|
quoted = Regexp.union(OPS.keys)
|
||||||
PATTERN_RAW = "\\s*(#{quoted})?\\s*(#{Gem::Version::VERSION_PATTERN})\\s*".freeze # :nodoc:
|
PATTERN_RAW = "\\s*(#{quoted})?\\s*(#{Gem::Version::VERSION_PATTERN})\\s*".freeze # :nodoc:
|
||||||
|
|
||||||
##
|
##
|
||||||
@ -201,7 +201,8 @@ class Gem::Requirement
|
|||||||
def marshal_load(array) # :nodoc:
|
def marshal_load(array) # :nodoc:
|
||||||
@requirements = array[0]
|
@requirements = array[0]
|
||||||
|
|
||||||
raise TypeError, "wrong @requirements" unless Array === @requirements
|
raise TypeError, "wrong @requirements" unless Array === @requirements &&
|
||||||
|
@requirements.all? {|r| r.size == 2 && (r.first.is_a?(String) || r[0] = "=") && r.last.is_a?(Gem::Version) }
|
||||||
end
|
end
|
||||||
|
|
||||||
def yaml_initialize(tag, vals) # :nodoc:
|
def yaml_initialize(tag, vals) # :nodoc:
|
||||||
@ -238,7 +239,7 @@ class Gem::Requirement
|
|||||||
def satisfied_by?(version)
|
def satisfied_by?(version)
|
||||||
raise ArgumentError, "Need a Gem::Version: #{version.inspect}" unless
|
raise ArgumentError, "Need a Gem::Version: #{version.inspect}" unless
|
||||||
Gem::Version === version
|
Gem::Version === version
|
||||||
requirements.all? {|op, rv| OPS[op].call version, rv }
|
requirements.all? {|op, rv| OPS.fetch(op).call version, rv }
|
||||||
end
|
end
|
||||||
|
|
||||||
alias_method :===, :satisfied_by?
|
alias_method :===, :satisfied_by?
|
||||||
|
@ -20,6 +20,12 @@ module Gem
|
|||||||
class EOFError < Error
|
class EOFError < Error
|
||||||
end
|
end
|
||||||
|
|
||||||
|
class DataTooShortError < Error
|
||||||
|
end
|
||||||
|
|
||||||
|
class NegativeLengthError < Error
|
||||||
|
end
|
||||||
|
|
||||||
def initialize(io)
|
def initialize(io)
|
||||||
@io = io
|
@io = io
|
||||||
end
|
end
|
||||||
@ -27,7 +33,7 @@ module Gem
|
|||||||
def read!
|
def read!
|
||||||
read_header
|
read_header
|
||||||
root = read_element
|
root = read_element
|
||||||
raise UnconsumedBytesError unless @io.eof?
|
raise UnconsumedBytesError, "expected EOF, got #{@io.read(10).inspect}... after top-level element #{root.class}" unless @io.eof?
|
||||||
root
|
root
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -41,8 +47,16 @@ module Gem
|
|||||||
raise UnsupportedVersionError, "Unsupported marshal version #{v.bytes.map(&:ord).join(".")}, expected #{Marshal::MAJOR_VERSION}.#{Marshal::MINOR_VERSION}" unless v == MARSHAL_VERSION
|
raise UnsupportedVersionError, "Unsupported marshal version #{v.bytes.map(&:ord).join(".")}, expected #{Marshal::MAJOR_VERSION}.#{Marshal::MINOR_VERSION}" unless v == MARSHAL_VERSION
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def read_bytes(n)
|
||||||
|
raise NegativeLengthError if n < 0
|
||||||
|
str = @io.read(n)
|
||||||
|
raise EOFError, "expected #{n} bytes, got EOF" if str.nil?
|
||||||
|
raise DataTooShortError, "expected #{n} bytes, got #{str.inspect}" unless str.bytesize == n
|
||||||
|
str
|
||||||
|
end
|
||||||
|
|
||||||
def read_byte
|
def read_byte
|
||||||
@io.getbyte
|
@io.getbyte || raise(EOFError, "Unexpected EOF")
|
||||||
end
|
end
|
||||||
|
|
||||||
def read_integer
|
def read_integer
|
||||||
@ -67,8 +81,6 @@ module Gem
|
|||||||
read_byte | (read_byte << 8) | -0x10000
|
read_byte | (read_byte << 8) | -0x10000
|
||||||
when 0xFF
|
when 0xFF
|
||||||
read_byte | -0x100
|
read_byte | -0x100
|
||||||
when nil
|
|
||||||
raise EOFError, "Unexpected EOF"
|
|
||||||
else
|
else
|
||||||
signed = (b ^ 128) - 128
|
signed = (b ^ 128) - 128
|
||||||
if b >= 128
|
if b >= 128
|
||||||
@ -107,8 +119,6 @@ module Gem
|
|||||||
when 47 then read_regexp # ?/
|
when 47 then read_regexp # ?/
|
||||||
when 83 then read_struct # ?S
|
when 83 then read_struct # ?S
|
||||||
when 67 then read_user_class # ?C
|
when 67 then read_user_class # ?C
|
||||||
when nil
|
|
||||||
raise EOFError, "Unexpected EOF"
|
|
||||||
else
|
else
|
||||||
raise Error, "Unknown marshal type discriminator #{type.chr.inspect} (#{type})"
|
raise Error, "Unknown marshal type discriminator #{type.chr.inspect} (#{type})"
|
||||||
end
|
end
|
||||||
@ -127,7 +137,7 @@ module Gem
|
|||||||
Elements::Symbol.new(byte.chr)
|
Elements::Symbol.new(byte.chr)
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
name = -@io.read(len)
|
name = read_bytes(len)
|
||||||
Elements::Symbol.new(name)
|
Elements::Symbol.new(name)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@ -138,7 +148,7 @@ module Gem
|
|||||||
def read_string
|
def read_string
|
||||||
length = read_integer
|
length = read_integer
|
||||||
return EMPTY_STRING if length == 0
|
return EMPTY_STRING if length == 0
|
||||||
str = @io.read(length)
|
str = read_bytes(length)
|
||||||
Elements::String.new(str)
|
Elements::String.new(str)
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -152,7 +162,7 @@ module Gem
|
|||||||
|
|
||||||
def read_user_defined
|
def read_user_defined
|
||||||
name = read_element
|
name = read_element
|
||||||
binary_string = @io.read(read_integer)
|
binary_string = read_bytes(read_integer)
|
||||||
Elements::UserDefined.new(name, binary_string)
|
Elements::UserDefined.new(name, binary_string)
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -162,6 +172,7 @@ module Gem
|
|||||||
def read_array
|
def read_array
|
||||||
length = read_integer
|
length = read_integer
|
||||||
return EMPTY_ARRAY if length == 0
|
return EMPTY_ARRAY if length == 0
|
||||||
|
raise NegativeLengthError if length < 0
|
||||||
elements = Array.new(length) do
|
elements = Array.new(length) do
|
||||||
read_element
|
read_element
|
||||||
end
|
end
|
||||||
@ -170,7 +181,9 @@ module Gem
|
|||||||
|
|
||||||
def read_object_with_ivars
|
def read_object_with_ivars
|
||||||
object = read_element
|
object = read_element
|
||||||
ivars = Array.new(read_integer) do
|
length = read_integer
|
||||||
|
raise NegativeLengthError if length < 0
|
||||||
|
ivars = Array.new(length) do
|
||||||
[read_element, read_element]
|
[read_element, read_element]
|
||||||
end
|
end
|
||||||
Elements::WithIvars.new(object, ivars)
|
Elements::WithIvars.new(object, ivars)
|
||||||
@ -239,7 +252,9 @@ module Gem
|
|||||||
end
|
end
|
||||||
|
|
||||||
def read_hash_with_default_value
|
def read_hash_with_default_value
|
||||||
pairs = Array.new(read_integer) do
|
length = read_integer
|
||||||
|
raise NegativeLengthError if length < 0
|
||||||
|
pairs = Array.new(length) do
|
||||||
[read_element, read_element]
|
[read_element, read_element]
|
||||||
end
|
end
|
||||||
default = read_element
|
default = read_element
|
||||||
@ -249,7 +264,9 @@ module Gem
|
|||||||
def read_object
|
def read_object
|
||||||
name = read_element
|
name = read_element
|
||||||
object = Elements::Object.new(name)
|
object = Elements::Object.new(name)
|
||||||
ivars = Array.new(read_integer) do
|
length = read_integer
|
||||||
|
raise NegativeLengthError if length < 0
|
||||||
|
ivars = Array.new(length) do
|
||||||
[read_element, read_element]
|
[read_element, read_element]
|
||||||
end
|
end
|
||||||
Elements::WithIvars.new(object, ivars)
|
Elements::WithIvars.new(object, ivars)
|
||||||
@ -260,13 +277,13 @@ module Gem
|
|||||||
end
|
end
|
||||||
|
|
||||||
def read_float
|
def read_float
|
||||||
string = @io.read(read_integer)
|
string = read_bytes(read_integer)
|
||||||
Elements::Float.new(string)
|
Elements::Float.new(string)
|
||||||
end
|
end
|
||||||
|
|
||||||
def read_bignum
|
def read_bignum
|
||||||
sign = read_byte
|
sign = read_byte
|
||||||
data = @io.read(read_integer * 2)
|
data = read_bytes(read_integer * 2)
|
||||||
Elements::Bignum.new(sign, data)
|
Elements::Bignum.new(sign, data)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -45,7 +45,7 @@ module Gem::SafeMarshal
|
|||||||
idx = 0
|
idx = 0
|
||||||
# not idiomatic, but there's a huge number of IMEMOs allocated here, so we avoid the block
|
# not idiomatic, but there's a huge number of IMEMOs allocated here, so we avoid the block
|
||||||
# because this is such a hot path when doing a bundle install with the full index
|
# because this is such a hot path when doing a bundle install with the full index
|
||||||
until idx == size
|
while idx < size
|
||||||
push_stack idx
|
push_stack idx
|
||||||
array << visit(elements[idx])
|
array << visit(elements[idx])
|
||||||
idx += 1
|
idx += 1
|
||||||
@ -98,16 +98,21 @@ module Gem::SafeMarshal
|
|||||||
end
|
end
|
||||||
|
|
||||||
s = e.object.binary_string
|
s = e.object.binary_string
|
||||||
|
# 122 is the largest integer that can be represented in marshal in a single byte
|
||||||
|
raise TimeTooLargeError.new("binary string too large", stack: formatted_stack) if s.bytesize > 122
|
||||||
|
|
||||||
marshal_string = "\x04\bIu:\tTime".b
|
marshal_string = "\x04\bIu:\tTime".b
|
||||||
marshal_string.concat(s.size + 5)
|
marshal_string.concat(s.bytesize + 5)
|
||||||
marshal_string << s
|
marshal_string << s
|
||||||
|
# internal is limited to 5, so no overflow is possible
|
||||||
marshal_string.concat(internal.size + 5)
|
marshal_string.concat(internal.size + 5)
|
||||||
|
|
||||||
internal.each do |k, v|
|
internal.each do |k, v|
|
||||||
|
k = k.name
|
||||||
|
# ivar name can't be too large because only known ivars are in the internal ivars list
|
||||||
marshal_string.concat(":")
|
marshal_string.concat(":")
|
||||||
marshal_string.concat(k.size + 5)
|
marshal_string.concat(k.bytesize + 5)
|
||||||
marshal_string.concat(k.to_s)
|
marshal_string.concat(k)
|
||||||
dumped = Marshal.dump(v)
|
dumped = Marshal.dump(v)
|
||||||
dumped[0, 2] = ""
|
dumped[0, 2] = ""
|
||||||
marshal_string.concat(dumped)
|
marshal_string.concat(dumped)
|
||||||
@ -171,11 +176,11 @@ module Gem::SafeMarshal
|
|||||||
end
|
end
|
||||||
|
|
||||||
def visit_Gem_SafeMarshal_Elements_ObjectLink(o)
|
def visit_Gem_SafeMarshal_Elements_ObjectLink(o)
|
||||||
@objects[o.offset]
|
@objects.fetch(o.offset)
|
||||||
end
|
end
|
||||||
|
|
||||||
def visit_Gem_SafeMarshal_Elements_SymbolLink(o)
|
def visit_Gem_SafeMarshal_Elements_SymbolLink(o)
|
||||||
@symbols[o.offset]
|
@symbols.fetch(o.offset)
|
||||||
end
|
end
|
||||||
|
|
||||||
def visit_Gem_SafeMarshal_Elements_UserDefined(o)
|
def visit_Gem_SafeMarshal_Elements_UserDefined(o)
|
||||||
@ -219,6 +224,7 @@ module Gem::SafeMarshal
|
|||||||
end
|
end
|
||||||
|
|
||||||
def visit_Gem_SafeMarshal_Elements_Float(f)
|
def visit_Gem_SafeMarshal_Elements_Float(f)
|
||||||
|
register_object(
|
||||||
case f.string
|
case f.string
|
||||||
when "inf"
|
when "inf"
|
||||||
::Float::INFINITY
|
::Float::INFINITY
|
||||||
@ -229,6 +235,7 @@ module Gem::SafeMarshal
|
|||||||
else
|
else
|
||||||
f.string.to_f
|
f.string.to_f
|
||||||
end
|
end
|
||||||
|
)
|
||||||
end
|
end
|
||||||
|
|
||||||
def visit_Gem_SafeMarshal_Elements_Bignum(b)
|
def visit_Gem_SafeMarshal_Elements_Bignum(b)
|
||||||
@ -374,6 +381,12 @@ module Gem::SafeMarshal
|
|||||||
class Error < StandardError
|
class Error < StandardError
|
||||||
end
|
end
|
||||||
|
|
||||||
|
class TimeTooLargeError < Error
|
||||||
|
def initialize(message, stack:)
|
||||||
|
super "#{message} @ #{stack.join "."}"
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
class UnpermittedSymbolError < Error
|
class UnpermittedSymbolError < Error
|
||||||
def initialize(symbol:, stack:)
|
def initialize(symbol:, stack:)
|
||||||
@symbol = symbol
|
@symbol = symbol
|
||||||
|
@ -1817,16 +1817,8 @@ class Gem::Specification < Gem::BasicSpecification
|
|||||||
def encode_with(coder) # :nodoc:
|
def encode_with(coder) # :nodoc:
|
||||||
coder.add "name", @name
|
coder.add "name", @name
|
||||||
coder.add "version", @version
|
coder.add "version", @version
|
||||||
platform = case @new_platform
|
coder.add "platform", platform.to_s
|
||||||
when nil, "" then
|
coder.add "original_platform", original_platform.to_s if platform.to_s != original_platform.to_s
|
||||||
"ruby"
|
|
||||||
when String then
|
|
||||||
@new_platform
|
|
||||||
else
|
|
||||||
@new_platform.to_s
|
|
||||||
end
|
|
||||||
coder.add "platform", platform
|
|
||||||
coder.add "original_platform", @original_platform.to_s if platform != @original_platform.to_s
|
|
||||||
|
|
||||||
attributes = @@attributes.map(&:to_s) - %w[name version platform]
|
attributes = @@attributes.map(&:to_s) - %w[name version platform]
|
||||||
attributes.each do |name|
|
attributes.each do |name|
|
||||||
|
@ -10,7 +10,6 @@ require "fileutils"
|
|||||||
require_relative "../rubygems"
|
require_relative "../rubygems"
|
||||||
require_relative "installer_uninstaller_utils"
|
require_relative "installer_uninstaller_utils"
|
||||||
require_relative "dependency_list"
|
require_relative "dependency_list"
|
||||||
require_relative "rdoc"
|
|
||||||
require_relative "user_interaction"
|
require_relative "user_interaction"
|
||||||
|
|
||||||
##
|
##
|
||||||
|
2
lib/rubygems/vendor/net-http/lib/net/http.rb
vendored
2
lib/rubygems/vendor/net-http/lib/net/http.rb
vendored
@ -460,7 +460,7 @@ module Gem::Net #:nodoc:
|
|||||||
#
|
#
|
||||||
# First, what's elsewhere. Class Gem::Net::HTTP:
|
# First, what's elsewhere. Class Gem::Net::HTTP:
|
||||||
#
|
#
|
||||||
# - Inherits from {class Object}[https://docs.ruby-lang.org/en/master/Object.html#class-Object-label-What-27s+Here].
|
# - Inherits from {class Object}[rdoc-ref:Object@What-27s+Here].
|
||||||
#
|
#
|
||||||
# This is a categorized summary of methods and attributes.
|
# This is a categorized summary of methods and attributes.
|
||||||
#
|
#
|
||||||
|
@ -288,7 +288,10 @@ class Gem::Version
|
|||||||
# 1.3.5 and earlier) compatibility.
|
# 1.3.5 and earlier) compatibility.
|
||||||
|
|
||||||
def marshal_load(array)
|
def marshal_load(array)
|
||||||
initialize array[0]
|
string = array[0]
|
||||||
|
raise TypeError, "wrong version string" unless string.is_a?(String)
|
||||||
|
|
||||||
|
initialize string
|
||||||
end
|
end
|
||||||
|
|
||||||
def yaml_initialize(tag, map) # :nodoc:
|
def yaml_initialize(tag, map) # :nodoc:
|
||||||
|
@ -194,7 +194,7 @@ RSpec.describe "Self management" do
|
|||||||
expect(out).to include("Using bundler #{Bundler::VERSION}")
|
expect(out).to include("Using bundler #{Bundler::VERSION}")
|
||||||
end
|
end
|
||||||
|
|
||||||
it "uses the right original script when re-execing, even if `$0` has been changed", :ruby_repo do
|
it "uses the right original script when re-execing, if `$0` has been changed to something that's not a script", :ruby_repo do
|
||||||
bundle "config path vendor/bundle"
|
bundle "config path vendor/bundle"
|
||||||
|
|
||||||
system_gems "bundler-9.9.9", path: vendored_gems
|
system_gems "bundler-9.9.9", path: vendored_gems
|
||||||
@ -213,6 +213,29 @@ RSpec.describe "Self management" do
|
|||||||
expect(err).not_to include("this is the program name")
|
expect(err).not_to include("this is the program name")
|
||||||
end
|
end
|
||||||
|
|
||||||
|
it "uses modified $0 when re-execing, if `$0` has been changed to a script", :ruby_repo do
|
||||||
|
bundle "config path vendor/bundle"
|
||||||
|
|
||||||
|
system_gems "bundler-9.9.9", path: vendored_gems
|
||||||
|
|
||||||
|
runner = bundled_app("runner.rb")
|
||||||
|
|
||||||
|
create_file runner, <<~RUBY
|
||||||
|
$0 = ARGV.shift
|
||||||
|
load $0
|
||||||
|
RUBY
|
||||||
|
|
||||||
|
script = bundled_app("script.rb")
|
||||||
|
create_file script, <<~RUBY
|
||||||
|
require "bundler/setup"
|
||||||
|
RUBY
|
||||||
|
|
||||||
|
lockfile_bundled_with("9.9.9")
|
||||||
|
|
||||||
|
sys_exec "#{Gem.ruby} #{runner} #{script}", artifice: nil, raise_on_error: false
|
||||||
|
expect(err).to include("Could not find myrack-1.0.0")
|
||||||
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
def lockfile_bundled_with(version)
|
def lockfile_bundled_with(version)
|
||||||
|
@ -16,8 +16,6 @@ class TestGemCommandsInstallCommand < Gem::TestCase
|
|||||||
@cmd.options[:document] = []
|
@cmd.options[:document] = []
|
||||||
|
|
||||||
@gemdeps = "tmp_install_gemdeps"
|
@gemdeps = "tmp_install_gemdeps"
|
||||||
|
|
||||||
common_installer_setup
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def teardown
|
def teardown
|
||||||
@ -667,7 +665,7 @@ ERROR: Possible alternatives: non_existent_with_hint
|
|||||||
|
|
||||||
assert_path_exist File.join(a2.doc_dir, "ri")
|
assert_path_exist File.join(a2.doc_dir, "ri")
|
||||||
assert_path_exist File.join(a2.doc_dir, "rdoc")
|
assert_path_exist File.join(a2.doc_dir, "rdoc")
|
||||||
end if defined?(Gem::RDoc)
|
end unless Gem.rdoc_hooks_defined_via_plugin?
|
||||||
|
|
||||||
def test_execute_rdoc_with_path
|
def test_execute_rdoc_with_path
|
||||||
specs = spec_fetcher do |fetcher|
|
specs = spec_fetcher do |fetcher|
|
||||||
@ -703,7 +701,7 @@ ERROR: Possible alternatives: non_existent_with_hint
|
|||||||
wait_for_child_process_to_exit
|
wait_for_child_process_to_exit
|
||||||
|
|
||||||
assert_path_exist "whatever/doc/a-2", "documentation not installed"
|
assert_path_exist "whatever/doc/a-2", "documentation not installed"
|
||||||
end if defined?(Gem::RDoc)
|
end unless Gem.rdoc_hooks_defined_via_plugin?
|
||||||
|
|
||||||
def test_execute_saves_build_args
|
def test_execute_saves_build_args
|
||||||
specs = spec_fetcher do |fetcher|
|
specs = spec_fetcher do |fetcher|
|
||||||
|
@ -506,7 +506,7 @@ class TestGemCommandsUpdateCommand < Gem::TestCase
|
|||||||
a2 = @specs["a-2"]
|
a2 = @specs["a-2"]
|
||||||
|
|
||||||
assert_path_exist File.join(a2.doc_dir, "rdoc")
|
assert_path_exist File.join(a2.doc_dir, "rdoc")
|
||||||
end if defined?(Gem::RDoc)
|
end unless Gem.rdoc_hooks_defined_via_plugin?
|
||||||
|
|
||||||
def test_execute_named
|
def test_execute_named
|
||||||
spec_fetcher do |fetcher|
|
spec_fetcher do |fetcher|
|
||||||
|
@ -233,6 +233,14 @@ class TestGemSafeMarshal < Gem::TestCase
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def test_link_after_float
|
||||||
|
pend "Marshal.load of links and floats is broken on truffleruby, see https://github.com/oracle/truffleruby/issues/3747" if RUBY_ENGINE == "truffleruby"
|
||||||
|
|
||||||
|
a = []
|
||||||
|
a << a
|
||||||
|
assert_safe_load_as [0.0, a, 1.0, a]
|
||||||
|
end
|
||||||
|
|
||||||
def test_hash_with_ivar
|
def test_hash_with_ivar
|
||||||
h = { runtime: :development }
|
h = { runtime: :development }
|
||||||
h.instance_variable_set :@type, []
|
h.instance_variable_set :@type, []
|
||||||
@ -257,6 +265,31 @@ class TestGemSafeMarshal < Gem::TestCase
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
class UserMarshal
|
||||||
|
def marshal_load(*)
|
||||||
|
throw "#{self.class}#marshal_load called"
|
||||||
|
end
|
||||||
|
|
||||||
|
def marshal_dump
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def test_time_user_marshal
|
||||||
|
payload = [
|
||||||
|
Marshal::MAJOR_VERSION.chr, Marshal::MINOR_VERSION.chr,
|
||||||
|
"I", # TYPE_IVAR
|
||||||
|
"u", # TYPE_USERDEF
|
||||||
|
Marshal.dump(:Time)[2..-1],
|
||||||
|
Marshal.dump(0xfb - 5)[3..-1],
|
||||||
|
Marshal.dump(1)[3..-1],
|
||||||
|
Marshal.dump(:zone)[2..-1],
|
||||||
|
Marshal.dump(UserMarshal.new)[2..-1],
|
||||||
|
("\x00" * (236 - UserMarshal.name.bytesize))
|
||||||
|
].join
|
||||||
|
|
||||||
|
assert_raise(Gem::SafeMarshal::Visitors::ToRuby::TimeTooLargeError, TypeError) { Gem::SafeMarshal.safe_load(payload) }
|
||||||
|
end
|
||||||
|
|
||||||
class StringSubclass < ::String
|
class StringSubclass < ::String
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -323,6 +356,22 @@ class TestGemSafeMarshal < Gem::TestCase
|
|||||||
assert_equal ["MIT"], unmarshalled_spec.license
|
assert_equal ["MIT"], unmarshalled_spec.license
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def test_gem_spec_unmarshall_required_ruby_rubygems_version
|
||||||
|
spec = Gem::Specification.new do |s|
|
||||||
|
s.name = "hi"
|
||||||
|
s.version = "1.2.3"
|
||||||
|
s.license = "MIT"
|
||||||
|
end
|
||||||
|
|
||||||
|
assert_safe_load_marshal spec._dump(0), inspect: false, to_s: false
|
||||||
|
assert_safe_load_marshal Marshal.dump(spec), inspect: false, additional_methods: [:to_ruby, :required_ruby_version, :required_rubygems_version]
|
||||||
|
|
||||||
|
unmarshalled_spec = Gem::SafeMarshal.safe_load(Marshal.dump(spec))
|
||||||
|
|
||||||
|
assert_equal Gem::Requirement.new(">= 0"), unmarshalled_spec.required_ruby_version
|
||||||
|
assert_equal Gem::Requirement.new(">= 0"), unmarshalled_spec.required_rubygems_version
|
||||||
|
end
|
||||||
|
|
||||||
def test_gem_spec_disallowed_symbol
|
def test_gem_spec_disallowed_symbol
|
||||||
e = assert_raise(Gem::SafeMarshal::Visitors::ToRuby::UnpermittedSymbolError) do
|
e = assert_raise(Gem::SafeMarshal::Visitors::ToRuby::UnpermittedSymbolError) do
|
||||||
spec = Gem::Specification.new do |s|
|
spec = Gem::Specification.new do |s|
|
||||||
@ -366,11 +415,45 @@ class TestGemSafeMarshal < Gem::TestCase
|
|||||||
Gem::SafeMarshal.safe_load("\x04\x08[\x06")
|
Gem::SafeMarshal.safe_load("\x04\x08[\x06")
|
||||||
end
|
end
|
||||||
assert_equal e.message, "Unexpected EOF"
|
assert_equal e.message, "Unexpected EOF"
|
||||||
|
|
||||||
|
e = assert_raise(Gem::SafeMarshal::Reader::EOFError) do
|
||||||
|
Gem::SafeMarshal.safe_load("\004\010:\012")
|
||||||
|
end
|
||||||
|
assert_equal e.message, "expected 5 bytes, got EOF"
|
||||||
|
|
||||||
|
e = assert_raise(Gem::SafeMarshal::Reader::EOFError) do
|
||||||
|
Gem::SafeMarshal.safe_load("\x04\x08i\x01")
|
||||||
|
end
|
||||||
|
assert_equal e.message, "Unexpected EOF"
|
||||||
|
e = assert_raise(Gem::SafeMarshal::Reader::EOFError) do
|
||||||
|
Gem::SafeMarshal.safe_load("\x04\x08\"\x06")
|
||||||
|
end
|
||||||
|
assert_equal e.message, "expected 1 bytes, got EOF"
|
||||||
end
|
end
|
||||||
|
|
||||||
def assert_safe_load_marshal(dumped, additional_methods: [], permitted_ivars: nil, equality: true, marshal_dump_equality: true)
|
def test_negative_length
|
||||||
|
assert_raise(Gem::SafeMarshal::Reader::NegativeLengthError) do
|
||||||
|
Gem::SafeMarshal.safe_load("\004\010}\325")
|
||||||
|
end
|
||||||
|
assert_raise(Gem::SafeMarshal::Reader::NegativeLengthError) do
|
||||||
|
Gem::SafeMarshal.safe_load("\004\010:\325")
|
||||||
|
end
|
||||||
|
assert_raise(Gem::SafeMarshal::Reader::NegativeLengthError) do
|
||||||
|
Gem::SafeMarshal.safe_load("\004\010\"\325")
|
||||||
|
end
|
||||||
|
assert_raise(IndexError) do
|
||||||
|
Gem::SafeMarshal.safe_load("\004\010;\325")
|
||||||
|
end
|
||||||
|
assert_raise(Gem::SafeMarshal::Reader::EOFError) do
|
||||||
|
Gem::SafeMarshal.safe_load("\004\010@\377")
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def assert_safe_load_marshal(dumped, additional_methods: [], permitted_ivars: nil, equality: true, marshal_dump_equality: true,
|
||||||
|
inspect: true, to_s: true)
|
||||||
loaded = Marshal.load(dumped)
|
loaded = Marshal.load(dumped)
|
||||||
safe_loaded =
|
safe_loaded =
|
||||||
|
assert_nothing_raised("dumped: #{dumped.b.inspect} loaded: #{loaded.inspect}") do
|
||||||
if permitted_ivars
|
if permitted_ivars
|
||||||
with_const(Gem::SafeMarshal, :PERMITTED_IVARS, permitted_ivars) do
|
with_const(Gem::SafeMarshal, :PERMITTED_IVARS, permitted_ivars) do
|
||||||
Gem::SafeMarshal.safe_load(dumped)
|
Gem::SafeMarshal.safe_load(dumped)
|
||||||
@ -378,14 +461,15 @@ class TestGemSafeMarshal < Gem::TestCase
|
|||||||
else
|
else
|
||||||
Gem::SafeMarshal.safe_load(dumped)
|
Gem::SafeMarshal.safe_load(dumped)
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
|
||||||
# NaN != NaN, for example
|
# NaN != NaN, for example
|
||||||
if equality
|
if equality
|
||||||
assert_equal loaded, safe_loaded, "should equal what Marshal.load returns"
|
assert_equal loaded, safe_loaded, "should equal what Marshal.load returns"
|
||||||
end
|
end
|
||||||
|
|
||||||
assert_equal loaded.to_s, safe_loaded.to_s, "should have equal to_s"
|
assert_equal loaded.to_s, safe_loaded.to_s, "should have equal to_s" if to_s
|
||||||
assert_equal loaded.inspect, safe_loaded.inspect, "should have equal inspect"
|
assert_equal loaded.inspect, safe_loaded.inspect, "should have equal inspect" if inspect
|
||||||
additional_methods.each do |m|
|
additional_methods.each do |m|
|
||||||
if m.is_a?(Proc)
|
if m.is_a?(Proc)
|
||||||
call = m
|
call = m
|
||||||
|
@ -2492,7 +2492,31 @@ end
|
|||||||
assert_equal @a1, same_spec
|
assert_equal @a1, same_spec
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_to_yaml_platform_empty_string
|
def test_to_yaml_platform
|
||||||
|
yaml_str = @a1.to_yaml
|
||||||
|
|
||||||
|
assert_match(/^platform: ruby$/, yaml_str)
|
||||||
|
refute_match(/^original_platform: /, yaml_str)
|
||||||
|
end
|
||||||
|
|
||||||
|
def test_to_yaml_platform_no_specific_platform
|
||||||
|
a = Gem::Specification.new do |s|
|
||||||
|
s.name = "a"
|
||||||
|
s.version = "1.0"
|
||||||
|
s.author = "A User"
|
||||||
|
s.email = "example@example.com"
|
||||||
|
s.homepage = "http://example.com"
|
||||||
|
s.summary = "this is a summary"
|
||||||
|
s.description = "This is a test description"
|
||||||
|
end
|
||||||
|
|
||||||
|
yaml_str = a.to_yaml
|
||||||
|
|
||||||
|
assert_match(/^platform: ruby$/, yaml_str)
|
||||||
|
refute_match(/^original_platform: /, yaml_str)
|
||||||
|
end
|
||||||
|
|
||||||
|
def test_to_yaml_platform_original_platform_empty_string
|
||||||
@a1.instance_variable_set :@original_platform, ""
|
@a1.instance_variable_set :@original_platform, ""
|
||||||
|
|
||||||
assert_match(/^platform: ruby$/, @a1.to_yaml)
|
assert_match(/^platform: ruby$/, @a1.to_yaml)
|
||||||
@ -2510,7 +2534,7 @@ end
|
|||||||
assert_equal "powerpc-darwin7.9.0", same_spec.original_platform
|
assert_equal "powerpc-darwin7.9.0", same_spec.original_platform
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_to_yaml_platform_nil
|
def test_to_yaml_platform_original_platform_nil
|
||||||
@a1.instance_variable_set :@original_platform, nil
|
@a1.instance_variable_set :@original_platform, nil
|
||||||
|
|
||||||
assert_match(/^platform: ruby$/, @a1.to_yaml)
|
assert_match(/^platform: ruby$/, @a1.to_yaml)
|
||||||
@ -3630,6 +3654,8 @@ Did you mean 'Ruby'?
|
|||||||
end
|
end
|
||||||
|
|
||||||
def test__load_fixes_Date_objects
|
def test__load_fixes_Date_objects
|
||||||
|
pend "Marshal.load of links and floats is broken on truffleruby, see https://github.com/oracle/truffleruby/issues/3747" if RUBY_ENGINE == "truffleruby"
|
||||||
|
|
||||||
spec = util_spec "a", 1
|
spec = util_spec "a", 1
|
||||||
spec.instance_variable_set :@date, Date.today
|
spec.instance_variable_set :@date, Date.today
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user