-
-
Notifications
You must be signed in to change notification settings - Fork 687
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
multiple users + [ERROR] Unable to create file ... #8112
Comments
Hi, for run by multiple user, I gues you can configure the rector.php to set the temp dir by username in the config: return static function (RectorConfig $rectorConfig): void {
// ...
$user = getenv('USERNAME') ?: getenv('USER');
$rectorConfig->cacheDirectory(sys_get_temp_dir() . '/' . $user . '/rector_cached_files');
$rectorConfig->containerCacheDirectory(sys_get_temp_dir() . '/' . $user);
// ...
}; |
@samsonasik thanks for quick reply :) Then I see as a bug this method is mentioned nowhere in the documentation (https://www.google.com/search?q=rector+"containerCacheDirectory") and probably the default value should be something else than the same path for each user? (also other apps use username or some id in /tmp paths like mc, systemd, mozilla, npm...) |
Feel free to add documenation PR to https://github.com/rectorphp/getrector-com, this should need to be filled in 2 locations paths: |
@stefanides Thanks for reporting. There should be indeed 1 option to set cache for Rector and let it handle internally, as other tools do. I'm narrowing methods down in rectorphp/rector-src#4803 to |
Closing as stale to avoid piling possible solved issue. Thanks for understanding 👍 |
Bug Report
Minimal PHP Code Causing Issue
Using rector with multiple users on the same machine (not reproducible on https://getrector.org/demo/)
Expected Behaviour
Rector can be used by multiple users concurently on the same machine
Description
Hi, I am facing the same/similar like issue #8103 - when multiple users are using rector on the same machine, the cache files are shared on global
/tmp/
path allowing to create files there only to the first user. Others then see "Unable to create file..." because of wrong permissions on the "globally shared" location.Some cache paths can be configured, e.g.
$rectorConfig->cacheDirectory(__DIR__ . '/tmp/rector_cached_files');
php8.2 -d sys_temp_dir=./tmp ./vendor/bin/rector ...
but even with this the aplication still wants write to
/tmp/cache/PHPStan
,/tmp/cache/nette.configurator
and maybe more. Is there an (undocumented) way how to change ALL cache paths to some local directory or is it a bug that cache location cannot be changed to anything else than/tmp
?The text was updated successfully, but these errors were encountered: