Skip to content

[Bug]: .venv targets conflict with the primary target they're generated with past pull/551 #608

@romanoid-openai

Description

@romanoid-openai

What happened?

Static site-packages trees pull/551 introduced an action conflict between %binary% and %binary.venv% target's actions (both try to produce the same output)

We discovered it by creating a non-manual target that depends on venv, but can be easily reproduced by doing and explicit build of venv target along with it's binary

Version

Development (host) and target OS/architectures:
reproduces both on linux and darwin, re repro below is from darwin_arm64

Output of bazel --version:

rules_py % bazel --version
bazel 7.4.0

Version of the Aspect rules, or other relevant rules from your
WORKSPACE or MODULE.bazel file:

reproducible on any commit past 886aeea on the aspect repo (rules_py > 1.4.0)

Language(s) and/or frameworks involved:
didn't look on details of //py/tests/py-binary:py_test_bin

How to reproduce

Here's repro on one of the aspect_py's test binaries in latest `main` (broken starting with 886aeea, last release version not broken is `1.4.0`):

rules_py % git log -1 --oneline
5968bcb (HEAD -> main, origin/main, origin/HEAD) fix(venv_link): Repair venv link munging (#599)

rules_py % bazel build //py/tests/py-binary:py_test_bin //py/tests/py-binary:py_test_bin.venv
ERROR: file 'py/tests/py-binary/py_test_bin.venv.pth' is generated by these conflicting actions:
Label: //py/tests/py-binary:py_test_bin.venv, //py/tests/py-binary:py_test_bin
RuleClass: _py_venv_binary rule, py_binary rule
JavaActionClass: class com.google.devtools.build.lib.analysis.actions.ParameterFileWriteAction
Configuration: 1b1eb13f01e6d431aff4af0ea3c240ce189a4cc4b88827d02524e604886147da
Mnemonic: FileWrite
Action key: 0ebfa7dcfe07087c56cf2e4a12871ea2e4a315b9a920e9f7d97be0b25f33a6a4, 063454c04ff4118fbde252a76855c060800b764c75a1ae30765f085d3f92576e
Progress message: Writing file py/tests/py-binary/py_test_bin.venv.pth
Action describeKey: GUID: 45f678d8-e395-401e-8446-e795ccc6361f
Param File Type: UNQUOTED
Content digest (approximate): 6c8d76ef1d8a994cacdae8fedacb8adc34fe087250296e5f9e82de4cf5edffba
NOTE: Content digest reflects approximate, analysis-time data; it does not account for data available during execution (e.g. tree artifact expansions), GUID: 45f678d8-e395-401e-8446-e795ccc6361f
Param File Type: UNQUOTED
Content digest (approximate): 81a07e557a5873eb5f30891ff13163b17e7109c50d4066ecf093598e773ae1fb
NOTE: Content digest reflects approximate, analysis-time data; it does not account for data available during execution (e.g. tree artifact expansions)
PrimaryInput: (null)
PrimaryOutput: File:[[<execution_root>]bazel-out/darwin_arm64-fastbuild/bin]py/tests/py-binary/py_test_bin.venv.pth
Owner information: ConfiguredTargetKey{label=//py/tests/py-binary:py_test_bin.venv, config=BuildConfigurationKey[1b1eb13f01e6d431aff4af0ea3c240ce189a4cc4b88827d02524e604886147da]}, ConfiguredTargetKey{label=//py/tests/py-binary:py_test_bin, config=BuildConfigurationKey[1b1eb13f01e6d431aff4af0ea3c240ce189a4cc4b88827d02524e604886147da]}
MandatoryInputs: are equal
Outputs: are equal
Use --verbose_failures to see the command lines of failed build steps.
ERROR: com.google.devtools.build.lib.actions.MutableActionGraph$ActionConflictException: for py/tests/py-binary/py_test_bin.venv.pth, previous action: action 'Writing file py/tests/py-binary/py_test_bin.venv.pth', attempted action: action 'Writing file py/tests/py-binary/py_test_bin.venv.pth'

Any other information?

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions