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

Find runfiles in directories that are themselves runfiles #1

Merged
merged 1 commit into from
Mar 26, 2022

Conversation

fmeum
Copy link
Contributor

@fmeum fmeum commented Nov 26, 2021

When a target has a runfile that is contained in a directory that is
itself one of its runfiles, the runfile will be shadowed by the
SymlinkEntry for the directory. While this still allows to resolve the
file in the runfiles symlink tree, a manifest-based lookup will fail.

This PR extends the lookup logic to also find runfiles contained within
directories that are themselves runfiles. It does so by searching the
manifest not only for the exact provided rlocation path, but also for
all path prefixes. If a prefix is looked up successfully, the
corresponding suffix is resolved relative to the looked up path.

See bazelbuild/bazel#14336 for more context.

@fmeum fmeum marked this pull request as draft November 26, 2021 12:34
@fmeum
Copy link
Contributor Author

fmeum commented Nov 26, 2021

@phst I submitted this PR to keep this runfiles library in sync with the Bazel-provided ones after a potential resolution of bazelbuild/bazel#14336. I have marked it as a draft just in case bazelbuild/bazel#14335 is not accepted.

@fmeum fmeum force-pushed the runfiles-dirs branch 2 times, most recently from 6791d7d to 1e44425 Compare February 5, 2022 13:02
@fmeum
Copy link
Contributor Author

fmeum commented Feb 5, 2022

@phst The corresponding Bazel PR bazelbuild/bazel#14335 has been approved. Would that be sufficient for you to accept this PR or do you want me to update Bazel docs first?

@fmeum fmeum marked this pull request as ready for review February 5, 2022 16:42
@phst
Copy link
Owner

phst commented Mar 8, 2022

@phst The corresponding Bazel PR bazelbuild/bazel#14335 has been approved. Would that be sufficient for you to accept this PR

absolutely, sorry for the delay!

manifest.go Outdated Show resolved Hide resolved
manifest.go Outdated Show resolved Hide resolved
@fmeum
Copy link
Contributor Author

fmeum commented Mar 20, 2022

@phst Friendly ping. Are there any more changes I should make?

Copy link
Owner

@phst phst left a comment

Choose a reason for hiding this comment

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

Just a few remaining nits

manifest.go Outdated Show resolved Hide resolved
manifest.go Outdated Show resolved Hide resolved
manifest.go Outdated Show resolved Hide resolved
runfiles_test.go Outdated Show resolved Hide resolved
runfiles_test.go Outdated Show resolved Hide resolved
runfiles_test.go Outdated Show resolved Hide resolved
runfiles_test.go Outdated Show resolved Hide resolved
runfiles_test.go Outdated Show resolved Hide resolved
When a target has a runfile that is contained in a directory that is
itself one of its runfiles, the runfile will be shadowed by the
SymlinkEntry for the directory. While this still allows to resolve the
file in the runfiles symlink tree, a manifest-based lookup will fail.

This PR extends the lookup logic to also find runfiles contained within
directories that are themselves runfiles. It does so by searching the
manifest not only for the exact provided rlocation path, but also for
all path prefixes. If a prefix is looked up successfully, the
corresponding suffix is resolved relative to the looked up path.

See bazelbuild/bazel#14336 for more context.
@phst phst merged commit 61ddb5b into phst:master Mar 26, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants