shallow rez-cp can corrupt package if there are overlapping variants #563
Closed
Description
Consider a package with 2 variants, with subpaths 'A' and 'A/B'. A shallow copy can corrupt the source package because of the following:
- Variant
<newpkg>/A
is created as symlink to<oldpkg>/A
; - Variant
<newpkg>/A/B
is created as symlink to<oldpkg>/A/B
; - Whoops, this actually has created a self-referencing symlink at
<oldpkg>/A/B
.
Overlapping variants (where one variant subpath is a parent dir of another subpath) is inherently problematic for shallow package copies.
Solution: Don't symlink at the variant dir level; instead, symlink everything inside the variant dir (excepting dirs that may be parent of overlapped variant).
Note that when dict-based variants exist, this problem will go away (as will various other problems related to current limitation of variants). For dict-based variants, I think we'll stick to the variant dir symlinking, since it's simpler.