Execution rights on an object can corrupt local cache

Summary

Because we use linking of files form cache, when an object require execution rights, the execution rights leak into the local cache. This breaks reproducibility of builds, because a file might have no execution right or have it whether another artifact contains the same object with execution rights is on the local cache or not.

Steps to reproduce

  • Have element a.bst that creates a file a.
  • Have element b.bst that build-depends on a.bst.
  • Build b.bst and see that file a has no execution rights.
  • Have element c.bst that build-depends on a.bst. It installs a and chmod +x it.
  • Build b.bst again.

What is the current bug behavior?

a has execution rights on the second build.

What is the expected correct behavior?

a does not have execution rights on the second build.

Relevant logs and/or screenshots

Possible fixes

Other relevant information

  • BuildStream version affected: /milestone %BuildStream_v1.x