Project

General

Profile

Actions

Defect #15105

closed

Redmine::Helpers::Diff missing require

Added by Felix Bünemann about 11 years ago. Updated about 11 years ago.

Status:
Closed
Priority:
Normal
Assignee:
-
Category:
-
Target version:
-
Start date:
Due date:
% Done:

0%

Estimated time:
Resolution:
Fixed
Affected version:

Description

The lib/redmine/helpers/diff.rb is missing a require 'diff' to load lib/diff.rb so it fails to call diff on an array in inititialize:

>> Redmine::Helpers::Diff.new("foo", "bar")
NoMethodError: undefined method `diff' for ["foo", "bar"]:Array

This can be reproduced by changing the description of an issue and then clicking on the diff link.


Files

redmine_diff_fix.patch (403 Bytes) redmine_diff_fix.patch Fix for missing require Felix Bünemann, 2013-10-10 22:29
Actions #2

Updated by Toshi MARUYAMA about 11 years ago

  • Status changed from New to Needs feedback

Felix Bünemann wrote:

This can be reproduced by changing the description of an issue and then clicking on the diff link.

I cannot reproduce on clean Redmine.
"lib" is autoload.
source:trunk/config/application.rb@12204#L19

Actions #3

Updated by Felix Bünemann about 11 years ago

But it is a Monkey-Patch to the Array class, so how does autoloading help? We're not using the RedmineDiff::Diff class directly, so there is no trigger for autoloading. Besides that the file lib/diff.rb doesn't even follow conventions for autoloading in rails, because it defines multiple modules that don't match the file name.

It probably can't be reproduced, if for some reason the require 'diff' has already happened by another controller:

app/controllers/wiki_controller.rb:18:require 'diff'
app/models/wiki_page.rb:18:require 'diff'

For a simpler way to reproduce just use the rails console:

>> Redmine::Helpers::Diff.new("foo", "bar")
NoMethodError: undefined method `diff' for ["bar"]:Array
from lib/redmine/helpers/diff.rb:33:in `initialize'

Actions #4

Updated by Toshi MARUYAMA about 11 years ago

  • Status changed from Needs feedback to Closed

Committed in trunk r12206, thanks.

Actions #5

Updated by Toshi MARUYAMA about 11 years ago

  • Resolution set to Fixed
Actions

Also available in: Atom PDF