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

only emit a mkdir into remote execution wrapper for non-empty paths #21753

Merged
merged 4 commits into from
Dec 14, 2024

Conversation

tdyas
Copy link
Contributor

@tdyas tdyas commented Dec 12, 2024

As reported in #21747, the remote execution wrapper used to set up append-only cache directories was trying to create an empty path as a directory. This occurred because Path::parent returns an empty string (Some("")) if the path was not absolute (i.e., the "root" was not "" and not "/").

Solution: Check for that condition and do not emit the mkdir in that case.

@tdyas tdyas added category:bugfix Bug fixes for released features release-notes:not-required PR doesn't require mention in release notes needs-cherrypick labels Dec 12, 2024
@tdyas tdyas added this to the 2.24.x milestone Dec 12, 2024
@tdyas tdyas requested review from benjyw and huonw December 12, 2024 21:10
Copy link
Contributor

@huonw huonw left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good.

Is there a sensible way to write a test here, to avoid regressing? (Either of this specific rust code or of the "overall" codepath that caused this)

@tdyas
Copy link
Contributor Author

tdyas commented Dec 13, 2024

Is there a sensible way to write a test here, to avoid regressing? (Either of this specific rust code or of the "overall" codepath that caused this)

The wrapper script is already written by a function. Probably makes sense to create a directory and just literally run that script in the directory?

@tdyas
Copy link
Contributor Author

tdyas commented Dec 13, 2024

Added a basic test of the wrapper script, which executes the wrapper script in a temporary directory and verified that the cache directory and sandbox symlink are created.

@tdyas tdyas merged commit 8404c62 into pantsbuild:main Dec 14, 2024
24 checks passed
@tdyas tdyas deleted the rexec/fix-wrapper-empty-strings branch December 14, 2024 00:47
@WorkerPants
Copy link
Member

I tried to automatically cherry-pick this change back to each relevant milestone, so that it is available in those older releases of Pants.

✔️ 2.24.x

Successfully opened #21760.


Thanks again for your contributions!

🤖 Beep Boop here's my run link

tdyas added a commit that referenced this pull request Dec 14, 2024
… (Cherry-pick of #21753) (#21760)

As reported in #21747, the
remote execution wrapper used to set up append-only cache directories
was trying to create an empty path as a directory. This occurred because
`Path::parent` returns an empty string (`Some("")`) if the path was not
absolute (i.e., the "root" was not `""` and not `"/"`).

Solution: Check for that condition and do not emit the `mkdir` in that
case.

Co-authored-by: Tom Dyas <tom@shoalsoftware.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
category:bugfix Bug fixes for released features release-notes:not-required PR doesn't require mention in release notes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants