Skip to content
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

Check temp folder usability before runtime #5205

Merged
merged 2 commits into from
Apr 19, 2016

Conversation

curry684
Copy link
Contributor

@curry684 curry684 commented Apr 16, 2016

Extra startup check as #4797 and #5186 show this can cause exotic hard to find errors otherwise.

@alcohol
Copy link
Member

alcohol commented Apr 18, 2016

Why not use tmpfile() ?

@curry684
Copy link
Contributor Author

You'd still need to do the separate write/read/delete checks, and I'm not sure (it's not documented) that tmpfile is guaranteed to return a file within sys_get_temp_dir(). The mentioned issues depended on code explicitly using sys_get_temp_dir downloads and files.

@Seldaek Seldaek merged commit 43eb471 into composer:master Apr 19, 2016
Seldaek added a commit that referenced this pull request Apr 19, 2016
@Seldaek
Copy link
Member

Seldaek commented Apr 19, 2016

Merged but I switched it to just print an error instead of failing hard.

@curry684 curry684 deleted the issue-5186 branch March 14, 2017 10:19
wimleers added a commit to wimleers/composer that referenced this pull request Mar 14, 2023
Composer would fail with an
```
PHP temp directory (/tmp) does not exist or is not writable to Composer. Set sys_temp_dir in your php.ini
```
error when used in parallel. Because it is checking if a file with `md5(microtime())` can be created, which is not sufficiently unique when used in parallel.

Since each Composer instance runs in its own process, this can easily be mitigated by not just partitioning based on time of use, but also based on process ID.

Original investigation: https://www.drupal.org/project/automatic_updates/issues/3338789#comment-14961390
Seldaek pushed a commit that referenced this pull request Mar 17, 2023
Composer would fail with an
```
PHP temp directory (/tmp) does not exist or is not writable to Composer. Set sys_temp_dir in your php.ini
```
error when used in parallel. Because it is checking if a file with `md5(microtime())` can be created, which is not sufficiently unique when used in parallel.

Since each Composer instance runs in its own process, this can easily be mitigated by not just partitioning based on time of use, but also based on process ID.

Original investigation: https://www.drupal.org/project/automatic_updates/issues/3338789#comment-14961390
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants