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

Directory not empty in (tmp).../wp-cli-test-sqlite-integration-cache/sqlite-database-integration #212

Open
2 tasks done
BrianHenryIE opened this issue Jul 3, 2024 · 2 comments

Comments

@BrianHenryIE
Copy link
Member

Bug Report

Describe the current, buggy behavior

I went to run a Behat test on a PR I had been working on previously (wp-cli/wp-cli/#5943) and it failed to run with a Directory not empty message:

Warning: rename(/var/folders/84/0kzx05wx0hx82cbpv99r052c0000gp/T/wp-cli-test-sqlite-integration-cache/sqlite-database-integration-2.1.3/,/var/folders/84/0kzx05wx0hx82cbpv99r052c0000gp/T/wp-cli-test-sqlite-integration-cache/sqlite-database-integration/): Directory not empty in /Users/brian.henry/Sites/wp-cli/wp-cli/vendor/wp-cli/wp-cli-tests/src/Context/FeatureContext.php line 372

Describe how other contributors can replicate this bug

I'm unsure.

I removed the directory at /var/folders/84/0kzx05wx0hx82cbpv99r052c0000gp/T/wp-cli-test-sqlite-integration-cache/sqlite-database-integration/ and the test ran successfully, and repeated runs of the same test did not result in the same issue.

I can't see how this happened. This line must have evaluated true:

if ( ! is_readable( self::$sqlite_cache_dir . '/sqlite-database-integration/db.copy' ) ) {

Describe what you would expect as the correct outcome

Tests should run.

Let us know what environment you are running this on

OS:     Darwin 23.5.0 Darwin Kernel Version 23.5.0: Wed May  1 20:13:18 PDT 2024; root:xnu-10063.121.3~5/RELEASE_ARM64_T6030 arm64
Shell:  /bin/zsh
PHP binary:     /opt/homebrew/Cellar/php@8.1/8.1.28/bin/php
PHP version:    8.1.28
php.ini used:   /opt/homebrew/etc/php/8.1/php.ini
MySQL binary:   /opt/homebrew/bin/mysql
MySQL version:  mysql  Ver 8.3.0 for macos14.2 on arm64 (Homebrew)
SQL modes:      
WP-CLI root dir:        phar://wp-cli.phar/vendor/wp-cli/wp-cli
WP-CLI vendor dir:      phar://wp-cli.phar/vendor
WP_CLI phar path:       /Users/brian.henry/Sites/wp-cli/wp-cli
WP-CLI packages dir:    
WP-CLI cache dir:       /Users/brian.henry/.wp-cli/cache
WP-CLI global config:   
WP-CLI project config:  
WP-CLI version: 2.10.0

Also tested with PHP 7.4, thinking it was something stricter about 8.1 – same behaviour.

Provide a possible solution

Probably should just delete the destination directory before using it. It's a temp directory anyway.

Provide additional context/Screenshots

Repeatedly running the same tests three weeks ago was causing no problem.

@ernilambar
Copy link
Member

I have also seen this issue a handful of times. I thought this should be fixed upstream. 😊

@swissspidy
Copy link
Member

Probably should just delete the destination directory before using it. It's a temp directory anyway.

It's been a while since we added the SQLite integration, so fuzzy on the implementation details, but this sounds reasonable.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
3 participants