Defect #38337
closedExport Time as CSV : FrozenError (can't modify frozen String: "")
0%
Description
Hello,
When i try to export time table to CSV file
Started GET "/projects/myproject/time_entries.csv?utf8=%E2%9C%93&set_filter=1&f%5B%5D=spent_on&op%5Bspent_on%5D=*&c%5B%5D=spent_on&c%5B%5D=user&c%5B%5D=activity&c%5B%5D=issue&c%5B%5D=comments&c%5B%5D=hours&t%5B%5D=hours&sort=spent_on&c%5B%5D=&encoding=ISO-8859-1" for 93.7.249.250 at 2023-03-07 11:37:26 +0100 Processing by TimelogController#index as CSV Parameters: {"utf8"=>"✓", "set_filter"=>"1", "f"=>["spent_on"], "op"=>{"spent_on"=>"*"}, "c"=>["spent_on", "user", "activity", "issue", "comments", "hours", ""], "t"=>["hours"], "sort"=>"spent_on", "encoding"=>"ISO-8859-1", "project_id"=>"myproject"} Current user: alexandre (id=1) Completed 500 Internal Server Error in 45ms (ActiveRecord: 11.7ms) FrozenError (can't modify frozen String: ""): lib/redmine/codeset_util.rb:59:in `force_encoding' lib/redmine/codeset_util.rb:59:in `from_utf8' lib/redmine/export/csv.rb:52:in `block in <<' lib/redmine/export/csv.rb:49:in `map' lib/redmine/export/csv.rb:49:in `<<' app/helpers/queries_helper.rb:283:in `block (2 levels) in query_to_csv' app/helpers/queries_helper.rb:282:in `each' app/helpers/queries_helper.rb:282:in `block in query_to_csv' lib/redmine/export/csv.rb:44:in `generate' lib/redmine/export/csv.rb:26:in `generate' app/helpers/queries_helper.rb:278:in `query_to_csv' app/controllers/timelog_controller.rb:67:in `block (2 levels) in index' app/controllers/timelog_controller.rb:47:in `index' lib/redmine/sudo_mode.rb:63:in `sudo_mode'
Distributor ID: Debian Description: Debian GNU/Linux 11 (bullseye) Release: 11 Codename: bullseye
Environment: Redmine version 4.0.7.stable Ruby version 2.7.4-p191 (2021-07-07) [x86_64-linux-gnu] Rails version 5.2.8.1 Environment production Database adapter Mysql2 Mailer queue ActiveJob::QueueAdapters::AsyncAdapter Mailer delivery smtp SCM: Git 2.30.2 Filesystem Redmine plugins: redmine_messenger 1.0.7
Thank you
Related issues
Updated by Holger Just over 1 year ago
- Status changed from New to Closed
- Resolution set to Cant reproduce
Redmine 4.0 does not officially support Ruby 2.7. Also Redmine 4.0.x does not receive any updates and is not supported by the Redmine project anymore. You should update Redmine to a newer version.
With that being said, Redmine does not usually freeze any string, specifically not in the code path you have shown. Thus, this is likely to only occur if you force Ruby to create frozen strings by default (which will break a lot of areas in Redmine) by e.g. using RUBYOPT="--enable-frozen-string-literal"
or similar. You should remove any such environment variables and configure your application server to not configure Ruby with frozen strings.
Updated by Pavel Rosický over 1 year ago
There's probably nil.to_s somewhere. It returns a frozen string since Ruby 2.7. nil.to_s.frozen? => true.
But as has already been said, upgrading to a supported Redmine version will most likely fix the problem...
Updated by Alexandre Russo over 1 year ago
- Status changed from Closed to Reopened
thank you for your answer,
i upgrade redmine debian package v4.0 to v5.0.x
But now i have 500 error :
Processing by WelcomeController#index as HTML Current user: alexandre (id=1) Rendering welcome/index.html.erb within layouts/base Rendered welcome/index.html.erb within layouts/base (33.8ms) Completed 500 Internal Server Error in 132ms (ActiveRecord: 15.4ms) ActionView::Template::Error (undefined method `atom_key' for #<User:0x0000555bd4ac6db0> Did you mean? to_key): 21: </div> 22: 23: <% content_for :header_tags do %> 24: <%= auto_discovery_link_tag(:atom, {:controller => 'news', :action => 'index', :key => User.current.atom_key, :format => 'atom'}, 25: :title => "#{Setting.app_title}: #{l(:label_news_latest)}") %> 26: <%= auto_discovery_link_tag(:atom, {:controller => 'activities', :action => 'index', :key => User.current.atom_key, :format => 'atom'}, 27: :title => "#{Setting.app_title}: #{l(:label_activity)}") %> app/views/welcome/index.html.erb:24:in `block in _app_views_welcome_index_html_erb__4256216469183124722_73320' app/views/welcome/index.html.erb:23:in `_app_views_welcome_index_html_erb__4256216469183124722_73320' lib/redmine/sudo_mode.rb:63:in `sudo_mode'
Forgot to do something ?
bundle exec rake db:migrate RAILS_ENV=production rake aborted! NoMethodError: undefined method `assets' for #<Rails::Application::Configuration:0x0000565003c055b8> Did you mean? asset_host /var/lib/gems/2.7.0/gems/railties-6.1.7.2/lib/rails/railtie/configuration.rb:97:in `method_missing' /usr/share/redmine/config/initializers/assets.rb:4:in `<top (required)>' /var/lib/gems/2.7.0/gems/activesupport-6.1.7.2/lib/active_support/dependencies.rb:326:in `load' /var/lib/gems/2.7.0/gems/activesupport-6.1.7.2/lib/active_support/dependencies.rb:326:in `block in load' /var/lib/gems/2.7.0/gems/activesupport-6.1.7.2/lib/active_support/dependencies.rb:299:in `load_dependency' /var/lib/gems/2.7.0/gems/activesupport-6.1.7.2/lib/active_support/dependencies.rb:326:in `load' /var/lib/gems/2.7.0/gems/railties-6.1.7.2/lib/rails/engine.rb:681:in `block in load_config_initializer' /var/lib/gems/2.7.0/gems/activesupport-6.1.7.2/lib/active_support/notifications.rb:205:in `instrument' /var/lib/gems/2.7.0/gems/railties-6.1.7.2/lib/rails/engine.rb:680:in `load_config_initializer' /var/lib/gems/2.7.0/gems/railties-6.1.7.2/lib/rails/engine.rb:634:in `block (2 levels) in <class:Engine>' /var/lib/gems/2.7.0/gems/railties-6.1.7.2/lib/rails/engine.rb:633:in `each' /var/lib/gems/2.7.0/gems/railties-6.1.7.2/lib/rails/engine.rb:633:in `block in <class:Engine>' /var/lib/gems/2.7.0/gems/railties-6.1.7.2/lib/rails/initializable.rb:32:in `instance_exec' /var/lib/gems/2.7.0/gems/railties-6.1.7.2/lib/rails/initializable.rb:32:in `run' /var/lib/gems/2.7.0/gems/railties-6.1.7.2/lib/rails/initializable.rb:61:in `block in run_initializers' /var/lib/gems/2.7.0/gems/railties-6.1.7.2/lib/rails/initializable.rb:50:in `each' /var/lib/gems/2.7.0/gems/railties-6.1.7.2/lib/rails/initializable.rb:50:in `tsort_each_child' /var/lib/gems/2.7.0/gems/railties-6.1.7.2/lib/rails/initializable.rb:60:in `run_initializers' /var/lib/gems/2.7.0/gems/railties-6.1.7.2/lib/rails/application.rb:391:in `initialize!' /usr/share/redmine/config/environment.rb:16:in `<top (required)>' /var/lib/gems/2.7.0/gems/zeitwerk-2.6.7/lib/zeitwerk/kernel.rb:38:in `require' /var/lib/gems/2.7.0/gems/zeitwerk-2.6.7/lib/zeitwerk/kernel.rb:38:in `require' /var/lib/gems/2.7.0/gems/activesupport-6.1.7.2/lib/active_support/dependencies.rb:332:in `block in require' /var/lib/gems/2.7.0/gems/activesupport-6.1.7.2/lib/active_support/dependencies.rb:299:in `load_dependency' /var/lib/gems/2.7.0/gems/activesupport-6.1.7.2/lib/active_support/dependencies.rb:332:in `require' /var/lib/gems/2.7.0/gems/railties-6.1.7.2/lib/rails/application.rb:367:in `require_environment!' /var/lib/gems/2.7.0/gems/railties-6.1.7.2/lib/rails/application.rb:533:in `block in run_tasks_blocks' /var/lib/gems/2.7.0/gems/rake-13.0.6/exe/rake:27:in `<top (required)>' Tasks: TOP => db:migrate => db:load_config => environment (See full trace by running task with --trace)
Thank you
Updated by Alexandre Russo over 1 year ago
i run
gem update
now i have this error
bundle exec rake db:migrate RAILS_ENV=production Calling `DidYouMean::SPELL_CHECKERS.merge!(error_name => spell_checker)' has been deprecated. Please call `DidYouMean.correct_error(error_name, spell_checker)' instead. Calling `DidYouMean::SPELL_CHECKERS.merge!(error_name => spell_checker)' has been deprecated. Please call `DidYouMean.correct_error(error_name, spell_checker)' instead. /usr/lib/ruby/2.7.0/cgi/util.rb:30: warning: already initialized constant CGI::Util::TABLE_FOR_ESCAPE_HTML__ /var/lib/gems/2.7.0/gems/cgi-0.3.6/lib/cgi/util.rb:63: warning: previous definition of TABLE_FOR_ESCAPE_HTML__ was here /usr/lib/x86_64-linux-gnu/ruby/2.7.0/psych.so: warning: already initialized constant Psych::Parser::ANY /usr/lib/x86_64-linux-gnu/ruby/2.7.0/psych.so: warning: already initialized constant Psych::Parser::UTF8 /usr/lib/x86_64-linux-gnu/ruby/2.7.0/psych.so: warning: already initialized constant Psych::Parser::UTF16LE /usr/lib/x86_64-linux-gnu/ruby/2.7.0/psych.so: warning: already initialized constant Psych::Parser::UTF16BE rake aborted! TypeError: superclass mismatch for class StringIO /var/lib/gems/2.7.0/gems/railties-6.1.7.2/lib/rails/application.rb:3:in `require' /var/lib/gems/2.7.0/gems/railties-6.1.7.2/lib/rails/application.rb:3:in `<top (required)>' /var/lib/gems/2.7.0/gems/railties-6.1.7.2/lib/rails.rb:13:in `require' /var/lib/gems/2.7.0/gems/railties-6.1.7.2/lib/rails.rb:13:in `<top (required)>' /usr/share/redmine/config/application.rb:5:in `require' /usr/share/redmine/config/application.rb:5:in `<top (required)>' /usr/share/redmine/Rakefile:4:in `require' /usr/share/redmine/Rakefile:4:in `<top (required)>' /var/lib/gems/2.7.0/gems/rake-13.0.6/exe/rake:27:in `<top (required)>' (See full trace by running task with --trace)
Updated by Alexandre Russo over 1 year ago
It's ok, problem with plugin. Sorry.
i update to v5 and now it's ok.
thank you
Updated by Go MAEDA over 1 year ago
- Status changed from Reopened to Closed
- Resolution changed from Cant reproduce to Invalid
Updated by Holger Just 2 months ago
- Has duplicate Defect #41215: Reg: CSV Files could not be export in redmine added