The Wayback Machine - https://web.archive.org/web/20201114033923/https://github.com/box-project/box/issues/440
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

/tmp/box gets wiped without a confirmation or a warning #440

Open
sanmai opened this issue Sep 23, 2019 · 3 comments
Open

/tmp/box gets wiped without a confirmation or a warning #440

sanmai opened this issue Sep 23, 2019 · 3 comments

Comments

@sanmai
Copy link
Contributor

@sanmai sanmai commented Sep 23, 2019

Bug report

Question Answer
Box version 3.8.0@e7d8df3
PHP version 7.3.8-1
Platform with version Linux
Github Repo n/a

I had a directory I created for my own purposes named /tmp/box (I've mounted an external drive there by occasion also named "box", hence the directory to mount it). Next I start unit tests for the box itself, only to find moments later that my external drive was made sparkling clean. Empty just like new. I had my backups, but if I didn't, that's will be very painful.

Box should not delete files it does not own and create during either normal functioning or testing, or even better - not to write to an existing directory by means of using a temporary directory with a random name.

@sanmai
Copy link
Contributor Author

@sanmai sanmai commented Sep 23, 2019

Steps to reproduce:

cd /tmp
git clone --depth=1 https://github.com/humbug/box
cd box/
composer install
./vendor/phpunit/phpunit/phpunit

Expected output: no error.

Actual output:

PHP Fatal error:  Uncaught Error: Class 'PHPUnit\Framework\Error\Warning' not found in /tmp/box/vendor/phpunit/phpunit/src/Util/ErrorHandler.php:101

The last tests were:

Test 'KevinGH\Box\Compactor\PlaceholderTest::test_it_is_serializable' started
Test 'KevinGH\Box\Compactor\PlaceholderTest::test_it_is_serializable' ended
Test 'KevinGH\Box\Composer\ComposerConfigurationTest::test_it_returns_an_empty_list_when_trying_to_retrieve_the_list_of_dev_packages_when_no_composer_json_file_is_found with data set #0 (true)' started
@theofidry
Copy link

@theofidry theofidry commented Sep 23, 2019

How would you determine that the directory was created by Box itself or someone else? The offending code is here.

Maybe I can just change box to something else, but I originally wanted to keep it recognisable to easily know what were the tmp files created by the tests

@sanmai
Copy link
Contributor Author

@sanmai sanmai commented Sep 23, 2019

One option is to don't clean up. It'll get cleaned anyway by a reboot or something.

Other option is only to remove files matching the pattern which make_tmp_dir uses.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants
You can’t perform that action at this time.