Page MenuHomePhabricator

PHP Notice: Writing to /.config/psysh is not allowed
Open, Needs TriagePublic

Description

Steps to reproduce: run docker-compose exec mediawiki maintenance/shell.php

PHP Notice:  Writing to /.config/psysh is not allowed. in /var/www/html/vendor/psy/psysh/src/ConfigPaths.php on line 228
PHP Stack trace:
PHP   1. {main}() /var/www/html/maintenance/shell.php:0
PHP   2. require_once() /var/www/html/maintenance/shell.php:104
PHP   3. MediaWikiShell->execute() /var/www/html/maintenance/doMaintenance.php:99
PHP   4. Psy\Shell->__construct() /var/www/html/maintenance/shell.php:76
PHP   5. Psy\Configuration->getReadline() /var/www/html/vendor/psy/psysh/src/Shell.php:89
PHP   6. Psy\Configuration->getHistoryFile() /var/www/html/vendor/psy/psysh/src/Configuration.php:542
PHP   7. Psy\Configuration->setHistoryFile() /var/www/html/vendor/psy/psysh/src/Configuration.php:405
PHP   8. Psy\ConfigPaths::touchFileWithMkdir() /var/www/html/vendor/psy/psysh/src/Configuration.php:376
PHP   9. trigger_error() /var/www/html/vendor/psy/psysh/src/ConfigPaths.php:228
Psy Shell v0.9.12 (PHP 7.2.26-1+0~20191218.33+debian9~1.gbpb5a340+wmf1 — cli) by Justin Hileman

The shell works normally, but the error is triggered because $XDG_CONFIG_HOME is not set in the container, and neither is $HOME, because (on Linux hosts anyway) we are mapping external UID/GID to the container.

As a workaround we could bake XDG_CONFIG_HOME=/tmp into the image, but I'm not sure if that would have some other weird implications. Or maybe we could create a fake home directory like /home/docker and set HOME and XDG_CONFIG_HOME to that.

Event Timeline

kostajh created this task.Mar 29 2020, 7:06 PM
Restricted Application added a subscriber: Aklapper. · View Herald TranscriptMar 29 2020, 7:06 PM

In the context of a similar issue with wikimedia/fresh, @Niedzielski pointed out that the docker-wine project creates the user account in its entrypoint, we could consider doing something like that as well. @brennen @Jdforrester-WMF any thoughts on that?

kostajh moved this task from Backlog to To Do on the MediaWiki-Docker board.Apr 13 2020, 1:51 PM
Tgr added a subscriber: Tgr.Wed, Sep 16, 6:53 PM

tmp would work except you'd probably lose your files periodically. A fake home directory would work best IMO. (Or you can just disable persisting shell history. It's a nice feature though.)