Debug sphinxdocs build fails when target is in root dir
維護者通常 1 天內回覆
還沒有人認領這個 Issue。
評估
- 難度
- 2/5
- 預估耗時
- 1-3 小時
- 新手友好度
- 88/100
- Issue 類型
- 缺陷
- 描述清晰度
- 描述清楚
- 活躍度
- 活躍
研究方向
檢查 sphinxdocs/private/sphinx_run_template.sh 和 sphinxdocs/private/sphinx.bzl 中的 _sphinx_run_impl,然後使用文件記載的 checkout 和 bazelisk run :code.run 重現。完成標準是:root package 中的 sphinx 二進位目標能夠透過產生的 debug runner 成功執行,且不出現 env: ‘build’ 錯誤。
由索引模型根據 Issue 內容生成。
描述
🐞 bug report
(I let an agent generate this report. I've verified the minimal repro steps as well as the workaround.)
Affected Rule
The issue is caused by the rule: sphinx_docs / sphinx_run (@sphinxdocs//sphinxdocs:sphinx.bzl)
Is this a regression?
No.
Description
When a sphinx_docs target specifies a sphinx binary target defined in the root package of the main repository (e.g., //:build), building the docs normally (bazel build :code) succeeds, but running the generated debug runner target (bazel run :code.run) fails with env: ‘build’: No such file or directory.
Root cause:
- In
_sphinx_run_impl(sphinxdocs/private/sphinx.bzl),%SPHINX_RUNFILES_PATH%insphinx_run_template.shis substituted withsphinx[DefaultInfo].files_to_run.executable.short_path. - When the
sphinxbinary target is in the root package (//:build), itsshort_pathis"build"(which contains no/directory separator). - At runtime,
code.runexecutes in its runfiles directory (code.run.runfiles/_main) and resolves$sphinx:
Becausefor path in "build" "bazel-out/k8-opt-exec/bin/build"; do if [[ -e $path ]]; then sphinx=$path break fi donebuildexists in the current working directory,[[ -e "build" ]]succeeds and setssphinx="build". - Finally,
code.runruns:
Becauseexec env "${sphinx_env[@]}" -- "$sphinx" "${args[@]}" "$@" "$source_dir" "$output_dir""build"does not contain a slash (/),env(execvp) searches$PATHinstead of the current working directory and fails withenv: ‘build’: No such file or directory.
Suggested fix:
In sphinxdocs/private/sphinx_run_template.sh, prefix ./ when checking/assigning relative paths (e.g., for path in "./%SPHINX_RUNFILES_PATH%" "./%SPHINX_EXEC_PATH%"; do or sphinx="./$path").
🔬 Minimal Reproduction
git clone https://github.com/kaycebasques/experiments.git
cd experiments
git checkout 8bd9278d07ee7a8da916941e967e5f20b5354f7a
cd 20260930
bazelisk build :code # succeeds
bazelisk run :code.run # fails
(Workaround: in 20260930/BUILD.bazel, renaming the binary target from name = "build" to name = "bin/build" or moving it into a subpackage so short_path contains a / makes bazel run :code.run succeed.)
🔥 Exception or Error
INFO: Running command line: bazel-bin/code.run
+ exec env -- build --show-traceback --builder=html --fail-on-warning _code/_sources /tmp/sphinx-out
env: ‘build’: No such file or directory
🌍 Your Environment
Operating System:
Linux (Debian x86_64)
Output of bazel version:
Bazelisk version: v1.28.1
Build label: 9.2.0
Rules_python version:
rules_python: 1.8.5
sphinxdocs: 2.2.0
Anything else relevant?
N/A
- 主要語言
- Starlark
- 星號
- 688
- 分支
- 728
- 平均合併
- 22 小時 42 分鐘
- 30 天內合併 PR
- 111
環境準備
- 沒有 Dockerfile 或 Docker Compose 檔案
- 有 Pull Request 範本
- 閱讀貢獻指南
從這裡開始
- 先讀完整個 Issue,再讀專案的貢獻指南。
- 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
- Fork 儲存庫,在一個分支上完成修改。
- 送出 Pull Request,並在描述裡引用這個 Issue 編號。
bazel-contrib/rules_python 的其他 Issue
-
難度 1/5 1 小時以內 新手友好度 82/100
bazel-contrib/rules_python#4319 ·
維護者通常 1 天內回覆
-
難度 2/5 1-3 小時 新手友好度 68/100
bazel-contrib/rules_python#4251 · 1 個 reaction ·
維護者通常 1 天內回覆
-
難度 2/5 1-3 小時 新手友好度 78/100
bazel-contrib/rules_python#4164 · 1 則留言 ·
維護者通常 1 天內回覆
-
need: repro
難度 5/5 一週以上 新手友好度 35/100
bazel-contrib/rules_python#4315 · 1 則留言 ·
維護者通常 1 天內回覆
-
難度 5/5 一週以上 新手友好度 45/100
bazel-contrib/rules_python#4311 ·
維護者通常 1 天內回覆
查看 bazel-contrib/rules_python 的全部 Issue
相似的 Issue
-
難度 2/5 1-3 小時 新手友好度 67/100
MISP/misp-workbench#496 ·
維護者通常 1 天內回覆
-
bug
難度 2/5 1-3 小時 新手友好度 78/100
維護者通常 1 天內回覆
-
難度 2/5 1-3 小時 新手友好度 76/100
microsoft/cpp_client_telemetry#1550 ·
-
難度 2/5 1-3 小時 新手友好度 78/100
ash-project/ash_typescript#106 ·
-
Missing LICENSE未關閉
難度 1/5 1 小時以內 新手友好度 76/100
duckdb/extension-ci-tools#454 ·
維護者通常 1 天內回覆