Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package rubygem-bootsnap for openSUSE:Factory checked in at 2022-02-24 18:20:14 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/rubygem-bootsnap (Old) and /work/SRC/openSUSE:Factory/.rubygem-bootsnap.new.1958 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "rubygem-bootsnap" Thu Feb 24 18:20:14 2022 rev:17 rq:956112 version:1.10.3 Changes: -------- --- /work/SRC/openSUSE:Factory/rubygem-bootsnap/rubygem-bootsnap.changes 2022-02-07 23:38:31.598265353 +0100 +++ /work/SRC/openSUSE:Factory/.rubygem-bootsnap.new.1958/rubygem-bootsnap.changes 2022-02-24 18:23:29.446657702 +0100 @@ -1,0 +2,25 @@ +Tue Feb 15 07:24:24 UTC 2022 - Stephan Kulow <co...@suse.com> + +updated to version 1.10.3 + see installed CHANGELOG.md + + # 1.10.3 + + * Fix Regexp and Date type support in YAML compile cache. (#400) + + * Improve the YAML compile cache to support `UTF-8` symbols. (#398, #399) + [The default `MessagePack` symbol serializer assumes all symbols are ASCII](https://github.com/msgpack/msgpack-ruby/pull/211), + because of this, non-ASCII compatible symbol would be restored with `ASCII_8BIT` encoding (AKA `BINARY`). + Bootsnap now properly cache them in `UTF-8`. + + Note that the above only apply for actual YAML symbols (e..g `--- :foo`). + The issue is still present for string keys parsed with `YAML.load_file(..., symbolize_names: true)`, that is a bug + in `msgpack` that will hopefully be solved soon, see: https://github.com/msgpack/msgpack-ruby/pull/246 + + * Entirely disable the YAML compile cache if `Encoding.default_internal` is set to an encoding not supported by `msgpack`. (#398) + `Psych` coerce strings to `Encoding.default_internal`, but `MessagePack` doesn't. So in this scenario we can't provide + YAML caching at all without returning the strings in the wrong encoding. + This never came up in practice but might as well be safe. + + +------------------------------------------------------------------- Old: ---- bootsnap-1.10.2.gem New: ---- bootsnap-1.10.3.gem ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ rubygem-bootsnap.spec ++++++ --- /var/tmp/diff_new_pack.C9qKhN/_old 2022-02-24 18:23:29.866657590 +0100 +++ /var/tmp/diff_new_pack.C9qKhN/_new 2022-02-24 18:23:29.870657589 +0100 @@ -24,7 +24,7 @@ # Name: rubygem-bootsnap -Version: 1.10.2 +Version: 1.10.3 Release: 0 %define mod_name bootsnap %define mod_full_name %{mod_name}-%{version} ++++++ bootsnap-1.10.2.gem -> bootsnap-1.10.3.gem ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/CHANGELOG.md new/CHANGELOG.md --- old/CHANGELOG.md 2022-01-21 15:49:27.000000000 +0100 +++ new/CHANGELOG.md 2022-02-02 09:29:18.000000000 +0100 @@ -1,5 +1,23 @@ # Unreleased +# 1.10.3 + +* Fix Regexp and Date type support in YAML compile cache. (#400) + +* Improve the YAML compile cache to support `UTF-8` symbols. (#398, #399) + [The default `MessagePack` symbol serializer assumes all symbols are ASCII](https://github.com/msgpack/msgpack-ruby/pull/211), + because of this, non-ASCII compatible symbol would be restored with `ASCII_8BIT` encoding (AKA `BINARY`). + Bootsnap now properly cache them in `UTF-8`. + + Note that the above only apply for actual YAML symbols (e..g `--- :foo`). + The issue is still present for string keys parsed with `YAML.load_file(..., symbolize_names: true)`, that is a bug + in `msgpack` that will hopefully be solved soon, see: https://github.com/msgpack/msgpack-ruby/pull/246 + +* Entirely disable the YAML compile cache if `Encoding.default_internal` is set to an encoding not supported by `msgpack`. (#398) + `Psych` coerce strings to `Encoding.default_internal`, but `MessagePack` doesn't. So in this scenario we can't provide + YAML caching at all without returning the strings in the wrong encoding. + This never came up in practice but might as well be safe. + # 1.10.2 * Reduce the `Kernel.require` extra stack frames some more. Now bootsnap should only add one extra frame per `require` call. @@ -22,7 +40,7 @@ Since `1.8.0`, `YAML.load_file` was no longer cached when Psych 4 was used. This is because `load_file` loads in safe mode by default, so the Bootsnap cache could defeat that safety. Now when precompiling YAML files, Bootsnap first try to parse them in safe mode, and if it can't fallback to unsafe mode, - and the cache contains a flag that records wether it was generated in safe mode or not. + and the cache contains a flag that records whether it was generated in safe mode or not. `YAML.unsafe_load_file` will use safe caches just fine, but `YAML.load_file` will fallback to uncached YAML parsing if the cache was generated using unsafe parsing. @@ -63,7 +81,7 @@ # 1.8.0 -* Improve support for Pysch 4. (#368) +* Improve support for Psych 4. (#368) # 1.7.7 @@ -81,8 +99,8 @@ # 1.7.4 -* Stop raising errors when encoutering various file system errors. The cache is now best effort, - if somehow it can't be saved, bootsnapp will gracefully fallback to the original operation (e.g. `Kernel.require`). +* Stop raising errors when encountering various file system errors. The cache is now best effort, + if somehow it can't be saved, bootsnap will gracefully fallback to the original operation (e.g. `Kernel.require`). (#353, #177, #262) # 1.7.3 Binary files old/checksums.yaml.gz and new/checksums.yaml.gz differ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ext/bootsnap/bootsnap.c new/ext/bootsnap/bootsnap.c --- old/ext/bootsnap/bootsnap.c 2022-01-21 15:49:27.000000000 +0100 +++ new/ext/bootsnap/bootsnap.c 2022-02-02 09:29:18.000000000 +0100 @@ -2,7 +2,7 @@ * Suggested reading order: * 1. Skim Init_bootsnap * 2. Skim bs_fetch - * 3. The rest of everything + * 3. The rest of everyrything * * Init_bootsnap sets up the ruby objects and binds bs_fetch to * Bootsnap::CompileCache::Native.fetch. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/bootsnap/compile_cache/yaml.rb new/lib/bootsnap/compile_cache/yaml.rb --- old/lib/bootsnap/compile_cache/yaml.rb 2022-01-21 15:49:27.000000000 +0100 +++ new/lib/bootsnap/compile_cache/yaml.rb 2022-02-02 09:29:18.000000000 +0100 @@ -5,7 +5,15 @@ module Bootsnap module CompileCache module YAML - UnsupportedTags = Class.new(StandardError) + Uncompilable = Class.new(StandardError) + UnsupportedTags = Class.new(Uncompilable) + + SUPPORTED_INTERNAL_ENCODINGS = [ + nil, # UTF-8 + Encoding::UTF_8, + Encoding::ASCII, + Encoding::BINARY, + ].freeze class << self attr_accessor(:msgpack_factory, :supported_options) @@ -16,7 +24,9 @@ end def precompile(path) - Bootsnap::CompileCache::Native.precompile( + return false unless CompileCache::YAML.supported_internal_encoding? + + CompileCache::Native.precompile( cache_dir, path.to_s, @implementation, @@ -29,6 +39,21 @@ ::YAML.singleton_class.prepend(@implementation::Patch) end + # Psych coerce strings to `Encoding.default_internal` but Message Pack only support + # UTF-8, US-ASCII and BINARY. So if Encoding.default_internal is set to anything else + # we can't safely use the cache + def supported_internal_encoding? + SUPPORTED_INTERNAL_ENCODINGS.include?(Encoding.default_internal) + end + + module EncodingAwareSymbols + extend self + + def unpack(payload) + (+payload).force_encoding(Encoding::UTF_8).to_sym + end + end + def init! require("yaml") require("msgpack") @@ -43,7 +68,12 @@ # We want them to roundtrip cleanly, so we use a custom factory. # see: https://github.com/msgpack/msgpack-ruby/pull/122 factory = MessagePack::Factory.new - factory.register_type(0x00, Symbol) + factory.register_type( + 0x00, + Symbol, + packer: :to_msgpack_ext, + unpacker: EncodingAwareSymbols.method(:unpack).to_proc, + ) if defined? MessagePack::Timestamp factory.register_type( @@ -119,13 +149,15 @@ extend self def input_to_storage(contents, _) - obj = CompileCache::YAML.strict_load(contents) + obj = ::YAML.unsafe_load(contents) packer = CompileCache::YAML.msgpack_factory.packer packer.pack(false) # not safe loaded - packer.pack(obj) + begin + packer.pack(obj) + rescue NoMethodError, RangeError + return UNCOMPILABLE # The object included things that we can't serialize + end packer.to_s - rescue NoMethodError, RangeError, UnsupportedTags - UNCOMPILABLE # The object included things that we can't serialize end def storage_to_output(data, kwargs) @@ -148,13 +180,20 @@ extend self def input_to_storage(contents, _) - obj = ::YAML.load(contents) + obj = begin + CompileCache::YAML.strict_load(contents) + rescue Psych::DisallowedClass, Psych::BadAlias, Uncompilable + return UNCOMPILABLE + end + packer = CompileCache::YAML.msgpack_factory.packer packer.pack(true) # safe loaded - packer.pack(obj) + begin + packer.pack(obj) + rescue NoMethodError, RangeError + return UNCOMPILABLE + end packer.to_s - rescue NoMethodError, RangeError, Psych::DisallowedClass, Psych::BadAlias - UNCOMPILABLE # The object included things that we can't serialize end def storage_to_output(data, kwargs) @@ -179,44 +218,48 @@ module Patch def load_file(path, *args) + return super unless CompileCache::YAML.supported_internal_encoding? + return super if args.size > 1 if (kwargs = args.first) return super unless kwargs.is_a?(Hash) - return super unless (kwargs.keys - ::Bootsnap::CompileCache::YAML.supported_options).empty? + return super unless (kwargs.keys - CompileCache::YAML.supported_options).empty? end begin - ::Bootsnap::CompileCache::Native.fetch( - Bootsnap::CompileCache::YAML.cache_dir, + CompileCache::Native.fetch( + CompileCache::YAML.cache_dir, File.realpath(path), - ::Bootsnap::CompileCache::YAML::Psych4::SafeLoad, + CompileCache::YAML::Psych4::SafeLoad, kwargs, ) rescue Errno::EACCES - ::Bootsnap::CompileCache.permission_error(path) + CompileCache.permission_error(path) end end ruby2_keywords :load_file if respond_to?(:ruby2_keywords, true) def unsafe_load_file(path, *args) + return super unless CompileCache::YAML.supported_internal_encoding? + return super if args.size > 1 if (kwargs = args.first) return super unless kwargs.is_a?(Hash) - return super unless (kwargs.keys - ::Bootsnap::CompileCache::YAML.supported_options).empty? + return super unless (kwargs.keys - CompileCache::YAML.supported_options).empty? end begin - ::Bootsnap::CompileCache::Native.fetch( - Bootsnap::CompileCache::YAML.cache_dir, + CompileCache::Native.fetch( + CompileCache::YAML.cache_dir, File.realpath(path), - ::Bootsnap::CompileCache::YAML::Psych4::UnsafeLoad, + CompileCache::YAML::Psych4::UnsafeLoad, kwargs, ) rescue Errno::EACCES - ::Bootsnap::CompileCache.permission_error(path) + CompileCache.permission_error(path) end end @@ -228,13 +271,15 @@ extend self def input_to_storage(contents, _) - obj = CompileCache::YAML.strict_load(contents) + obj = ::YAML.load(contents) packer = CompileCache::YAML.msgpack_factory.packer packer.pack(false) # not safe loaded - packer.pack(obj) + begin + packer.pack(obj) + rescue NoMethodError, RangeError + return UNCOMPILABLE # The object included things that we can't serialize + end packer.to_s - rescue NoMethodError, RangeError, UnsupportedTags - UNCOMPILABLE # The object included things that we can't serialize end def storage_to_output(data, kwargs) @@ -253,44 +298,48 @@ module Patch def load_file(path, *args) + return super unless CompileCache::YAML.supported_internal_encoding? + return super if args.size > 1 if (kwargs = args.first) return super unless kwargs.is_a?(Hash) - return super unless (kwargs.keys - ::Bootsnap::CompileCache::YAML.supported_options).empty? + return super unless (kwargs.keys - CompileCache::YAML.supported_options).empty? end begin - ::Bootsnap::CompileCache::Native.fetch( - Bootsnap::CompileCache::YAML.cache_dir, + CompileCache::Native.fetch( + CompileCache::YAML.cache_dir, File.realpath(path), - ::Bootsnap::CompileCache::YAML::Psych3, + CompileCache::YAML::Psych3, kwargs, ) rescue Errno::EACCES - ::Bootsnap::CompileCache.permission_error(path) + CompileCache.permission_error(path) end end ruby2_keywords :load_file if respond_to?(:ruby2_keywords, true) def unsafe_load_file(path, *args) + return super unless CompileCache::YAML.supported_internal_encoding? + return super if args.size > 1 if (kwargs = args.first) return super unless kwargs.is_a?(Hash) - return super unless (kwargs.keys - ::Bootsnap::CompileCache::YAML.supported_options).empty? + return super unless (kwargs.keys - CompileCache::YAML.supported_options).empty? end begin - ::Bootsnap::CompileCache::Native.fetch( - Bootsnap::CompileCache::YAML.cache_dir, + CompileCache::Native.fetch( + CompileCache::YAML.cache_dir, File.realpath(path), - ::Bootsnap::CompileCache::YAML::Psych3, + CompileCache::YAML::Psych3, kwargs, ) rescue Errno::EACCES - ::Bootsnap::CompileCache.permission_error(path) + CompileCache.permission_error(path) end end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/bootsnap/compile_cache.rb new/lib/bootsnap/compile_cache.rb --- old/lib/bootsnap/compile_cache.rb 2022-01-21 15:49:27.000000000 +0100 +++ new/lib/bootsnap/compile_cache.rb 2022-02-02 09:29:18.000000000 +0100 @@ -3,6 +3,9 @@ module Bootsnap module CompileCache UNCOMPILABLE = BasicObject.new + def UNCOMPILABLE.inspect + "<Bootsnap::UNCOMPILABLE>" + end Error = Class.new(StandardError) PermissionError = Class.new(Error) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/bootsnap/version.rb new/lib/bootsnap/version.rb --- old/lib/bootsnap/version.rb 2022-01-21 15:49:27.000000000 +0100 +++ new/lib/bootsnap/version.rb 2022-02-02 09:29:18.000000000 +0100 @@ -1,5 +1,5 @@ # frozen_string_literal: true module Bootsnap - VERSION = "1.10.2" + VERSION = "1.10.3" end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/bootsnap.rb new/lib/bootsnap.rb --- old/lib/bootsnap.rb 2022-01-21 15:49:27.000000000 +0100 +++ new/lib/bootsnap.rb 2022-02-02 09:29:18.000000000 +0100 @@ -10,128 +10,128 @@ class << self attr_reader :logger - end - def self.log! - self.logger = $stderr.method(:puts) - end + def log! + self.logger = $stderr.method(:puts) + end - def self.logger=(logger) - @logger = logger - self.instrumentation = if logger.respond_to?(:debug) - ->(event, path) { @logger.debug("[Bootsnap] #{event} #{path}") } - else - ->(event, path) { @logger.call("[Bootsnap] #{event} #{path}") } + def logger=(logger) + @logger = logger + self.instrumentation = if logger.respond_to?(:debug) + ->(event, path) { @logger.debug("[Bootsnap] #{event} #{path}") } + else + ->(event, path) { @logger.call("[Bootsnap] #{event} #{path}") } + end end - end - def self.instrumentation=(callback) - @instrumentation = callback - if respond_to?(:instrumentation_enabled=, true) - self.instrumentation_enabled = !!callback + def instrumentation=(callback) + @instrumentation = callback + if respond_to?(:instrumentation_enabled=, true) + self.instrumentation_enabled = !!callback + end end - end - def self._instrument(event, path) - @instrumentation.call(event, path) - end + def _instrument(event, path) + @instrumentation.call(event, path) + end + + def setup( + cache_dir:, + development_mode: true, + load_path_cache: true, + autoload_paths_cache: nil, + disable_trace: nil, + compile_cache_iseq: true, + compile_cache_yaml: true, + compile_cache_json: true + ) + unless autoload_paths_cache.nil? + warn "[DEPRECATED] Bootsnap's `autoload_paths_cache:` option is deprecated and will be removed. " \ + "If you use Zeitwerk this option is useless, and if you are still using the classic autoloader " \ + "upgrading is recommended." + end + + unless disable_trace.nil? + warn "[DEPRECATED] Bootsnap's `disable_trace:` option is deprecated and will be removed. " \ + "If you use Ruby 2.5 or newer this option is useless, if not upgrading is recommended." + end + + if compile_cache_iseq && !iseq_cache_supported? + warn "Ruby 2.5 has a bug that break code tracing when code is loaded from cache. It is recommened " \ + "to turn `compile_cache_iseq` off on Ruby 2.5" + end - def self.setup( - cache_dir:, - development_mode: true, - load_path_cache: true, - autoload_paths_cache: nil, - disable_trace: nil, - compile_cache_iseq: true, - compile_cache_yaml: true, - compile_cache_json: true - ) - unless autoload_paths_cache.nil? - warn "[DEPRECATED] Bootsnap's `autoload_paths_cache:` option is deprecated and will be removed. " \ - "If you use Zeitwerk this option is useless, and if you are still using the classic autoloader " \ - "upgrading is recommended." - end - - unless disable_trace.nil? - warn "[DEPRECATED] Bootsnap's `disable_trace:` option is deprecated and will be removed. " \ - "If you use Ruby 2.5 or newer this option is useless, if not upgrading is recommended." - end - - if compile_cache_iseq && !iseq_cache_supported? - warn "Ruby 2.5 has a bug that break code tracing when code is loaded from cache. It is recommened " \ - "to turn `compile_cache_iseq` off on Ruby 2.5" - end - - if load_path_cache - Bootsnap::LoadPathCache.setup( - cache_path: cache_dir + "/bootsnap/load-path-cache", - development_mode: development_mode, + if load_path_cache + Bootsnap::LoadPathCache.setup( + cache_path: cache_dir + "/bootsnap/load-path-cache", + development_mode: development_mode, + ) + end + + Bootsnap::CompileCache.setup( + cache_dir: cache_dir + "/bootsnap/compile-cache", + iseq: compile_cache_iseq, + yaml: compile_cache_yaml, + json: compile_cache_json, ) end - Bootsnap::CompileCache.setup( - cache_dir: cache_dir + "/bootsnap/compile-cache", - iseq: compile_cache_iseq, - yaml: compile_cache_yaml, - json: compile_cache_json, - ) - end + def iseq_cache_supported? + return @iseq_cache_supported if defined? @iseq_cache_supported - def self.iseq_cache_supported? - return @iseq_cache_supported if defined? @iseq_cache_supported + ruby_version = Gem::Version.new(RUBY_VERSION) + @iseq_cache_supported = ruby_version < Gem::Version.new("2.5.0") || ruby_version >= Gem::Version.new("2.6.0") + end - ruby_version = Gem::Version.new(RUBY_VERSION) - @iseq_cache_supported = ruby_version < Gem::Version.new("2.5.0") || ruby_version >= Gem::Version.new("2.6.0") - end + def default_setup + env = ENV["RAILS_ENV"] || ENV["RACK_ENV"] || ENV["ENV"] + development_mode = ["", nil, "development"].include?(env) - def self.default_setup - env = ENV["RAILS_ENV"] || ENV["RACK_ENV"] || ENV["ENV"] - development_mode = ["", nil, "development"].include?(env) - - unless ENV["DISABLE_BOOTSNAP"] - cache_dir = ENV["BOOTSNAP_CACHE_DIR"] - unless cache_dir - config_dir_frame = caller.detect do |line| - line.include?("/config/") - end + unless ENV["DISABLE_BOOTSNAP"] + cache_dir = ENV["BOOTSNAP_CACHE_DIR"] + unless cache_dir + config_dir_frame = caller.detect do |line| + line.include?("/config/") + end - unless config_dir_frame - $stderr.puts("[bootsnap/setup] couldn't infer cache directory! Either:") - $stderr.puts("[bootsnap/setup] 1. require bootsnap/setup from your application's config directory; or") - $stderr.puts("[bootsnap/setup] 2. Define the environment variable BOOTSNAP_CACHE_DIR") + unless config_dir_frame + $stderr.puts("[bootsnap/setup] couldn't infer cache directory! Either:") + $stderr.puts("[bootsnap/setup] 1. require bootsnap/setup from your application's config directory; or") + $stderr.puts("[bootsnap/setup] 2. Define the environment variable BOOTSNAP_CACHE_DIR") - raise("couldn't infer bootsnap cache directory") - end + raise("couldn't infer bootsnap cache directory") + end - path = config_dir_frame.split(/:\d+:/).first - path = File.dirname(path) until File.basename(path) == "config" - app_root = File.dirname(path) - - cache_dir = File.join(app_root, "tmp", "cache") - end + path = config_dir_frame.split(/:\d+:/).first + path = File.dirname(path) until File.basename(path) == "config" + app_root = File.dirname(path) - setup( - cache_dir: cache_dir, - development_mode: development_mode, - load_path_cache: !ENV["DISABLE_BOOTSNAP_LOAD_PATH_CACHE"], - compile_cache_iseq: !ENV["DISABLE_BOOTSNAP_COMPILE_CACHE"] && iseq_cache_supported?, - compile_cache_yaml: !ENV["DISABLE_BOOTSNAP_COMPILE_CACHE"], - compile_cache_json: !ENV["DISABLE_BOOTSNAP_COMPILE_CACHE"], - ) + cache_dir = File.join(app_root, "tmp", "cache") + end - if ENV["BOOTSNAP_LOG"] - log! + setup( + cache_dir: cache_dir, + development_mode: development_mode, + load_path_cache: !ENV["DISABLE_BOOTSNAP_LOAD_PATH_CACHE"], + compile_cache_iseq: !ENV["DISABLE_BOOTSNAP_COMPILE_CACHE"] && iseq_cache_supported?, + compile_cache_yaml: !ENV["DISABLE_BOOTSNAP_COMPILE_CACHE"], + compile_cache_json: !ENV["DISABLE_BOOTSNAP_COMPILE_CACHE"], + ) + + if ENV["BOOTSNAP_LOG"] + log! + end end end - end - if RbConfig::CONFIG["host_os"] =~ /mswin|mingw|cygwin/ - def self.absolute_path?(path) - path[1] == ":" - end - else - def self.absolute_path?(path) - path.start_with?("/") + if RbConfig::CONFIG["host_os"] =~ /mswin|mingw|cygwin/ + def absolute_path?(path) + path[1] == ":" + end + else + def absolute_path?(path) + path.start_with?("/") + end end end end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/metadata new/metadata --- old/metadata 2022-01-21 15:49:27.000000000 +0100 +++ new/metadata 2022-02-02 09:29:18.000000000 +0100 @@ -1,14 +1,14 @@ --- !ruby/object:Gem::Specification name: bootsnap version: !ruby/object:Gem::Version - version: 1.10.2 + version: 1.10.3 platform: ruby authors: - Burke Libbey autorequire: bindir: exe cert_chain: [] -date: 2022-01-21 00:00:00.000000000 Z +date: 2022-02-02 00:00:00.000000000 Z dependencies: - !ruby/object:Gem::Dependency name: msgpack