]> sipb.mit.edu Git - ikiwiki.git/blob - doc/bugs/blog_posts_not_added_to_mercurial_repo.mdwn
bug responses
[ikiwiki.git] / doc / bugs / blog_posts_not_added_to_mercurial_repo.mdwn
1 I am using mercurial as RCS backend and ikiwiki 2.40.
2
3 It seems that, when adding a blog post, it is not immediately commited to the mercurial repo. I have a page with this directive:
4
5     \[[!inline pages="journal/blog2008/* and !*/Discussion" show="0" feeds="no" actions="yes" rootpage="journal/blog2008"]]
6
7 When I add a blog post, I see it on the wiki but it doesn't appear on `History` or `RecentChanges`. If I run `hg status` on the wiki source dir, I see the new file has been marked as `A` (ie, a new file that has not been commited).
8
9 If I then edit the blog post, **then** the file gets commited and I can see the edit on `History` and `RecentChanges`. The creation of the file remains unrecorded.  --[[buo]]
10
11 > Ikiwiki calls `rcs_add()` if the page is new, followed by `rcs_commit()`.
12 > For mercurial, these run respectively `hg add` and `hg commit`. If the
13 > add or commit fails, it will print a warning to stderr, you might check
14 > apache's error.log to see if there's anything there. --[[Joey]]
15
16 >>The problem was using accented characters (é, í) on the change comments. I didn't have
17 >>an UTF-8 locale enabled in my setup file. By coincidence this happened for the first time
18 >>in a couple of consecutive blog posts, so I was mistaken about the root of the problem. I don't know if
19 >>you will consider this behavior a bug, since it's strictly speaking a misconfiguration but it
20 >>still causes ikiwiki's mercurial backend to fail. A quick note in the docs might be a good idea. For my part, please
21 >>close this bug, and thanks for the help.  --[[buo]]
22
23 >>> So, in a non-utf8 locale, mercurial fails to commit if the commit
24 >>> message contains utf8? --[[Joey]]
25
26 >>>> (Sorry for the delay, I was AFK for a while.) What I am seeing is this: in a non-utf8 locale, using mercurial "stand-alone" (no ikiwiki involved), mercurial fails to commit if the commit message has characters such as á. If the locale is utf8, mercurial works fine (this is with mercurial 1.0).
27
28 >>>> However, the part that seems a bit wrong to me, is this: even if my locale is utf8, I have to explicitly set a utf8 locale in the wiki's setup file, or the commit fails. It looks like ikiwiki is not using this machine's default locale, which is utf8. Also, I'm not getting any errors on apache's error log.
29
30 >>>> Wouldn't it make sense to use the machine's default locale if 'locale' is commented out in the setup file?
31
32 >>>>> Ikiwiki wrappers only allow whitelisted environment variables
33 >>>>> through, and the locale environment variables are not included
34 >>>>> currently.
35 >>>>>
36 >>>>> But that's not the whole story, because "machine's default locale"
37 >>>>> is not very well defined. For example, my laptop is a Debian system.
38 >>>>> It has a locale setting in /etc/environment (`LANG="en_US.UTF-8"`).
39 >>>>> But even if I start apache, making sure that LANG is set and exported
40 >>>>> in the environment, CGI scripts apache runs do not see LANG in their 
41 >>>>> environment. (I notice that `/etc/init.d/apache` explocitly
42 >>>>> forces LANG=C. But CGI scripts don't see the C value either.)
43 >>>>> Apache simply does not propigate its runtime environment to CGI
44 >>>>> scripts, and this is probably to comply with the CGI specification
45 >>>>> (although it doesn't seem to completly rule out CGI's being passed
46 >>>>> other variables).
47 >>>>>
48 >>>>> If mercurial needs a utf-8 locale, I guess the mercurial plugin needs
49 >>>>> to check if it's not in one, and do something sane (either fail
50 >>>>> earlier, or complain, or strip utf-8 out of comments). --[[Joey]]