Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • B buck
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 201
    • Issues 201
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 22
    • Merge requests 22
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Package Registry
    • Infrastructure Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • Meta
  • buck
  • Merge requests
  • !549

Cross-cell: Fix file system mismatch in macro expansion machinery

  • Review changes

  • Download
  • Email patches
  • Plain diff
Closed Administrator requested to merge github/fork/davido/fix_cross_cell_filesysteim_mismatch into master Dec 05, 2015
  • Overview 3
  • Commits 1
  • Pipelines 0
  • Changes 26

Created by: davido

Owning rule must not necessary belong to the same cell as the macros it contains:

genrule( name = 'foo', cmd = 'echo "$(location @bar//:baz)" > $OUT', out = 'qux', )

Cell can be located in the same project, but can be hijacked by the command line parameter. Consider the following configuration in .buckconfig for the example above:

[repositories] bar = lib/bar

It can optionally be relocated with --config CLI parameter:

$ buck build //:foo $ buck build --config repositories.bar=/path/to/hijacked/bar //:foo

IOW it is always wrong to assume that the owning rule and all macros it contains belong to the same cell. Remove filesystem parameter from the macro expansion machinery and rely on the rule that has access to its own filesystem to perform correct path resolution.

TEST PLAN:

  1. Clone JGit with this patch: [1].

  2. Clone Gerrit Code Review with this patch: [2].

  3. Replace JGit cell during Gerrit build, with:

    $ buck build --config repositories.jgit=/path/to/jgit gerrit

Observe that without this diff, '$(location @jgit//:jgit_src)' is expanded to /buck-out/gen/jgit_src.jar. With this diff, file system mismatch is fixed and the expansion is correct: /path/to/jgit/buck-out/gen/jgit_src.jar

[1] https://git.eclipse.org/r/61938 [2] https://gerrit-review.googlesource.com/73000

Fixes: https://github.com/facebook/buck/issues/544

Assignee
Assign to
Reviewers
Request review from
Time tracking
Source branch: github/fork/davido/fix_cross_cell_filesysteim_mismatch