Error 500 on filenames with whitespace in git reposities
|Assignee:||Eric Davis||% Done:|
Getting a directory listing from GIT crashes Redmine with an internal server error when a file has whitespace in its name:
NoMethodError (private method `split' called for nil:NilClass): /lib/redmine/scm/adapters/git_adapter.rb:93:in `lastrev' /lib/redmine/scm/adapters/abstract_adapter.rb:193:in `call' /lib/redmine/scm/adapters/abstract_adapter.rb:193:in `shellout' /lib/redmine/scm/adapters/abstract_adapter.rb:191:in `popen' /lib/redmine/scm/adapters/abstract_adapter.rb:191:in `shellout' /lib/redmine/scm/adapters/abstract_adapter.rb:177:in `shellout' /lib/redmine/scm/adapters/git_adapter.rb:92:in `lastrev' /lib/redmine/scm/adapters/git_adapter.rb:77:in `entries' /lib/redmine/scm/adapters/git_adapter.rb:65:in `each_line' /lib/redmine/scm/adapters/git_adapter.rb:65:in `entries' ....
This is caused by inadequate quoting of path names in GitAdapter.lastrev(), which affects at least 0.8.4, but seems unfixed in 1.0rc and trunk as well. A patch fixing this issue is attached.
#1 Updated by Felix Schäfer almost 9 years ago
Can't reproduce on trunk, see here http://orga.fachschaften.org/projects/sandbox-git/repository
What git version do you have installed?
#4 Updated by Georg Lukas almost 9 years ago
Ah, now I see that it does not crash Redmine any more. However it does not display the revision and change information for that file. If you add another file without whitespace, I am pretty sure you will see its revision, author etc. columns. Could you please try to do so and compare the output with/without my patch?
The version of git on the other hand should not matter - it is solely an issue with file name quoting.
#5 Updated by Felix Schäfer almost 9 years ago
- Affected version (unused) changed from 0.8.4 to devel
- Affected version deleted (
Ah, I now see what you mean and can confirm the bug on trunk.
Could you see if other places in the git adapter are concerned and maybe even write a test for that? Thanks!
#6 Updated by Georg Lukas almost 9 years ago
From a quick glance the path quoting problem seems to affect
GitAdapter.revisions() as well. Other subtle but bad things will probably happen in
GitAdapter.revisions() when file names start with whitespace.
The adapter might also freak out badly if the repository directory contains spaces in its path - I see no quoting at all for
Regarding the test, I fear I can not help you much - I have exactly zero coding experience in Ruby.
#7 Updated by Felix Schäfer over 8 years ago
- Target version set to 1.0.2
This commit fixes the missing shell_quote s in the git_adapter: http://github.com/thegcat/redmine/commit/5d5c60d5d4d09aca61239f269fa8904328d9952e The tests in this commit will only work with the fixes in #6346.
@JB: could you commit both to trunk? Thanks.