You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
π bones deploy reports 'β Deploy completed!' when the destination's parent folder doesn't existΒ #139
// Make destination directoryif (!is_dir($dest)) {
mkdir($dest, $permissions);
}
mkdir() is not recursive and its result isn't checked. When the parent of the deploy path doesn't exist, the destination folder is never created, so every nested mkdir() and every copy() fails with a PHP warning. Nothing reports the failure: the recursion drops each call's result (L3010), the directory branch returns true whatever happened inside it (L3016), and deploy() ignores the top-level result (L2803) and prints β Deploy completed! (L2857) with exit status 0.
The post-copy check doesn't catch it either: assertAutoloadedFilesShipped() returns early when vendor/composer/autoload_files.php is missing from the destination (L3179), which is exactly the state an empty deploy leaves.
Reproduce
v3.2.0 (the console is identical to master at a27ef46), PHP 8.2.34, macOS:
php bones deploy /tmp/missing-parent/my-plugin --no-build
echo$?# 0
ls /tmp/missing-parent # No such file or directory
For a plugin whose deploy is 221 files, the output is 76 mkdir(): No such file or directory warnings and 221 copy(β¦): Failed to open stream: No such file or directory warnings, followed by:
β Deploy completed!
π You can now deploy the plugin from the path: /tmp/missing-parent/my-plugin
How it showed up
Reproducing a Docker image build by hand. The Dockerfile creates the parent folder before running php bones deploy /package/<plugin> --no-build; the local re-run didn't, and only counting the files at the destination told the two runs apart.
Suggestion
Either create the missing parents, as mkdir -p would:
or refuse a destination whose parent doesn't exist up front, next to the other checks in assertSafeDeployDestination().
Either way, a failed mkdir() or copy() should end the deploy with exit 1. Propagating the result through the recursion needs care: xcopy() also returns false for a file it skips on purpose (dotfiles and the skip list), so today false means both "skipped" and "failed".
Activity