Error 500 with signed-off commits and Gravatar disabled
Summary
In our GitLab instance there is a repo which includes commits from user that do not exist in our GitLab instance (due to merging via GitHub). If Gravatar option is disabled an internal server errors occurs on those pages, where the avatar should be displayed. That only happens when git commit -s
is used. The error initially appeared after upgrading to Gitlab 10.7.0.
Steps to reproduce
- Disable Gravatar option in Admin settings
- Create empty repository
- Clone the repository
- Create some file.
touch README.rst
git config --local user.name "Test Test1123456"
git config --local user.email "test1123456@tester.de"
git add README.rst
# Sign-off commit
git commit -s
git push origin master
- Internal Server Error on all pages that try to display the commit message.
Example Project
Unfortunately I cannot reproduce the behavior on gitlab.com. (cannot disable Gravatar of course ;)) But I created an example on our self-hosted Gitlab instance (https://gitlab.hzdr.de/frust45/test). Everything works fine on different pages of the project without the commit messages (https://gitlab.hzdr.de/frust45/test/issues)
What is the current bug behavior?
Internal Server Error on all pages that try to display the commit message.
What is the expected correct behavior?
No Internal Server Error also if Gravatar options is deactivated.
Relevant logs and/or screenshots
Processing by ProjectsController#show as HTML
Parameters: {"namespace_id"=>"frust45", "id"=>"test"}
Read fragment views/frust45/test/f26c21f115b4174bc072be91c80bf25f724b8f1c/application_settings/6-20180423065339331323461/false/false/en/25aeb64c6a5419bb0abf0ec333c295c1 (0.6ms)
Completed 500 Internal Server Error in 150ms (ActiveRecord: 14.2ms)
ActionView::Template::Error (undefined method `asset_path' for #<Banzai::Filter::CommitTrailersFilter:0x00007f882d2ba950>):
37:
38: - if commit.description?
39: %pre.commit-row-description.js-toggle-content
40: = preserve(markdown_field(commit, :description))
41:
42: .commiter
43: - commit_author_link = commit_author_link(commit, avatar: false, size: 24)
app/helpers/application_helper.rb:106:in `default_avatar'
app/helpers/application_helper.rb:102:in `gravatar_icon'
app/helpers/application_helper.rb:88:in `avatar_icon_for_email'
app/helpers/avatars_helper.rb:17:in `user_avatar_url_for'
app/helpers/avatars_helper.rb:25:in `user_avatar_without_link'
lib/banzai/filter/commit_trailers_filter.rb:86:in `link_to_user'
lib/banzai/filter/commit_trailers_filter.rb:70:in `parse_user'
lib/banzai/filter/commit_trailers_filter.rb:57:in `block in trailer_filter'
lib/banzai/filter/commit_trailers_filter.rb:55:in `gsub'
lib/banzai/filter/commit_trailers_filter.rb:55:in `trailer_filter'
lib/banzai/filter/commit_trailers_filter.rb:34:in `block in call'
lib/banzai/filter/commit_trailers_filter.rb:29:in `call'
lib/banzai/pipeline/base_pipeline.rb:21:in `block (2 levels) in singleton class'
lib/banzai/renderer.rb:108:in `render_result'
lib/banzai/renderer.rb:139:in `block in cacheless_render'
lib/gitlab/metrics/influx_db.rb:98:in `measure'
lib/banzai/renderer.rb:138:in `cacheless_render'
lib/banzai/renderer.rb:50:in `cacheless_render_field'
lib/banzai/renderer.rb:37:in `render_field'
lib/banzai.rb:7:in `render_field'
app/helpers/markup_helper.rb:102:in `markdown_field'
app/views/projects/commits/_commit.html.haml:40:in `block in _app_views_projects_commits__commit_html_haml___374192630454143651_70111385077060'
app/views/projects/commits/_commit.html.haml:17:in `_app_views_projects_commits__commit_html_haml___374192630454143651_70111385077060'
app/views/shared/_commit_well.html.haml:4:in `_app_views_shared__commit_well_html_haml___4402447117738724359_70111385171860'
app/views/projects/_files.html.haml:11:in `_app_views_projects__files_html_haml___2494722299978038213_70111382841840'
app/views/projects/show.html.haml:35:in `_app_views_projects_show_html_haml__1631219155910656645_70111372098260'
lib/gitlab/i18n.rb:50:in `with_locale'
lib/gitlab/i18n.rb:56:in `with_user_locale'
app/controllers/application_controller.rb:326:in `set_locale'
lib/gitlab/middleware/multipart.rb:95:in `call'
lib/gitlab/request_profiler/middleware.rb:14:in `call'
lib/gitlab/middleware/go.rb:17:in `call'
lib/gitlab/etag_caching/middleware.rb:11:in `call'
lib/gitlab/middleware/read_only/controller.rb:28:in `call'
lib/gitlab/middleware/read_only.rb:16:in `call'
lib/gitlab/request_context.rb:18:in `call'
lib/gitlab/metrics/requests_rack_middleware.rb:27:in `call'
lib/gitlab/middleware/release_env.rb:10:in `call'
Output of checks
Results of GitLab environment info
Expand for output related to GitLab environment info
System information System: Ubuntu 16.04 Current User: git Using RVM: no Ruby Version: 2.3.6p384 Gem Version: 2.6.13 Bundler Version:1.13.7 Rake Version: 12.3.0 Redis Version: 3.2.11 Git Version: 2.14.3 Sidekiq Version:5.0.5 Go Version: go1.6.2 linux/amd64
GitLab information Version: 10.7.0 Revision: 2011c9b Directory: /opt/gitlab/embedded/service/gitlab-rails DB Adapter: postgresql URL: https://gitlab.hzdr.de HTTP Clone URL: https://gitlab.hzdr.de/some-group/some-project.git SSH Clone URL: git@gitlab.hzdr.de:some-group/some-project.git Using LDAP: yes Using Omniauth: yes Omniauth Providers: gitlab, github, bitbucket
GitLab Shell Version: 7.1.2 Repository storage paths:
- default: /var/opt/gitlab/git-data/repositories Hooks: /opt/gitlab/embedded/service/gitlab-shell/hooks Git: /opt/gitlab/embedded/bin/git
Results of GitLab application Check
Expand for output related to the GitLab application check
Checking GitLab Shell ...GitLab Shell version >= 7.1.2 ? ... OK (7.1.2) Repo base directory exists? default... yes Repo storage directories are symlinks? default... no Repo paths owned by git:root, or git:git? default... yes Repo paths access is drwxrws---? default... yes hooks directories in repos are links: ... 7/1 ... ok 6/2 ... ok 103/3 ... ok 8/4 ... ok 8/5 ... ok 6/6 ... ok 8/7 ... ok 8/8 ... ok 8/9 ... ok 8/10 ... ok 6/11 ... ok 8/12 ... ok 7/13 ... ok 5/14 ... ok 6/15 ... ok 6/16 ... ok 7/17 ... ok 12/18 ... ok 6/19 ... ok 6/20 ... ok 13/22 ... ok 13/23 ... ok 9/24 ... ok 14/25 ... ok 14/26 ... ok 5/28 ... ok 5/29 ... ok 4/31 ... repository is empty 14/32 ... ok 7/34 ... ok 31/35 ... ok 4/36 ... ok 13/37 ... ok 17/38 ... ok 17/39 ... ok 17/40 ... ok 21/41 ... repository is empty 5/42 ... ok 17/43 ... ok 103/47 ... ok 103/51 ... ok 28/52 ... ok 28/53 ... ok 28/54 ... ok 36/55 ... repository is empty 134/56 ... ok 27/57 ... ok 16/59 ... ok 41/60 ... ok 41/61 ... ok 47/62 ... ok 47/63 ... ok 27/64 ... ok 49/65 ... ok 20/66 ... ok 4/68 ... ok 28/70 ... ok 28/71 ... ok 4/73 ... ok 39/74 ... ok 47/75 ... ok 58/76 ... ok 65/78 ... ok 65/79 ... ok 67/80 ... repository is empty 67/81 ... repository is empty 72/82 ... repository is empty 18/83 ... ok 4/84 ... ok 17/85 ... repository is empty 103/86 ... ok 14/87 ... ok 18/90 ... repository is empty 78/92 ... ok 47/95 ... ok 31/96 ... ok 86/97 ... repository is empty 47/98 ... ok 47/99 ... ok 88/100 ... ok 88/101 ... ok 103/102 ... ok 14/103 ... ok 62/104 ... ok 31/105 ... repository is empty 88/106 ... ok 92/109 ... ok 47/110 ... ok 17/113 ... ok 92/115 ... ok 4/116 ... ok 87/118 ... ok 48/119 ... ok 62/120 ... ok 94/123 ... repository is empty 76/125 ... ok 25/126 ... ok 11/127 ... repository is empty 26/128 ... ok 25/129 ... ok 27/130 ... ok 86/133 ... ok 103/140 ... ok 86/143 ... ok 86/144 ... ok 6/145 ... ok 86/146 ... ok 27/148 ... ok 28/151 ... ok 104/152 ... ok 5/153 ... ok 39/154 ... ok 44/158 ... ok 44/159 ... ok 47/161 ... ok 39/162 ... ok 62/163 ... ok 62/164 ... ok 40/165 ... ok 64/166 ... ok 39/168 ... ok 120/169 ... ok 27/170 ... repository is empty 87/171 ... ok 87/172 ... ok 76/173 ... ok 5/174 ... ok 63/175 ... ok 126/176 ... ok 92/178 ... ok 5/179 ... ok 120/182 ... ok 128/183 ... ok 102/184 ... ok 129/185 ... repository is empty 130/186 ... ok 6/187 ... ok 62/188 ... ok 75/189 ... ok 14/190 ... ok 132/193 ... ok 130/194 ... ok 134/195 ... ok 134/196 ... ok 99/197 ... ok 130/198 ... ok 134/199 ... ok 134/200 ... ok 134/201 ... ok 47/202 ... ok 92/203 ... ok 130/205 ... ok 91/207 ... ok 64/208 ... ok 62/209 ... ok 40/211 ... repository is empty 17/212 ... repository is empty 140/213 ... ok 140/215 ... ok 140/216 ... ok 92/217 ... ok 117/218 ... ok 140/219 ... ok 4/220 ... ok 4/221 ... ok Running /opt/gitlab/embedded/service/gitlab-shell/bin/check Check GitLab API access: OK Redis available via internal API: OK
Access to /var/opt/gitlab/.ssh/authorized_keys: OK gitlab-shell self-check successful
Checking GitLab Shell ... Finished
Checking Sidekiq ...
Running? ... yes Number of Sidekiq processes ... 1
Checking Sidekiq ... Finished
Reply by email is disabled in config/gitlab.yml Checking LDAP ...
Checking LDAP ... Finished
Checking GitLab ...
Git configured correctly? ... yes Database config exists? ... yes All migrations up? ... yes Database contains orphaned GroupMembers? ... no GitLab config exists? ... yes GitLab config up to date? ... yes Log directory writable? ... yes Tmp directory writable? ... yes Uploads directory exists? ... yes Uploads directory has correct permissions? ... yes Uploads directory tmp has correct permissions? ... yes Init script exists? ... skipped (omnibus-gitlab has no init script) Init script up-to-date? ... skipped (omnibus-gitlab has no init script) Projects have namespace: ... 7/1 ... yes 6/2 ... yes 103/3 ... yes 8/4 ... yes 8/5 ... yes 6/6 ... yes 8/7 ... yes 8/8 ... yes 8/9 ... yes 8/10 ... yes 6/11 ... yes 8/12 ... yes 7/13 ... yes 5/14 ... yes 6/15 ... yes 6/16 ... yes 7/17 ... yes 12/18 ... yes 6/19 ... yes 6/20 ... yes 13/22 ... yes 13/23 ... yes 9/24 ... yes 14/25 ... yes 14/26 ... yes 5/28 ... yes 5/29 ... yes 4/31 ... yes 14/32 ... yes 7/34 ... yes 31/35 ... yes 4/36 ... yes 13/37 ... yes 17/38 ... yes 17/39 ... yes 17/40 ... yes 21/41 ... yes 5/42 ... yes 17/43 ... yes 103/47 ... yes 103/51 ... yes 28/52 ... yes 28/53 ... yes 28/54 ... yes 36/55 ... yes 134/56 ... yes 27/57 ... yes 16/59 ... yes 41/60 ... yes 41/61 ... yes 47/62 ... yes 47/63 ... yes 27/64 ... yes 49/65 ... yes 20/66 ... yes 4/68 ... yes 28/70 ... yes 28/71 ... yes 4/73 ... yes 39/74 ... yes 47/75 ... yes 58/76 ... yes 65/78 ... yes 65/79 ... yes 67/80 ... yes 67/81 ... yes 72/82 ... yes 18/83 ... yes 4/84 ... yes 17/85 ... yes 103/86 ... yes 14/87 ... yes 18/90 ... yes 78/92 ... yes 47/95 ... yes 31/96 ... yes 86/97 ... yes 47/98 ... yes 47/99 ... yes 88/100 ... yes 88/101 ... yes 103/102 ... yes 14/103 ... yes 62/104 ... yes 31/105 ... yes 88/106 ... yes 92/109 ... yes 47/110 ... yes 17/113 ... yes 92/115 ... yes 4/116 ... yes 87/118 ... yes 48/119 ... yes 62/120 ... yes 94/123 ... yes 76/125 ... yes 25/126 ... yes 11/127 ... yes 26/128 ... yes 25/129 ... yes 27/130 ... yes 86/133 ... yes 103/140 ... yes 86/143 ... yes 86/144 ... yes 6/145 ... yes 86/146 ... yes 27/148 ... yes 28/151 ... yes 104/152 ... yes 5/153 ... yes 39/154 ... yes 44/158 ... yes 44/159 ... yes 47/161 ... yes 39/162 ... yes 62/163 ... yes 62/164 ... yes 40/165 ... yes 64/166 ... yes 39/168 ... yes 120/169 ... yes 27/170 ... yes 87/171 ... yes 87/172 ... yes 76/173 ... yes 5/174 ... yes 63/175 ... yes 126/176 ... yes 92/178 ... yes 5/179 ... yes 120/182 ... yes 128/183 ... yes 102/184 ... yes 129/185 ... yes 130/186 ... yes 6/187 ... yes 62/188 ... yes 75/189 ... yes 14/190 ... yes 132/193 ... yes 130/194 ... yes 134/195 ... yes 134/196 ... yes 99/197 ... yes 130/198 ... yes 134/199 ... yes 134/200 ... yes 134/201 ... yes 47/202 ... yes 92/203 ... yes 130/205 ... yes 91/207 ... yes 64/208 ... yes 62/209 ... yes 40/211 ... yes 17/212 ... yes 140/213 ... yes 140/215 ... yes 140/216 ... yes 92/217 ... yes 117/218 ... yes 140/219 ... yes 4/220 ... yes 4/221 ... yes Redis version >= 2.8.0? ... yes Ruby version >= 2.3.5 ? ... yes (2.3.6) Git version >= 2.9.5 ? ... yes (2.14.3) Git user has default SSH configuration? ... yes Active users: ... 103
Checking GitLab ... Finished
Possible fixes
Somehow it ends up in this line. https://gitlab.com/gitlab-org/gitlab-ce/blob/c212908aad9b32352653dfe9ca966f148c8dfc1a/app/helpers/application_helper.rb#L106
/label ~bug