Added a comment
[ikiwiki.git] / doc / bugs / octal_umask_setting_is_unintuitive.mdwn
1 To make ikiwiki publish world-readable files (usually what you want)
2 regardless of your umask, you override the `umask` setting to 022
3 octal (which is 18 in decimal). So far so good.
4
5 However, because it's interpreted as a plain number in Perl, the
6 way you set it varies between formats. In `IkiWiki::Setup::Standard`
7 you can use either
8
9     umask => 022
10
11 or (less obviously) one of
12
13     umask => 18
14     umask => "18"
15
16 but if you use
17
18     umask => "022"
19
20 you get the less than helpful umask of 026 octal (22 decimal).
21
22 Similarly, in `IkiWiki::Setup::Yaml` (the default for
23 [ikiwiki-hosting](http://ikiwiki-hosting.branchable.com/)
24 you have to use one of
25
26     umask: 18
27     umask: "18"
28
29 and if you try to say 022 you'll get 22 decimal = 026 octal.
30
31 [[!tag patch]]
32 [[!template id=gitbranch branch=smcv/umask-keywords author="[[smcv]]"]]
33
34 Perhaps the best way to solve this would be to have keywords
35 for the few values of `umask` that are actually useful?
36
37 * `private` (= 077 octal = 63 decimal)
38 * `group` (= 027 octal = 23 decimal)
39 * `public` (= 022 octal = 18 decimal)
40
41 I don't think g+w is a good idea in any case, because as
42 documented on [[security]], if ikiwiki makes its `srcdir`
43 group-writeable then any member of the group can "cause
44 trouble" (escalate privileges to those of the wiki user?)
45 via a symlink attack. So I don't think we need keywords
46 for those.
47
48 --[[smcv]]