Snippet comments where any line begins with a slash following an alphabetic character can't be published
Summary
When one tries to add a comment to a snippet which contains a line that starts with a slash followed by an alphabetical character, the comment can't be published and freezes in opaque state.
Steps to reproduce
Add a comment to any snippet and type something like
/efre
Example Project
Just try it here
What is the current bug behavior?
Placing snippet comments where any line starts with a slash followed by a literal character won't publish. This is especially annoying when you have code blocks that contain lines that start with the path to an executable, like:
/usr/bin/echo
What is the expected correct behavior?
Snippet comment should be posted without error.
Relevant logs and/or screenshots
I'm getting the following javascript error in the console:
raven.js:364 Uncaught TypeError: Cannot read property 'dataSources' of undefined
at e.value (notes.js:1668)
at HTMLDocument.dispatch (jquery.js:5183)
at HTMLDocument.v.handle (jquery.js:4991)
at HTMLDocument.a (raven.js:360)
Output of checks
Happens on Gitlab.com, CE and EE. But I'm posting it here, because I first encountered it on Omnibus EE 1.5.0
Results of GitLab environment info
Expand for output related to GitLab environment info
System information System: Proxy: no Current User: git Using RVM: no Ruby Version: 2.4.5p335 Gem Version: 2.7.6 Bundler Version:1.16.6 Rake Version: 12.3.1 Redis Version: 3.2.12 Git Version: 2.18.1 Sidekiq Version:5.2.1 Go Version: unknown
GitLab information Version: 11.5.0-ee Revision: cb71fca Directory: /opt/gitlab/embedded/service/gitlab-rails DB Adapter: postgresql DB Version: 9.6.8 URL: [masked] HTTP Clone URL: [masked]/some-group/some-project.git SSH Clone URL: git@[masked]:some-group/some-project.git Elasticsearch: no Geo: no Using LDAP: no Using Omniauth: yes Omniauth Providers:
GitLab Shell Version: 8.4.1 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 >= 8.4.1 ? ... OK (8.4.1) hooks directories in repos are links: ... 6/114 ... ok 12/123 ... ok 6/124 ... ok 6/142 ... ok 6/143 ... ok 6/144 ... ok 6/145 ... ok 6/146 ... ok 6/147 ... ok 6/148 ... ok 6/149 ... ok 6/150 ... ok 6/151 ... ok 6/152 ... ok 6/153 ... ok 6/154 ... ok 6/155 ... ok 6/156 ... ok 6/157 ... ok 6/158 ... repository is empty 6/159 ... ok 6/160 ... ok 6/161 ... ok 6/162 ... ok 6/163 ... ok 6/164 ... ok 6/165 ... ok 6/166 ... ok 6/167 ... ok 6/168 ... ok 6/169 ... ok 6/170 ... ok 6/171 ... ok 6/172 ... ok 6/173 ... ok 6/174 ... ok 6/175 ... ok 6/176 ... ok 6/177 ... ok 6/178 ... ok 6/179 ... ok 6/180 ... ok 6/181 ... ok 12/182 ... ok 6/183 ... ok 6/184 ... ok 6/185 ... ok 6/186 ... ok 6/187 ... ok 6/188 ... ok 6/189 ... ok 6/190 ... ok 6/191 ... ok 6/192 ... ok 6/193 ... ok 6/194 ... ok 6/195 ... repository is empty 6/196 ... ok 6/197 ... ok 6/198 ... ok 6/199 ... ok 6/200 ... ok 6/201 ... ok 6/202 ... ok 6/203 ... ok 6/204 ... ok 6/205 ... repository is empty 12/206 ... ok 6/207 ... ok 6/208 ... ok 6/209 ... repository is empty 6/210 ... repository is empty 6/211 ... ok 6/212 ... ok 6/213 ... ok 6/214 ... ok 6/215 ... ok 6/216 ... ok 6/217 ... ok 6/218 ... ok 6/219 ... ok 6/220 ... repository is empty 6/221 ... ok 6/222 ... ok 6/223 ... ok 6/224 ... ok 6/225 ... ok 6/226 ... ok 6/227 ... ok 6/228 ... ok 6/229 ... ok 6/230 ... ok 6/231 ... ok 6/232 ... ok 12/233 ... ok 6/234 ... ok 6/235 ... ok 12/236 ... ok 6/237 ... ok 6/238 ... ok 6/239 ... ok 6/240 ... ok 12/241 ... ok 12/242 ... ok 6/243 ... ok 6/244 ... ok 6/245 ... ok 6/246 ... ok 12/247 ... ok 12/248 ... ok 12/249 ... ok 6/250 ... ok 6/251 ... ok 11/252 ... ok 11/253 ... ok 11/254 ... ok 11/255 ... ok 11/256 ... ok 11/257 ... ok 11/258 ... ok 11/259 ... ok 11/260 ... ok 11/261 ... ok 11/262 ... ok 11/263 ... ok 11/264 ... ok 11/265 ... ok 11/266 ... ok 11/267 ... ok 11/268 ... ok 6/269 ... ok 11/273 ... ok 6/276 ... ok 12/279 ... ok 6/280 ... ok 11/284 ... ok 11/285 ... ok 11/286 ... ok 11/288 ... ok 6/289 ... ok 11/290 ... ok 6/295 ... ok 12/297 ... ok 11/299 ... ok 6/303 ... ok 6/304 ... ok 11/306 ... ok 12/308 ... ok 6/310 ... ok 6/312 ... ok 12/313 ... ok 6/315 ... ok 6/316 ... ok 6/317 ... ok 12/318 ... ok 6/319 ... ok 6/320 ... ok 6/321 ... ok 6/322 ... ok 6/323 ... ok 6/324 ... ok 6/325 ... ok 6/326 ... ok 11/327 ... ok 6/328 ... 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 Gitaly ...
default ... OK
Checking Gitaly ... Finished
Checking Sidekiq ...
Running? ... yes Number of Sidekiq processes ... 1
Checking Sidekiq ... Finished
Reply by email is disabled in config/gitlab.yml Checking LDAP ...
LDAP is disabled in config/gitlab.yml
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: ... 6/114 ... yes 12/123 ... yes 6/124 ... yes 6/142 ... yes 6/143 ... yes 6/144 ... yes 6/145 ... yes 6/146 ... yes 6/147 ... yes 6/148 ... yes 6/149 ... yes 6/150 ... yes 6/151 ... yes 6/152 ... yes 6/153 ... yes 6/154 ... yes 6/155 ... yes 6/156 ... yes 6/157 ... yes 6/158 ... yes 6/159 ... yes 6/160 ... yes 6/161 ... yes 6/162 ... yes 6/163 ... yes 6/164 ... yes 6/165 ... yes 6/166 ... yes 6/167 ... yes 6/168 ... yes 6/169 ... yes 6/170 ... yes 6/171 ... yes 6/172 ... yes 6/173 ... yes 6/174 ... yes 6/175 ... yes 6/176 ... yes 6/177 ... yes 6/178 ... yes 6/179 ... yes 6/180 ... yes 6/181 ... yes 12/182 ... yes 6/183 ... yes 6/184 ... yes 6/185 ... yes 6/186 ... yes 6/187 ... yes 6/188 ... yes 6/189 ... yes 6/190 ... yes 6/191 ... yes 6/192 ... yes 6/193 ... yes 6/194 ... yes 6/195 ... yes 6/196 ... yes 6/197 ... yes 6/198 ... yes 6/199 ... yes 6/200 ... yes 6/201 ... yes 6/202 ... yes 6/203 ... yes 6/204 ... yes 6/205 ... yes 12/206 ... yes 6/207 ... yes 6/208 ... yes 6/209 ... yes 6/210 ... yes 6/211 ... yes 6/212 ... yes 6/213 ... yes 6/214 ... yes 6/215 ... yes 6/216 ... yes 6/217 ... yes 6/218 ... yes 6/219 ... yes 6/220 ... yes 6/221 ... yes 6/222 ... yes 6/223 ... yes 6/224 ... yes 6/225 ... yes 6/226 ... yes 6/227 ... yes 6/228 ... yes 6/229 ... yes 6/230 ... yes 6/231 ... yes 6/232 ... yes 12/233 ... yes 6/234 ... yes 6/235 ... yes 12/236 ... yes 6/237 ... yes 6/238 ... yes 6/239 ... yes 6/240 ... yes 12/241 ... yes 12/242 ... yes 6/243 ... yes 6/244 ... yes 6/245 ... yes 6/246 ... yes 12/247 ... yes 12/248 ... yes 12/249 ... yes 6/250 ... yes 6/251 ... yes 11/252 ... yes 11/253 ... yes 11/254 ... yes 11/255 ... yes 11/256 ... yes 11/257 ... yes 11/258 ... yes 11/259 ... yes 11/260 ... yes 11/261 ... yes 11/262 ... yes 11/263 ... yes 11/264 ... yes 11/265 ... yes 11/266 ... yes 11/267 ... yes 11/268 ... yes 6/269 ... yes 11/273 ... yes 6/276 ... yes 12/279 ... yes 6/280 ... yes 11/284 ... yes 11/285 ... yes 11/286 ... yes 11/288 ... yes 6/289 ... yes 11/290 ... yes 6/295 ... yes 12/297 ... yes 11/299 ... yes 6/303 ... yes 6/304 ... yes 11/306 ... yes 12/308 ... yes 6/310 ... yes 6/312 ... yes 12/313 ... yes 6/315 ... yes 6/316 ... yes 6/317 ... yes 12/318 ... yes 6/319 ... yes 6/320 ... yes 6/321 ... yes 6/322 ... yes 6/323 ... yes 6/324 ... yes 6/325 ... yes 6/326 ... yes 11/327 ... yes 6/328 ... yes Redis version >= 2.8.0? ... yes Ruby version >= 2.3.5 ? ... yes (2.4.5) Git version >= 2.9.5 ? ... yes (2.18.1) Git user has default SSH configuration? ... yes Active users: ... 15 Elasticsearch version 5.1 - 5.5? ... skipped (elasticsearch is disabled)
Checking GitLab ... Finished
Possible fixes
I believe the solution lies in the fact that the system tries to interpret the line as a quick action, while these quick actions are useless in snippet comments
Availability and Testing
Once the fix is implemented, automation tests for snippet comments need to be updated to include lines starting with a slash for regression purposes.