NREL / OpenStudio

OpenStudio is a cross-platform collection of software tools to support whole building energy modeling using EnergyPlus and advanced daylight analysis using Radiance.
https://www.openstudio.net/
Other
484 stars 185 forks source link

Embedded ruby 3.2.2 in CLI is missing "RUBY_DESCRIPTION" global constant #5178

Closed jmarrec closed 2 months ago

jmarrec commented 2 months ago

Issue overview

Missing RUBY_DESCRIPTION constant in ruby 3.2.2.

Caught while testing openstudio-ee-gem, with a VERY cryptic message:

NameError: uninitialized constant Git::Lib::RUBY_DESCRIPTION

This is because git 1.12.0 (which is quite old too, 1.19.1 is out, and there's a 2.0.0-pre too, probably should update @DavidGoldwasser ) uses it https://github.com/ruby-git/ruby-git/blob/ea79dadf07e65896a08487af011e60336e86d3e3/lib/git/lib.rb#L1209-L1213

The same would happen with this

module Test
  class Lib
    def f
      puts NON_DEFINED_CONSTANT
    end
  end
end

Test::Lib.new.f()
openstudio test.rb
Error: uninitialized constant Test::Lib::NON_DEFINED_CONSTANT

Current Behavior

It fails

Expected Behavior

It should be there

Steps to Reproduce

1. 2. 3. 4.

Possible Solution

https://github.com/NREL/OpenStudio/blob/ca6043ee1660ddab352b1b39329706e026382203/ruby/engine/InitRubyEngine.cpp#L280

Init_ruby_description is needed. Note that it doesn't take void param anymore but a pointer to a typedefed struct...

Details

Environment

Some additional details about your environment for this issue (if relevant):

Context

testing on openstudio-ee-gem