プロジェクト

全般

プロフィール

Vote #67787

完了

Error 500 on filenames with whitespace in git reposities

Admin Redmine さんが3年以上前に追加. 3年以上前に更新.

ステータス:
Closed
優先度:
通常
担当者:
-
カテゴリ:
SCM_3
対象バージョン:
開始日:
2010/08/06
期日:
進捗率:

100%

予定工数:
category_id:
3
version_id:
24
issue_org_id:
6054
author_id:
18713
assigned_to_id:
5
comments:
9
status_id:
5
tracker_id:
1
plus1:
0
affected_version:
closed_on:
affected_version_id:
ステータス-->[Closed]

説明

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.


journals

Can't reproduce on trunk, see here http://orga.fachschaften.org/projects/sandbox-git/repository

What git version do you have installed?
--------------------------------------------------------------------------------
Sorry Felix, your link requires a login so I can't test. Do you have filenames with whitespace or repository path/name with whitespace? My problem only occured with the former.

I'm running Debian stable with:
<pre>
$ git --version
git version 1.5.6.5
</pre>
--------------------------------------------------------------------------------
Sorry, I thought it was public (which it should have been), it is public now.

I have a file @whitespace filename.txt@ in the repo, git version string is @git version 1.7.1@.
--------------------------------------------------------------------------------
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.
--------------------------------------------------------------------------------
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!
--------------------------------------------------------------------------------
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.entries()@ and @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 @target('')@.

Regarding the test, I fear I can not help you much - I have exactly zero coding experience in Ruby.
--------------------------------------------------------------------------------
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.
--------------------------------------------------------------------------------
Committed in r4188. I found another issue if the file has leading or trailing whitespace, Felix said he will try to work on a fix (#6499).
--------------------------------------------------------------------------------
Merged into 1.0-stable
--------------------------------------------------------------------------------

Admin Redmine さんが3年以上前に更新

  • カテゴリSCM_3 にセット
  • 対象バージョン1.0.2_24 にセット

他の形式にエクスポート: Atom PDF

いいね!0
いいね!0