pt icon indicating copy to clipboard operation
pt copied to clipboard

FrozenError: can't modify frozen String: ""

Open dhurba87 opened this issue 3 years ago • 1 comments

I'm getting following exception from ruby 2.7.2

Please select the project for the current directory (1-1, 'q' to exit)
1

Thanks! I'm saving this project's info
in /Users/dhurba/code/random/pt/.pt: remember to .gitignore it!
[1/199]
bundler: failed to load command: ./bin/pt (./bin/pt)
FrozenError: can't modify frozen String: ""
  /Users/dhurba/code/random/pt/lib/pt/data_row.rb:22:in `force_encoding'
  /Users/dhurba/code/random/pt/lib/pt/data_row.rb:22:in `method_missing'
  /Users/dhurba/.rvm/gems/ruby-2.7.2/gems/hirb-0.7.3/lib/hirb/helpers/object_table.rb:10:in `block (2 levels) in render'
  /Users/dhurba/.rvm/gems/ruby-2.7.2/gems/hirb-0.7.3/lib/hirb/helpers/object_table.rb:10:in `each'
  /Users/dhurba/.rvm/gems/ruby-2.7.2/gems/hirb-0.7.3/lib/hirb/helpers/object_table.rb:10:in `inject'
  /Users/dhurba/.rvm/gems/ruby-2.7.2/gems/hirb-0.7.3/lib/hirb/helpers/object_table.rb:10:in `block in render'
  /Users/dhurba/.rvm/gems/ruby-2.7.2/gems/hirb-0.7.3/lib/hirb/helpers/object_table.rb:9:in `each'
  /Users/dhurba/.rvm/gems/ruby-2.7.2/gems/hirb-0.7.3/lib/hirb/helpers/object_table.rb:9:in `inject'
  /Users/dhurba/.rvm/gems/ruby-2.7.2/gems/hirb-0.7.3/lib/hirb/helpers/object_table.rb:9:in `render'
  /Users/dhurba/.rvm/gems/ruby-2.7.2/gems/hirb-0.7.3/lib/hirb/helpers/auto_table.rb:22:in `render'
  /Users/dhurba/.rvm/gems/ruby-2.7.2/gems/hirb-0.7.3/lib/hirb/formatter.rb:73:in `_format_output'
  /Users/dhurba/.rvm/gems/ruby-2.7.2/gems/hirb-0.7.3/lib/hirb/formatter.rb:56:in `format_output'
  /Users/dhurba/.rvm/gems/ruby-2.7.2/gems/hirb-0.7.3/lib/hirb/view.rb:205:in `render_output'
  /Users/dhurba/.rvm/gems/ruby-2.7.2/gems/hirb-0.7.3/lib/hirb/console.rb:18:in `render_output'
  /Users/dhurba/.rvm/gems/ruby-2.7.2/gems/hirb-0.7.3/lib/hirb/console.rb:30:in `table'
  /Users/dhurba/code/random/pt/lib/pt/data_table.rb:27:in `print'
  /Users/dhurba/code/random/pt/lib/pt/helper.rb:233:in `select'
  /Users/dhurba/code/random/pt/lib/pt/helper.rb:256:in `select_story_from_paginated_table'
  /Users/dhurba/code/random/pt/lib/pt/cli.rb:52:in `block (2 levels) in <class:CLI>'
  /Users/dhurba/.rvm/gems/ruby-2.7.2/gems/thor-1.1.0/lib/thor/command.rb:27:in `run'
  /Users/dhurba/.rvm/gems/ruby-2.7.2/gems/thor-1.1.0/lib/thor/invocation.rb:127:in `invoke_command'
  /Users/dhurba/.rvm/gems/ruby-2.7.2/gems/thor-1.1.0/lib/thor.rb:392:in `dispatch'
  /Users/dhurba/.rvm/gems/ruby-2.7.2/gems/thor-1.1.0/lib/thor/base.rb:485:in `start'
  /Users/dhurba/code/random/pt/bin/pt:10:in `<top (required)>'

dhurba87 avatar Mar 17 '21 16:03 dhurba87

It looks like our code is trying to change frozen string generated from nil.to_s. Starting from ruby 2.7 nil.to_s is a frozen string. The returned String is always the same for a given object. Feature

dhurba87 avatar Mar 17 '21 16:03 dhurba87