Skip to content

Targets with identical names in multiple remote repositories conflict #341

@bsilver8192

Description

@bsilver8192

I get an error like this:

$ bazel build ...
ERROR: file '_middlemen/_Ctarget' is generated by these conflicting actions:
Label: @b_repository//:target, @a_repository//:target
RuleClass: filegroup rule
Configuration: 23de93dc7bcaa286623e318ca2a05cd2
Mnemonic: Middleman
Progress message: (null)
MandatoryInputs: attempted action contains artifacts not in previous action and previous action contains artifacts not in attempted action: [Artifact:[/home/brian/.cache/bazel/_bazel_brian/442c1c4afe824394ccb4e9b66b2e2d84[source]]external/b_repository/file.c], [Artifact:[/home/brian/.cache/bazel/_bazel_brian/442c1c4afe824394ccb4e9b66b2e2d84[source]]external/a_repository/file.c]
Outputs: are equal
.
ERROR: Analysis of target '@b_repository//:target' failed; build aborted.
INFO: Elapsed time: 0.189s

My minimal test case which produced the above error has 3 files in the workspace and a zip file with 1 file in it. Here's the contents of all the files in the workspace:
WORKSPACE:

new_http_archive(
  name = 'a_repository',
  url = 'file:///tmp/test.zip',
  sha256 = '749be30519952a2d0397e11219b992a45cb4d7f51f9dccf16d512bdafac9191c',
  build_file = 'BUILD.repository',
)

new_http_archive(
  name = 'b_repository',
  url = 'file:///tmp/test.zip',
  sha256 = '749be30519952a2d0397e11219b992a45cb4d7f51f9dccf16d512bdafac9191c',
  build_file = 'BUILD.repository',
)

bind(
  name = 'a_remote',
  actual = '@a_repository//:target',
)

bind(
  name = 'b_remote',
  actual = '@b_repository//:target',
)

BUILD:

cc_library(
  name = 'output',
  srcs = [
    '//external:a_remote',
    '//external:b_remote',
  ],
)

BUILD.repository:

package(default_visibility = ['//visibility:public'])
filegroup(
  name = 'target',
  srcs = [ 'file.c' ],
)

/tmp/test.zip contains only an empty file named file.c at the top level.

I'm not succeeding at reproducing the issue using binds from local targets in the WORKSPACE file, but I might be missing something.

Metadata

Metadata

Assignees

Labels

P1I'll work on this now. (Assignee required)type: bug

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions