Project

General

Profile

Problems with Redmine tracker control

Added by Luis Serrano Aranda about 12 years ago

The old version of the plugin don't work with Redmine 1.3.0 and the new returns an error when I try to enter in Redmine with a non admin user o if I try to make a new role with admin user, this is the error

You have a nil object when you didn't expect it!
You might have expected an instance of Array.
The error occurred while evaluating nil.map!
RAILS_ROOT: /opt/redmine

Application Trace | Framework Trace | Full Trace
/opt/redmine/vendor/plugins/redmine_track_control/lib/role_patch.rb:11:in `permissions'
/opt/redmine/app/controllers/roles_controller.rb:33:in `new'
/opt/redmine/vendor/plugins/redmine_track_control/lib/role_patch.rb:11:in `permissions'
/opt/redmine/vendor/rails/actionpack/lib/action_controller/base.rb:1333:in `send'
/opt/redmine/vendor/rails/actionpack/lib/action_controller/base.rb:1333:in `perform_action_without_filters'
/opt/redmine/vendor/rails/actionpack/lib/action_controller/filters.rb:617:in `call_filters'
/opt/redmine/vendor/rails/actionpack/lib/action_controller/filters.rb:610:in `perform_action_without_benchmark'
/opt/redmine/vendor/rails/actionpack/lib/action_controller/benchmarking.rb:68:in `perform_action_without_rescue'
/opt/redmine/vendor/rails/activesupport/lib/active_support/core_ext/benchmark.rb:17:in `ms'
/usr/lib/ruby/1.8/benchmark.rb:308:in `realtime'
/opt/redmine/vendor/rails/activesupport/lib/active_support/core_ext/benchmark.rb:17:in `ms'
/opt/redmine/vendor/rails/actionpack/lib/action_controller/benchmarking.rb:68:in `perform_action_without_rescue'
/opt/redmine/vendor/rails/actionpack/lib/action_controller/rescue.rb:160:in `perform_action_without_flash'
/opt/redmine/vendor/rails/actionpack/lib/action_controller/flash.rb:151:in `perform_action'
/opt/redmine/vendor/rails/actionpack/lib/action_controller/base.rb:532:in `send'
/opt/redmine/vendor/rails/actionpack/lib/action_controller/base.rb:532:in `process_without_filters'
/opt/redmine/vendor/rails/actionpack/lib/action_controller/filters.rb:606:in `process'
/opt/redmine/vendor/rails/actionpack/lib/action_controller/base.rb:391:in `process'
/opt/redmine/vendor/rails/actionpack/lib/action_controller/base.rb:386:in `call'
/opt/redmine/vendor/rails/actionpack/lib/action_controller/routing/route_set.rb:438:in `call'
/opt/redmine/vendor/rails/actionpack/lib/action_controller/dispatcher.rb:87:in `dispatch'
/opt/redmine/vendor/rails/actionpack/lib/action_controller/dispatcher.rb:121:in `_call'
/opt/redmine/vendor/rails/actionpack/lib/action_controller/dispatcher.rb:130
/opt/redmine/vendor/rails/activerecord/lib/active_record/query_cache.rb:29:in `call'
/opt/redmine/vendor/rails/activerecord/lib/active_record/query_cache.rb:29:in `call'
/opt/redmine/vendor/rails/activerecord/lib/active_record/connection_adapters/abstract/query_cache.rb:34:in `cache'
/opt/redmine/vendor/rails/activerecord/lib/active_record/query_cache.rb:9:in `cache'
/opt/redmine/vendor/rails/activerecord/lib/active_record/query_cache.rb:28:in `call'
/opt/redmine/vendor/rails/activerecord/lib/active_record/connection_adapters/abstract/connection_pool.rb:361:in `call'
/opt/redmine/vendor/rails/actionpack/lib/action_controller/string_coercion.rb:25:in `call'
/usr/lib/ruby/gems/1.8/gems/rack-1.1.1/lib/rack/head.rb:9:in `call'
/usr/lib/ruby/gems/1.8/gems/rack-1.1.1/lib/rack/methodoverride.rb:24:in `call'
/opt/redmine/vendor/rails/actionpack/lib/action_controller/params_parser.rb:15:in `call'
/opt/redmine/vendor/rails/actionpack/lib/action_controller/session/cookie_store.rb:99:in `call'
/opt/redmine/vendor/rails/actionpack/lib/action_controller/failsafe.rb:26:in `call'
/usr/lib/ruby/gems/1.8/gems/rack-1.1.1/lib/rack/lock.rb:11:in `call'
/usr/lib/ruby/gems/1.8/gems/rack-1.1.1/lib/rack/lock.rb:11:in `synchronize'
/usr/lib/ruby/gems/1.8/gems/rack-1.1.1/lib/rack/lock.rb:11:in `call'
/opt/redmine/vendor/rails/actionpack/lib/action_controller/dispatcher.rb:114:in `call'
/opt/redmine/vendor/rails/actionpack/lib/action_controller/reloader.rb:34:in `run'
/opt/redmine/vendor/rails/actionpack/lib/action_controller/dispatcher.rb:108:in `call'
/usr/lib/ruby/gems/1.8/gems/passenger-3.0.11/lib/phusion_passenger/rack/request_handler.rb:96:in `process_request'
/usr/lib/ruby/gems/1.8/gems/passenger-3.0.11/lib/phusion_passenger/abstract_request_handler.rb:513:in `accept_and_process_next_request'
/usr/lib/ruby/gems/1.8/gems/passenger-3.0.11/lib/phusion_passenger/abstract_request_handler.rb:274:in `main_loop'
/usr/lib/ruby/gems/1.8/gems/passenger-3.0.11/lib/phusion_passenger/classic_rails/application_spawner.rb:321:in `start_request_handler'
/usr/lib/ruby/gems/1.8/gems/passenger-3.0.11/lib/phusion_passenger/classic_rails/application_spawner.rb:275:in `send'
/usr/lib/ruby/gems/1.8/gems/passenger-3.0.11/lib/phusion_passenger/classic_rails/application_spawner.rb:275:in `handle_spawn_application'
/usr/lib/ruby/gems/1.8/gems/passenger-3.0.11/lib/phusion_passenger/utils.rb:479:in `safe_fork'
/usr/lib/ruby/gems/1.8/gems/passenger-3.0.11/lib/phusion_passenger/classic_rails/application_spawner.rb:270:in `handle_spawn_application'
/usr/lib/ruby/gems/1.8/gems/passenger-3.0.11/lib/phusion_passenger/abstract_server.rb:357:in `__send__'
/usr/lib/ruby/gems/1.8/gems/passenger-3.0.11/lib/phusion_passenger/abstract_server.rb:357:in `server_main_loop'
/usr/lib/ruby/gems/1.8/gems/passenger-3.0.11/lib/phusion_passenger/abstract_server.rb:206:in `start_synchronously'
/usr/lib/ruby/gems/1.8/gems/passenger-3.0.11/lib/phusion_passenger/abstract_server.rb:180:in `start'
/usr/lib/ruby/gems/1.8/gems/passenger-3.0.11/lib/phusion_passenger/classic_rails/application_spawner.rb:149:in `start'
/usr/lib/ruby/gems/1.8/gems/passenger-3.0.11/lib/phusion_passenger/spawn_manager.rb:219:in `spawn_rails_application'
/usr/lib/ruby/gems/1.8/gems/passenger-3.0.11/lib/phusion_passenger/abstract_server_collection.rb:132:in `lookup_or_add'
/usr/lib/ruby/gems/1.8/gems/passenger-3.0.11/lib/phusion_passenger/spawn_manager.rb:214:in `spawn_rails_application'
/usr/lib/ruby/gems/1.8/gems/passenger-3.0.11/lib/phusion_passenger/abstract_server_collection.rb:82:in `synchronize'
/usr/lib/ruby/gems/1.8/gems/passenger-3.0.11/lib/phusion_passenger/abstract_server_collection.rb:79:in `synchronize'
/usr/lib/ruby/gems/1.8/gems/passenger-3.0.11/lib/phusion_passenger/spawn_manager.rb:213:in `spawn_rails_application'
/usr/lib/ruby/gems/1.8/gems/passenger-3.0.11/lib/phusion_passenger/spawn_manager.rb:132:in `spawn_application'
/usr/lib/ruby/gems/1.8/gems/passenger-3.0.11/lib/phusion_passenger/spawn_manager.rb:275:in `handle_spawn_application'
/usr/lib/ruby/gems/1.8/gems/passenger-3.0.11/lib/phusion_passenger/abstract_server.rb:357:in `__send__'
/usr/lib/ruby/gems/1.8/gems/passenger-3.0.11/lib/phusion_passenger/abstract_server.rb:357:in `server_main_loop'
/usr/lib/ruby/gems/1.8/gems/passenger-3.0.11/lib/phusion_passenger/abstract_server.rb:206:in `start_synchronously'
/usr/lib/ruby/gems/1.8/gems/passenger-3.0.11/helper-scripts/passenger-spawn-server:99
/opt/redmine/vendor/plugins/redmine_track_control/lib/role_patch.rb:11:in `permissions'
/opt/redmine/app/controllers/roles_controller.rb:33:in `new'
/opt/redmine/vendor/rails/actionpack/lib/action_controller/base.rb:1333:in `send'
/opt/redmine/vendor/rails/actionpack/lib/action_controller/base.rb:1333:in `perform_action_without_filters'
/opt/redmine/vendor/rails/actionpack/lib/action_controller/filters.rb:617:in `call_filters'
/opt/redmine/vendor/rails/actionpack/lib/action_controller/filters.rb:610:in `perform_action_without_benchmark'
/opt/redmine/vendor/rails/actionpack/lib/action_controller/benchmarking.rb:68:in `perform_action_without_rescue'
/opt/redmine/vendor/rails/activesupport/lib/active_support/core_ext/benchmark.rb:17:in `ms'
/usr/lib/ruby/1.8/benchmark.rb:308:in `realtime'
/opt/redmine/vendor/rails/activesupport/lib/active_support/core_ext/benchmark.rb:17:in `ms'
/opt/redmine/vendor/rails/actionpack/lib/action_controller/benchmarking.rb:68:in `perform_action_without_rescue'
/opt/redmine/vendor/rails/actionpack/lib/action_controller/rescue.rb:160:in `perform_action_without_flash'
/opt/redmine/vendor/rails/actionpack/lib/action_controller/flash.rb:151:in `perform_action'
/opt/redmine/vendor/rails/actionpack/lib/action_controller/base.rb:532:in `send'
/opt/redmine/vendor/rails/actionpack/lib/action_controller/base.rb:532:in `process_without_filters'
/opt/redmine/vendor/rails/actionpack/lib/action_controller/filters.rb:606:in `process'
/opt/redmine/vendor/rails/actionpack/lib/action_controller/base.rb:391:in `process'
/opt/redmine/vendor/rails/actionpack/lib/action_controller/base.rb:386:in `call'
/opt/redmine/vendor/rails/actionpack/lib/action_controller/routing/route_set.rb:438:in `call'
/opt/redmine/vendor/rails/actionpack/lib/action_controller/dispatcher.rb:87:in `dispatch'
/opt/redmine/vendor/rails/actionpack/lib/action_controller/dispatcher.rb:121:in `_call'
/opt/redmine/vendor/rails/actionpack/lib/action_controller/dispatcher.rb:130
/opt/redmine/vendor/rails/activerecord/lib/active_record/query_cache.rb:29:in `call'
/opt/redmine/vendor/rails/activerecord/lib/active_record/query_cache.rb:29:in `call'
/opt/redmine/vendor/rails/activerecord/lib/active_record/connection_adapters/abstract/query_cache.rb:34:in `cache'
/opt/redmine/vendor/rails/activerecord/lib/active_record/query_cache.rb:9:in `cache'
/opt/redmine/vendor/rails/activerecord/lib/active_record/query_cache.rb:28:in `call'
/opt/redmine/vendor/rails/activerecord/lib/active_record/connection_adapters/abstract/connection_pool.rb:361:in `call'
/opt/redmine/vendor/rails/actionpack/lib/action_controller/string_coercion.rb:25:in `call'
/usr/lib/ruby/gems/1.8/gems/rack-1.1.1/lib/rack/head.rb:9:in `call'
/usr/lib/ruby/gems/1.8/gems/rack-1.1.1/lib/rack/methodoverride.rb:24:in `call'
/opt/redmine/vendor/rails/actionpack/lib/action_controller/params_parser.rb:15:in `call'
/opt/redmine/vendor/rails/actionpack/lib/action_controller/session/cookie_store.rb:99:in `call'
/opt/redmine/vendor/rails/actionpack/lib/action_controller/failsafe.rb:26:in `call'
/usr/lib/ruby/gems/1.8/gems/rack-1.1.1/lib/rack/lock.rb:11:in `call'
/usr/lib/ruby/gems/1.8/gems/rack-1.1.1/lib/rack/lock.rb:11:in `synchronize'
/usr/lib/ruby/gems/1.8/gems/rack-1.1.1/lib/rack/lock.rb:11:in `call'
/opt/redmine/vendor/rails/actionpack/lib/action_controller/dispatcher.rb:114:in `call'
/opt/redmine/vendor/rails/actionpack/lib/action_controller/reloader.rb:34:in `run'
/opt/redmine/vendor/rails/actionpack/lib/action_controller/dispatcher.rb:108:in `call'
/usr/lib/ruby/gems/1.8/gems/passenger-3.0.11/lib/phusion_passenger/rack/request_handler.rb:96:in `process_request'
/usr/lib/ruby/gems/1.8/gems/passenger-3.0.11/lib/phusion_passenger/abstract_request_handler.rb:513:in `accept_and_process_next_request'
/usr/lib/ruby/gems/1.8/gems/passenger-3.0.11/lib/phusion_passenger/abstract_request_handler.rb:274:in `main_loop'
/usr/lib/ruby/gems/1.8/gems/passenger-3.0.11/lib/phusion_passenger/classic_rails/application_spawner.rb:321:in `start_request_handler'
/usr/lib/ruby/gems/1.8/gems/passenger-3.0.11/lib/phusion_passenger/classic_rails/application_spawner.rb:275:in `send'
/usr/lib/ruby/gems/1.8/gems/passenger-3.0.11/lib/phusion_passenger/classic_rails/application_spawner.rb:275:in `handle_spawn_application'
/usr/lib/ruby/gems/1.8/gems/passenger-3.0.11/lib/phusion_passenger/utils.rb:479:in `safe_fork'
/usr/lib/ruby/gems/1.8/gems/passenger-3.0.11/lib/phusion_passenger/classic_rails/application_spawner.rb:270:in `handle_spawn_application'
/usr/lib/ruby/gems/1.8/gems/passenger-3.0.11/lib/phusion_passenger/abstract_server.rb:357:in `__send__'
/usr/lib/ruby/gems/1.8/gems/passenger-3.0.11/lib/phusion_passenger/abstract_server.rb:357:in `server_main_loop'
/usr/lib/ruby/gems/1.8/gems/passenger-3.0.11/lib/phusion_passenger/abstract_server.rb:206:in `start_synchronously'
/usr/lib/ruby/gems/1.8/gems/passenger-3.0.11/lib/phusion_passenger/abstract_server.rb:180:in `start'
/usr/lib/ruby/gems/1.8/gems/passenger-3.0.11/lib/phusion_passenger/classic_rails/application_spawner.rb:149:in `start'
/usr/lib/ruby/gems/1.8/gems/passenger-3.0.11/lib/phusion_passenger/spawn_manager.rb:219:in `spawn_rails_application'
/usr/lib/ruby/gems/1.8/gems/passenger-3.0.11/lib/phusion_passenger/abstract_server_collection.rb:132:in `lookup_or_add'
/usr/lib/ruby/gems/1.8/gems/passenger-3.0.11/lib/phusion_passenger/spawn_manager.rb:214:in `spawn_rails_application'
/usr/lib/ruby/gems/1.8/gems/passenger-3.0.11/lib/phusion_passenger/abstract_server_collection.rb:82:in `synchronize'
/usr/lib/ruby/gems/1.8/gems/passenger-3.0.11/lib/phusion_passenger/abstract_server_collection.rb:79:in `synchronize'
/usr/lib/ruby/gems/1.8/gems/passenger-3.0.11/lib/phusion_passenger/spawn_manager.rb:213:in `spawn_rails_application'
/usr/lib/ruby/gems/1.8/gems/passenger-3.0.11/lib/phusion_passenger/spawn_manager.rb:132:in `spawn_application'
/usr/lib/ruby/gems/1.8/gems/passenger-3.0.11/lib/phusion_passenger/spawn_manager.rb:275:in `handle_spawn_application'
/usr/lib/ruby/gems/1.8/gems/passenger-3.0.11/lib/phusion_passenger/abstract_server.rb:357:in `__send__'
/usr/lib/ruby/gems/1.8/gems/passenger-3.0.11/lib/phusion_passenger/abstract_server.rb:357:in `server_main_loop'
/usr/lib/ruby/gems/1.8/gems/passenger-3.0.11/lib/phusion_passenger/abstract_server.rb:206:in `start_synchronously'
/usr/lib/ruby/gems/1.8/gems/passenger-3.0.11/helper-scripts/passenger-spawn-server:99
Request
Parameters:

None

Show session dump


Response
Headers:

{"Content-Type"=>"",
"Cache-Control"=>"no-cache"}

I think the error is in the role_patch.rb when I try to make a map, It seems that tries to read something empty in the array...

self[:permissions].map! do |p|
if p.instance_of? String
p.split('').slice(1..-1).join.to_sym
else
p
end
end

Replies (4)

RE: Problems with Redmine tracker control - Added by Kevin Wheatley about 12 years ago

I've seen similar issues (with both Redmine and ChiliProject) when I removed all permissions from a role whilst using this plugin, basically it became impossible to view any page !

I'm not sure currently why that method has been overridden, I'm currently tracing through the base implementation to determine the differences.

even a quick hack of commenting out the override appears to work, that is without running the tests :-)

Kevin

RE: Problems with Redmine tracker control - Added by Kevin Wheatley about 12 years ago

So far I've come up with the following... although I'm not sure why there may be a string, that needs the first character knocking off and turning into a symbol - presumable that first character might be a ':' :-)

Anyways, what is happening is that the first line of the function reads a possibly nil set of permissions from the database and assigns an empty array. The second line tries to get a writeable version of the permissions, but as the array won't be there just yet it is a nil, which doesn't have a map! method. My solution was to use a local variable and write it back to the database, although I might add a flag and only write the result back if it actually changes...

def permissions
perms = read_attribute(:permissions) || []
perms.map! do |p|
if p.instance_of? String
p.split('').slice(1..-1).join.to_sym
else
p
end
end
write_attribute(:permissions, perms)
end

RE: Problems with Redmine tracker control - Added by Luis Serrano Aranda about 12 years ago

I think it's a Redmine bug, The problem it's in the roles without any checked options, check (not member and anonymous) check any option, save and uncheck this option in the two roles (the nil values it's not set ok in the bbdd and with this method solves the problem)

    (1-4/4)