Skip to content

mdbook: fix support for external repositories#4027

Open
mgeisler wants to merge 1 commit into
bazelbuild:mainfrom
mgeisler:fix-mdbook-external-repository-handling
Open

mdbook: fix support for external repositories#4027
mgeisler wants to merge 1 commit into
bazelbuild:mainfrom
mgeisler:fix-mdbook-external-repository-handling

Conversation

@mgeisler
Copy link
Copy Markdown
Contributor

@mgeisler mgeisler commented May 9, 2026

When any part of an mdbook target (either the book.toml or the source files) comes from an external repository, the build was failing because the rule's staging logic and its invocation logic handled repository boundaries inconsistently.

This change:

  • Updates _map_inputs in mdbook.bzl to map external repository paths to 'external/' instead of '../'.
  • Hardens the process wrapper with a bounds check to ensure files are not staged outside the shadow work directory.
  • Adds an integration test to verify the fix and prevent regressions.

Made by Gemini, fixes #4026.

When any part of an mdbook target (either the book.toml or the source files)
comes from an external repository, the build was failing because the
rule's staging logic and its invocation logic handled repository
boundaries inconsistently.

This change:
- Updates _map_inputs in mdbook.bzl to map external repository paths
  to 'external/' instead of '../'.
- Hardens the process wrapper with a bounds check to ensure files are
  not staged outside the shadow work directory.
- Adds an integration test to verify the fix and prevent regressions.
@mgeisler
Copy link
Copy Markdown
Contributor Author

mgeisler commented May 9, 2026

  • Updates _map_inputs in mdbook.bzl to map external repository paths to 'external/' instead of '../'.

Please note that I don't know what the idiomatic way to handle such things are. Gemini came up with this and it seems to work based on its new test.

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.

mdbook fails when used with external repository

1 participant