-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Description
Describe the bug
I use Gollum in a Kubernetes cluster, and the latest version threw an exception. The fix / work-around is to set LANG=C.UTF-8
in the Pod environment. If I do not do this, Ruby defaults to ASCII and one of the templates Gollum
passes to Mustache contains a non-ASCII character.
I suggest documenting that the LANG
must be set to UTF-8 or hunting down the template and making it ASCII compatible.
To Reproduce
Steps to reproduce the behavior:
- docker run --rm -p 4567:4567 -it fedora:33 /bin/bash
- dnf install -y make
cmake
gcc
gcc-c++
patch
which
redhat-rpm-config
icu
libicu-devel
openssl-devel
zlib-devel
ruby-devel
rubygem-bcrypt
rubygem-rdoc
git
graphviz
nodejs
libffi-devel
rubygem-bundler - gem install gollum
- git init /tmp/wiki
- LANG= gollum /tmp/wiki
- Point a browser at localhost:4567 and you will see an exception at
/usr/share/gems/gems/mustache-0.99.8/lib/mustache/context.rb:31:in 'gsub'
.
Expected behavior
I expect Gollum to work when LANG
is not set, or at least issue a clear warning message that it may fail.
Screenshots
No screen shots. Reproduction instructions should demonstrate the problem. I'll include the exception stacktrace, though.
2021-05-23 21:18:07 - ArgumentError - invalid byte sequence in US-ASCII:
/usr/local/share/gems/gems/mustache-0.99.8/lib/mustache/context.rb:31:in `gsub'
/usr/local/share/gems/gems/mustache-0.99.8/lib/mustache/context.rb:31:in `partial'
/usr/local/share/gems/gems/mustache-0.99.8/lib/mustache/template.rb:39:in `render'
/usr/local/share/gems/gems/mustache-0.99.8/lib/mustache/template.rb:43:in `render'
/usr/local/share/gems/gems/mustache-0.99.8/lib/mustache.rb:125:in `render'
/usr/local/share/gems/gems/mustache-0.99.8/lib/mustache/context.rb:34:in `partial'
/usr/local/share/gems/gems/mustache-0.99.8/lib/mustache/template.rb:39:in `render'
/usr/local/share/gems/gems/mustache-0.99.8/lib/mustache.rb:121:in `render'
/usr/local/share/gems/gems/mustache-0.99.8/lib/mustache/sinatra.rb:113:in `mustache'
/usr/local/share/gems/gems/gollum-5.2.3/lib/gollum/app.rb:371:in `block (2 levels) in <class:App>'
/usr/local/share/gems/gems/sinatra-2.1.0/lib/sinatra/base.rb:1675:in `call'
/usr/local/share/gems/gems/sinatra-2.1.0/lib/sinatra/base.rb:1675:in `block in compile!'
/usr/local/share/gems/gems/sinatra-2.1.0/lib/sinatra/base.rb:1013:in `block (3 levels) in route!'
/usr/local/share/gems/gems/sinatra-2.1.0/lib/sinatra/base.rb:1032:in `route_eval'
/usr/local/share/gems/gems/sinatra-2.1.0/lib/sinatra/base.rb:1013:in `block (2 levels) in route!'
/usr/local/share/gems/gems/sinatra-2.1.0/lib/sinatra/base.rb:1061:in `block in process_route'
/usr/local/share/gems/gems/sinatra-2.1.0/lib/sinatra/base.rb:1059:in `catch'
/usr/local/share/gems/gems/sinatra-2.1.0/lib/sinatra/base.rb:1059:in `process_route'
/usr/local/share/gems/gems/sinatra-2.1.0/lib/sinatra/base.rb:1011:in `block in route!'
/usr/local/share/gems/gems/sinatra-2.1.0/lib/sinatra/base.rb:1008:in `each'
/usr/local/share/gems/gems/sinatra-2.1.0/lib/sinatra/base.rb:1008:in `route!'
/usr/local/share/gems/gems/sinatra-2.1.0/lib/sinatra/base.rb:1129:in `block in dispatch!'
/usr/local/share/gems/gems/sinatra-2.1.0/lib/sinatra/base.rb:1101:in `block in invoke'
/usr/local/share/gems/gems/sinatra-2.1.0/lib/sinatra/base.rb:1101:in `catch'
/usr/local/share/gems/gems/sinatra-2.1.0/lib/sinatra/base.rb:1101:in `invoke'
/usr/local/share/gems/gems/sinatra-2.1.0/lib/sinatra/base.rb:1124:in `dispatch!'
/usr/local/share/gems/gems/sinatra-2.1.0/lib/sinatra/base.rb:939:in `block in call!'
/usr/local/share/gems/gems/sinatra-2.1.0/lib/sinatra/base.rb:1101:in `block in invoke'
/usr/local/share/gems/gems/sinatra-2.1.0/lib/sinatra/base.rb:1101:in `catch'
/usr/local/share/gems/gems/sinatra-2.1.0/lib/sinatra/base.rb:1101:in `invoke'
/usr/local/share/gems/gems/sinatra-2.1.0/lib/sinatra/base.rb:939:in `call!'
/usr/local/share/gems/gems/sinatra-2.1.0/lib/sinatra/base.rb:929:in `call'
/usr/local/share/gems/gems/rack-protection-2.1.0/lib/rack/protection/xss_header.rb:18:in `call'
/usr/local/share/gems/gems/rack-protection-2.1.0/lib/rack/protection/path_traversal.rb:16:in `call'
/usr/local/share/gems/gems/rack-protection-2.1.0/lib/rack/protection/json_csrf.rb:26:in `call'
/usr/local/share/gems/gems/rack-protection-2.1.0/lib/rack/protection/base.rb:50:in `call'
/usr/local/share/gems/gems/rack-protection-2.1.0/lib/rack/protection/base.rb:50:in `call'
/usr/local/share/gems/gems/rack-protection-2.1.0/lib/rack/protection/frame_options.rb:31:in `call'
/usr/local/share/gems/gems/rack-2.2.3/lib/rack/null_logger.rb:11:in `call'
/usr/local/share/gems/gems/rack-2.2.3/lib/rack/head.rb:12:in `call'
/usr/local/share/gems/gems/sinatra-2.1.0/lib/sinatra/show_exceptions.rb:22:in `call'
/usr/local/share/gems/gems/sinatra-2.1.0/lib/sinatra/base.rb:216:in `call'
/usr/local/share/gems/gems/sinatra-2.1.0/lib/sinatra/base.rb:1991:in `call'
/usr/local/share/gems/gems/sinatra-2.1.0/lib/sinatra/base.rb:1542:in `block in call'
/usr/local/share/gems/gems/sinatra-2.1.0/lib/sinatra/base.rb:1769:in `synchronize'
/usr/local/share/gems/gems/sinatra-2.1.0/lib/sinatra/base.rb:1542:in `call'
/usr/local/share/gems/gems/rack-2.2.3/lib/rack/handler/webrick.rb:95:in `service'
/usr/local/share/gems/gems/webrick-1.7.0/lib/webrick/httpserver.rb:140:in `service'
/usr/local/share/gems/gems/webrick-1.7.0/lib/webrick/httpserver.rb:96:in `run'
/usr/local/share/gems/gems/webrick-1.7.0/lib/webrick/server.rb:310:in `block in start_thread'
Environment Info
This is current Gollum (see recreation instructions).
This is running in IBM Cloud IKS (the managed Kubernetes offering). PODS do not have the LANG
variable set when the pod's ENTRYPOINT
is executed, and so the Ruby VM sets itself to ASCII but a character in a template Gollum is using is non-ASCII.