Skip to content

Conan Ruby 3.2.2 darwin tarballs: rubygems.rb eager spec_fetcher require breaks Bundler default gem activation & strip AppleDouble files #5666

Open

Description

@anchapin

Context

While verifying the macOS ARM64 (ruby-3.2.2-darwin-arm64.tar.gz) and Intel (ruby-3.2.2-darwin.tar.gz) portable Conan Ruby packages in s3://openstudio-resources/pat-dependencies3/ for NatLabRockies/OpenStudio-PAT#311, we identified two upstream packaging issues in the Conan Ruby 3.2.2 build/archive:

1. Custom lib/ruby/3.2.0/rubygems.rb modification pre-activates securerandom 0.2.2 before Bundler runs

In the Conan Ruby 3.2.2 build (ruby/3.2.2#e349279c358fd8f54d83446a3af8ecfe), lib/ruby/3.2.0/rubygems.rb replaces upstream Ruby's autoload declarations with eager require calls at the bottom of rubygems.rb (lines 1397–1406) before Gem::Specification.load_defaults runs:

require 'rubygems/config_file'
require 'rubygems/BundlerVersionFinder' # ...
require 'rubygems/spec_fetcher'

Because rubygems/spec_fetcher requires rubygems/remote_fetcher -> resolv -> securerandom, and Gem::Specification.load_defaults has not yet registered the default gems, Ruby loads securerandom from stdlib and then registers securerandom-0.2.2 as an already-activated default gem specification once load_defaults executes.

When OpenStudio-server subsequently runs Bundler.setup with a Gemfile.lock that locks securerandom (0.4.1), Bundler raises:

Gem::LoadError: You have already activated securerandom 0.2.2, but your Gemfile requires securerandom 0.4.1. Prepending `bundle exec` to your command may solve this.

Fix: Either restore upstream Ruby 3.2.2's autoload :SpecFetcher, "rubygems/spec_fetcher" in lib/ruby/3.2.0/rubygems.rb, or ensure Gem::Specification.load_defaults runs before any eager require of rubygems/spec_fetcher.

2. macOS ._* AppleDouble resource fork files in ruby-3.2.2-darwin-arm64.tar.gz

ruby-3.2.2-darwin-arm64.tar.gz in s3://openstudio-resources/pat-dependencies3/ was archived on macOS without COPYFILE_DISABLE=1, leaving ._* AppleDouble files throughout ruby/.
Fix: Repackage ruby-3.2.2-darwin-arm64.tar.gz (and any macOS dependency tarballs) with COPYFILE_DISABLE=1 tar -czf ....

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions