Page MenuHomePhabricator

Ownership of the /tmp/mw-cache directories should be www-data in the mediawiki-multiversion image
Closed, ResolvedPublic


While trying to run MediaWiki on kubernetes using our restricted mediawiki-multiversion image, I stumbled upon the following problem:

$ curl -H 'Host:' https://staging.svc.eqiad.wmnet:4444/wiki/Main_Page
<br />
<b>Warning</b>:  rename(/tmp/conf2-enwiki.jsonxmqiV2,/tmp/mw-cache-1.37.0-wmf.4/conf2-enwiki.json): Permission denied in <b>/srv/mediawiki/multiversion/MWConfigCacheGenerator.php</b> on line <b>327</b><br />
<br />

This is due to the fact that the cache directories are owner by user "somebody" and not by user "www-data" (uid 33):

oblivian@kubestage1001:~$ sudo docker exec --user root -ti 93754a6c677c /bin/bash
root@mediawiki-pinkunicorn-6d86dcd4fc-tptrg:/srv/mediawiki# cd /tmp/
root@mediawiki-pinkunicorn-6d86dcd4fc-tptrg:/tmp# ls -lart
total 0
drwxr-xr-x  2 somebody somebody  31 May 14 19:55 mw-cache-1.37.0-wmf.4
drwxr-xr-x  2 somebody somebody  36 May 14 19:57 mw-cache-1.37.0-wmf.5
drwxr-xr-x 21 root     root     269 Jun  8 16:03 ..
drwxrwxrwt  4 root     root      64 Jun  8 16:05 .

Event Timeline

I suspect we just need to remove the directories, as they only contain a cached configuration for aawiki which I guess gets generated while generating the l10n cache.

So I guess we can just run rm -rf /tmp/mw-cache in the last step of the build.

Change 698828 had a related patch set uploaded (by Ahmon Dancy; author: Ahmon Dancy):

[operations/mediawiki-config@master] Clean up cruft in /tmp/mw-cache-* before publishing

Change 698828 merged by jenkins-bot:

[operations/mediawiki-config@master] Clean up cruft in /tmp/mw-cache-* before publishing

dancy claimed this task.
dancy subscribed.

@Joe This should be fixed now.

You can use this image for verification. It contains 1.37.0-wmf.7 and .9.