Conversation
The export/import pipeline ignored its exit status, so a failed remote export could pipe a truncated dump into wp db import and the sync would still report success. Run the pipe under pipefail, count a non-zero exit as a failed task, and skip the post-sync queries when the import didn't complete.
Only the literal string 'false' counted as a failure, so an ssh connection that dropped after the first check and produced no output slipped through and the sync carried on against a broken connection.
A failed rsync left no trace: the task printed its progress and the run finished green. Non-zero exits now count as failed tasks, except code 24 (files vanished mid-transfer), which is routine when the live site is writing uploads during the sync.
A project location, uploads folder or exclude pattern containing a space or shell metacharacter split the rsync command apart. The remote and local paths and each exclude are now passed through escapeshellarg.
PHP 8.5 deprecates the backtick operator, so the which pv / which rsync checks throw deprecation notices during a sync. Backticks are an alias for shell_exec(), so this is the same behaviour on every PHP version, just without the notice.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
A few ways a failed sync could pass silently, one commit each:
wp db exportdying mid-stream (dropped SSH, disk full, bad credentials) piped a truncated dump intowp db import, ran the post-sync queries against a partial database, and still finished green. The pipe now runs underset -o pipefail, a non-zero exit counts as a failed task, and the post-sync queries are skipped when the import didn't complete.false, so an ssh failure producing no output slipped through. Anything buttruenow fails the check.whichchecks are swapped forshell_exec()— PHP 8.5 deprecates the backtick operator, so syncs on 8.5 throw deprecation notices otherwise. Same behaviour on every PHP version.