fix(install): follow Windows runfiles junctions when copying files - #1076
Merged
aiuto merged 2 commits intoOct 1, 2026
Merged
Conversation
gh-worker-dd-mergequeue-cf854d Bot
pushed a commit
to DataDog/datadog-agent
that referenced
this pull request
Aug 17, 2026
<!--Please give us some feedback on your experience writing this PR ! https://app.datadoghq.com/forms/43db4c02-6837-400c-8083-692e141b1b88 !--> ### What does this PR do? As described in bazelbuild/rules_pkg#1076, Bazel creates a junction on files that is wrong as they are only supposed to be used with directories. This leads to permission errors: ```python PermissionError: [Errno 13] Permission denied ``` Co-authored-by: joseph.gette <joseph.gette@datadoghq.com>
tonyaiuto
approved these changes
Sep 30, 2026
Collaborator
|
Can you rebase and push so tests run without the broken setup. |
--enable_runfiles on Windows creates directory junctions for file runfiles. Junctions cannot point at files, so shutil.copyfile fails with Permission denied. Resolve the reparse point before copying.
Suggested by @alopezz: realpath resolves reparse points on Windows and symlinks on Unix, removing the need for sys.platform conditional and os.readlink try/except.
JSGette
force-pushed
the
jsgette/pkg-install-windows-junctions
branch
from
October 1, 2026 08:04
2bd3f8c to
e5e3b7c
Compare
JSGette
marked this pull request as ready for review
October 1, 2026 08:05
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.
pkg_installfails on Windows when--enable_runfilesis set. Bazel materializes file runfiles as directory junctions, but junctions cannot point at files, soshutil.copyfileoropen()raisesPermissionError: [Errno 13] Permission denied.os.path.realpath()resolves full path following symlinks, so that is essentially a no-op on Unix (extrastat()call) but resolves junctions on Windows