Support incompatible_strict_action_env
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Idoneità per principianti
- 35/100
- Tipo di issue
- Bug
- Chiarezza
- Da chiarire
- Stato di attività
- Ferma
- Stack tecnologico
- python
- Ambito
- build-system
Direzione di ricerca
Inizia riproducendo il caso Windows con Bazel 9 e l’ambiente rigoroso delle azioni abilitato: uno sh_binary con un py_binary in data. Leggi il comportamento del launcher di Bazel per quanto riguarda i runfiles e la ricerca dell’interprete, quindi confrontalo con l’esecuzione diretta di Python e l’approccio RunEnvironmentInfo. Il lavoro è completato quando il binario annidato riesce a individuare il proprio interprete Python senza richiedere l’ereditarietà di PATH o il workaround documentato.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
As of Bazel 9, --incompatible_strict_action_env=true is the default.
Almost everything works with that set, the one exception is Windows in a particular case. That particular case appears to be when the python program is a data dep of another binary, e.g. an sh_binary with a py_binary in data. What happens is the Bazel launcher can't find the python interpreter in runfiles, so falls back to looking for python.exe on PATH. When strict action env is enabled, the outer PATH isn't inherited, so python.exe can't be found, and thus the launcher fails to execute.
A direct execution of a python program is ok, since the runfiles structure is present enough that the bazel launcher can find the interpreter.
Other than moving away from the Bazel launcher, I don't see a way to solve this. We've wanted to stop using the bazel launcher anyways, so this isn't a big deal, this case just add additional pressure to do so.
Fundamentally, when a binary is running within another binary's runfiles, the logic to find things is a bit more convoluted. We can use RunEnvironmentInfo so that tests auto-inherit PATH, but this only helps tests. binaries-in-binaries or binaries-run-by-actions wouldn't be affected.
There are two workarounds:
- Set
--incompatible_strict_action_env=false(restore non-strict env behavior, which includes PATH) - Set
--action_env=PATH(only inherit PATH for actions)
- Lingua principale
- Starlark
- Stelle
- 690
- Fork
- 722
- Merge medio
- 1g 55m
- PR unite (30g)
- 38
Guida per i contributori
Apri la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di bazel-contrib/rules_python
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 70/100
bazel-contrib/rules_python#4179 ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
bazel-contrib/rules_python#4164 · 1 commento ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
bazel-contrib/rules_python#3821 ·
-
Difficoltà 3/5 1-2 giorni Idoneità per principianti 45/100
bazel-contrib/rules_python#4181 ·
-
Release 2.4.0 Apertatype: release
Difficoltà 4/5 3-5 giorni Idoneità per principianti 25/100
bazel-contrib/rules_python#4175 · 3 commenti ·
Tutte le issue di bazel-contrib/rules_python
Issue simili
-
typst-0.12 Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
commercialhaskell/stackage#8127 ·
-
[CI] Nightly Clang build broken: structured binding captured in a lambda in FileDataSource.cpp Apertabug build
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 91/100
facebookincubator/velox#19194 ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 84/100
-
agentic-workflows maintenance
Difficoltà 2/5 1-3 ore Idoneità per principianti 85/100
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
nebari-dev/jhub-apps#742 ·