DragonBox / u3d

U3d is a cross-platform set of tools to interact with Unity3D from command line.
MIT License
361 stars 33 forks source link

unity_versions.rb:70 can't modify frozen String: "" #429

Closed chazix closed 1 year ago

chazix commented 2 years ago

Issue Checklist

Issue Description

benholtz commented 2 years ago

Issue Checklist

facing same issue on centos

# u3d available --trace --verbose
INFO Fetching central 'versions.json' cache
DEBUG Using http opts: {:use_ssl=>#<MatchData "https">, :read_timeout=>300}
WARN Cache is out of date. Updating cache for Linux
INFO Loading Unity releases
DEBUG FetchCookie?
/usr/local/rvm/gems/ruby-3.1.2/gems/u3d-1.3.2/lib/u3d/unity_versions.rb:70:in `block (2 levels) in fetch_cookie': can't modify frozen String: "" (FrozenError)
    from /usr/local/rvm/gems/ruby-3.1.2/gems/u3d-1.3.2/lib/u3d/unity_versions.rb:69:in `each'
    from /usr/local/rvm/gems/ruby-3.1.2/gems/u3d-1.3.2/lib/u3d/unity_versions.rb:69:in `block in fetch_cookie'
    from /usr/local/rvm/rubies/ruby-3.1.2/lib/ruby/3.1.0/net/http.rb:966:in `start'
    from /usr/local/rvm/rubies/ruby-3.1.2/lib/ruby/3.1.0/net/http.rb:627:in `start'
    from /usr/local/rvm/gems/ruby-3.1.2/gems/u3d-1.3.2/lib/u3d/unity_versions.rb:56:in `fetch_cookie'
    from /usr/local/rvm/gems/ruby-3.1.2/gems/u3d-1.3.2/lib/u3d/unity_versions.rb:41:in `page_content'
    from /usr/local/rvm/gems/ruby-3.1.2/gems/u3d-1.3.2/lib/u3d/unity_versions.rb:208:in `block in list_available'
    from /usr/local/rvm/gems/ruby-3.1.2/gems/u3d-1.3.2/lib/u3d/unity_versions.rb:207:in `map'
    from /usr/local/rvm/gems/ruby-3.1.2/gems/u3d-1.3.2/lib/u3d/unity_versions.rb:207:in `list_available'
    from /usr/local/rvm/gems/ruby-3.1.2/gems/u3d-1.3.2/lib/u3d/unity_versions.rb:149:in `list_available'
    from /usr/local/rvm/gems/ruby-3.1.2/gems/u3d-1.3.2/lib/u3d/cache.rb:140:in `update_cache'
    from /usr/local/rvm/gems/ruby-3.1.2/gems/u3d-1.3.2/lib/u3d/cache.rb:115:in `overwrite_cache'
    from /usr/local/rvm/gems/ruby-3.1.2/gems/u3d-1.3.2/lib/u3d/cache.rb:72:in `initialize'
    from /usr/local/rvm/gems/ruby-3.1.2/gems/u3d-1.3.2/lib/u3d/commands.rb:275:in `new'
    from /usr/local/rvm/gems/ruby-3.1.2/gems/u3d-1.3.2/lib/u3d/commands.rb:275:in `cache_versions'
    from /usr/local/rvm/gems/ruby-3.1.2/gems/u3d-1.3.2/lib/u3d/commands.rb:113:in `list_available'
    from /usr/local/rvm/gems/ruby-3.1.2/gems/u3d-1.3.2/lib/u3d/commands_generator.rb:142:in `block (2 levels) in run'
    from /usr/local/rvm/gems/ruby-3.1.2/gems/commander-4.6.0/lib/commander/command.rb:187:in `call'
    from /usr/local/rvm/gems/ruby-3.1.2/gems/commander-4.6.0/lib/commander/command.rb:157:in `run'
    from /usr/local/rvm/gems/ruby-3.1.2/gems/commander-4.6.0/lib/commander/runner.rb:444:in `run_active_command'
    from /usr/local/rvm/gems/ruby-3.1.2/gems/commander-4.6.0/lib/commander/runner.rb:58:in `run!'
    from /usr/local/rvm/gems/ruby-3.1.2/gems/commander-4.6.0/lib/commander/delegates.rb:18:in `run!'
    from /usr/local/rvm/gems/ruby-3.1.2/gems/u3d-1.3.2/lib/u3d/commands_generator.rb:265:in `run'
    from /usr/local/rvm/gems/ruby-3.1.2/gems/u3d-1.3.2/lib/u3d/commands_generator.rb:43:in `start'
    from /usr/local/rvm/gems/ruby-3.1.2/gems/u3d-1.3.2/exe/u3d:9:in `<top (required)>'
    from /usr/local/rvm/gems/ruby-3.1.2/bin/u3d:25:in `load'
    from /usr/local/rvm/gems/ruby-3.1.2/bin/u3d:25:in `<main>'
    from /usr/local/rvm/gems/ruby-3.1.2/bin/ruby_executable_hooks:22:in `eval'
    from /usr/local/rvm/gems/ruby-3.1.2/bin/ruby_executable_hooks:22:in `<main>'
# ruby --version
ruby 3.1.2p20 (2022-04-12 revision 4491bb740a) [x86_64-linux]
jlsalmon commented 2 years ago

Hit the same issue, raised #435 to fix it.

In the meantime, I'm monkey-patching like this:

filename="$(dirname $(gem which u3d))/u3d/unity_versions.rb"
sed -i 's/cookie_str = ''/cookie_str = \+''/g' "$filename"