Drop escapeshellcmd() pass on tar command line - #132
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (2)
📝 WalkthroughWalkthroughThe tar archive command now passes directly to ChangesTar command handling
Estimated code review effort: 2 (Simple) | ~10 minutes Possibly related PRs
Suggested reviewers: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches 💡 1🛠️ Fix failing CI checks 💡
📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
There was a problem hiding this comment.
Pull request overview
This PR fixes wp dist-archive tarball generation when the source directory path contains characters like parentheses by avoiding a second escaping pass that corrupts already-safely-quoted shell arguments.
Changes:
- Removed the additional
escapeshellcmd()pass before running thetarcommand and deleted the now-unused helper method. - Added a Behat acceptance scenario to ensure tarball generation succeeds when the project directory contains parentheses.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
src/Dist_Archive_Command.php |
Launches the tar command using the Utils\esc_cmd() output directly (avoids introducing literal backslashes inside single-quoted args). |
features/dist-archive.feature |
Adds acceptance coverage for running wp dist-archive on a directory name containing parentheses. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Follow-up to #131.
Overview
Utils\esc_cmd()safely single-quotes arguments passed to the shell. Calling$this->escapeshellcmd()on the output ofesc_cmd()caused PHP's nativeescapeshellcmd()to insert backslashes before special characters (such as parentheses(,),$,;, etc.) inside single quotes'...'. In shell execution, backslashes inside single quotes are interpreted as literal backslashes, causingtarcommand line invocations to fail when project directory paths contain special characters.Changes
$this->escapeshellcmd()pass prior to launching thetarprocess and removed the unused helper method.wp dist-archiveruns cleanly on project paths containing parentheses.Summary by CodeRabbit