CommitController#show returns 500 error
Created by: troyanov
Summary
Having a binary file (tested with .docx/.doc/.xlsx/.xls) with russian letters in its name in commit leads to Error 500 when trying to view that commit.
Steps to reproduce
Create file that contains russian letters in its name, then commit & push. Try to view your commit.
Expected behaviour
File changes should be shown on the commit view page.
Observed behavior
Started GET "/gitlab/asu/doc/commit/21a7fed5f48bd7947c83677944635053b08b8cec" for at 2013-05-28 15:11:07 +0400
Processing by CommitController#show as HTML
Parameters: {"project_id"=>"asu/doc", "id"=>"21a7fed5f48bd7947c83677944635053b08b8cec"}
Encoding::CompatibilityError (incompatible character encodings: UTF-8 and ASCII-8BIT):
vendor/bundle/ruby/1.9.1/gems/gitlab-grit-2.5.1/lib/grit_ext/diff.rb:19:in `diff'
vendor/bundle/ruby/1.9.1/gems/gitlab_git-1.2.1/lib/gitlab_git/diff.rb:49:in `block in init_from_grit'
vendor/bundle/ruby/1.9.1/gems/gitlab_git-1.2.1/lib/gitlab_git/diff.rb:48:in `each'
vendor/bundle/ruby/1.9.1/gems/gitlab_git-1.2.1/lib/gitlab_git/diff.rb:48:in `init_from_grit'
vendor/bundle/ruby/1.9.1/gems/gitlab_git-1.2.1/lib/gitlab_git/diff.rb:23:in `initialize'
vendor/bundle/ruby/1.9.1/gems/gitlab_git-1.2.1/lib/gitlab_git/commit.rb:97:in `new'
vendor/bundle/ruby/1.9.1/gems/gitlab_git-1.2.1/lib/gitlab_git/commit.rb:97:in `block in diffs'
vendor/bundle/ruby/1.9.1/gems/gitlab_git-1.2.1/lib/gitlab_git/commit.rb:97:in `map'
vendor/bundle/ruby/1.9.1/gems/gitlab_git-1.2.1/lib/gitlab_git/commit.rb:97:in `diffs'
app/models/commit.rb:68:in `method_missing'
app/contexts/commit_load_context.rb:23:in `execute'
app/controllers/commit_controller.rb:11:in `show'
Rendered errors/encoding.html.haml within layouts/errors (14.7ms)
Rendered layouts/_head.html.haml (286.3ms)
Rendered layouts/_search.html.haml (318.4ms)
Rendered layouts/_head_panel.html.haml (329.9ms)
Rendered layouts/_flash.html.haml (2.0ms)
Completed 500 Internal Server Error in 867ms (Views: 708.1ms | ActiveRecord: 8.1ms)
Output of checks
[git@m9-gitlab gitlab]$ bundle exec rake gitlab:check RAILS_ENV=production
Checking Environment ...
Git configured for git user? ... yes
Has python2? ... yes
python2 is supported version? ... yes
Checking Environment ... Finished
Checking GitLab Shell ...
GitLab Shell version >= 1.4.0 ? ... OK (1.4.0)
Repo base directory exists? ... yes
Repo base directory is a symlink? ... no
Repo base owned by git:git? ... yes
Repo base access is drwxrws---? ... yes
post-receive hook up-to-date? ... yes
post-receive hooks in repos are links: ...
anton troyanov / encoding ... ok
Checking GitLab Shell ... Finished
Checking Sidekiq ...
Running? ... no
Try fixing it:
sudo -u git -H bundle exec rake sidekiq:start RAILS_ENV=production
For more information see:
doc/install/installation.md in section "Install Init Script"
see log/sidekiq.log for possible errors
Please fix the error above and rerun the checks.
Checking Sidekiq ... Finished
Checking GitLab ...
Database config exists? ... yes
Database is SQLite ... no
All migrations up? ... yes
GitLab config exists? ... yes
GitLab config outdated? ... no
Log directory writable? ... yes
Tmp directory writable? ... yes
Init script exists? ... yes
Init script up-to-date? ... no
Try fixing it:
Redownload the init script
For more information see:
doc/install/installation.md in section "Install Init Script"
Please fix the error above and rerun the checks.
Projects have satellites? ...
anton troyanov / encoding ... yes
Redis version >= 2.0.0? ... yes
Your git bin path is "/usr/bin/git"
Git version >= 1.7.10 ? ... yes (1.7.11)
Checking GitLab ... Finished
sidekiq and init.d script test fails because i'm using custom init.d for CentOS, and to be honest - sidekiq is running and feeling good.
[root@m9-gitlab ~]# tail /home/git/gitlab/log/sidekiq.log
2013-05-29T11:04:10Z 9422 TID-nuooo PostReceive JID- INFO: start
2013-05-29T11:04:10Z 9422 TID-nuooo PostReceive JID- INFO: done: 0.042 sec
2013-05-29T11:04:37Z 9422 TID-nuooo PostReceive JID- INFO: start
GitLab last commit sha1 5.2.0 6654db2
My setup is
[git@m9-gitlab gitlab]$ bundle exec rake gitlab:env:info RAILS_ENV=production
System information
System: CentOS release 6.4 (Final)
Current User: git
Using RVM: no
Ruby Version: 1.9.3p327
Gem Version: 1.8.24
Bundler Version:1.2.3
Rake Version: 10.0.4
GitLab information
Version: 5.2.0
Revision: 6654db2
Directory: /home/git/gitlab
DB Adapter: mysql2
URL: http://10.8.1.200/gitlab
HTTP Clone URL: http://10.8.1.200/gitlab/some-project.git
SSH Clone URL: [email protected]:some-project.git
Using LDAP: no
Using Omniauth: no
GitLab Shell
Version: 1.4.0
Repositories: /home/git/repositories/
Hooks: /home/git/gitlab-shell/hooks/
Git: /usr/bin/git
Possible fixes
I think it is somehow connected to grit_ext
, i've also tried to update charlock_holmes
but it didn't help
i'm going to setup vagrant and continue research..