Crash on non ascii discription of changes
I try to save changes with some utf8 comment, but got message:
Server error: git: recoverEncode: invalid argument (invalid character)
Comment is "Тестовое сообщение" on Russian. All comment in ASCII work good.
gitit 0.10.0.1 git 1.7.10.4 x86_64 GNU/Linux
I have the same problem … the innocuous UTF-8 character “…” triggered it for me. I'm using gitit 0.9-1ubuntu1 and git 1:1.7.9.5-1, both of ubuntu 12.04 x86_64.
I couldn't reproduce this. Make sure your system is running with UTF-8 locale.
locale should report UTF-8.
@jgm And I can reproduce this.
What does locale say?
+++ Cysioland [Sep 11 15 08:06 ]:
[1]@jgm And I can reproduce this.
— Reply to this email directly or [2]view it on GitHub.
References
- https://github.com/jgm
- https://github.com/jgm/gitit/issues/393#issuecomment-139570104
I can reproduce:
# cat /proc/27066/environ | tr '\0' '\n'
LANG=de_DE.UTF-8
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
HOME=/home/gitit
LOGNAME=gitit
USER=gitit
SHELL=/bin/bash
I had a German umlaut (ü in this case) and got the error:
Happstack 7.6.1
Something went wrong here
Internal server error
Everything has stopped
The error was "git: recoverEncode: invalid argument (invalid character)"
I was able to fix by using C.UTF-8, though since we are committing these from a webform, we should be able to fix to UTF-8 by default, right? Then it becomes independent of the users setting the right locale.
For reference, the system has these locales installed:
# localectl list-locales
C.UTF-8
de_DE.utf8
en_US.utf8
The lowercase .utf8 might have confused something.
Maybe it’s helpful to some, our gitit is run from this systemd service file:
# systemctl cat gitit
# /etc/systemd/system/gitit.service
[Unit]
Description=OpenLab custom gitit wiki
After=network.target
[Service]
ExecStart=/home/gitit/gitit-0.13.0.0/bin/gitit --listen 127.0.0.1 --port 5001 +RTS -I0 -RTS
WorkingDirectory=/home/gitit/gitit-db
User=gitit
Group=users
Restart=on-abort
Environment="LC_ALL=C.UTF-8"
[Install]
WantedBy=multi-user.target
The ~~manual~~ README.markdown does say
So you should make sure that you are using a UTF-8 locale when running gitit. (To check this, type
locale.)
It ought to be possible to set LANG in the process running the git commands, but this would have to be done in the filestore library (see the local function runGitCommandWithEnv in Git.hs there). It would mean a change in behavior for that library, so maybe a bit risky.