Skip to content

Conversation

@pmady
Copy link

@pmady pmady commented Dec 30, 2025

Summary

This PR fixes issue #2047 where rez-pkg-cache follows symlinks during package caching, which can cause failures when symlink targets are inaccessible.

Problem

The PackageCache.add_variant() method uses shutil.copytree() without the symlinks parameter, which defaults to following symlinks. This causes failures when:

  • Symlinks point to inaccessible locations
  • Symlink targets don't exist
  • Permission issues with symlink targets

Solution

Added symlinks=True parameter to shutil.copytree() call in package_cache.py line 408. This preserves symlinks instead of following them, matching the default behavior of rez-cp.

Changes

  • Modified src/rez/package_cache.py: Added symlinks=True to shutil.copytree() call
  • Updated CHANGELOG.md: Added entry for this fix

Testing

The fix aligns with how rez-cp handles symlinks (which has a --follow-symlinks flag that defaults to False). The replacing_copy() function in filesystem.py already uses this pattern correctly.

Fixes #2047

@pmady pmady requested a review from a team as a code owner December 30, 2025 03:30
@linux-foundation-easycla
Copy link

linux-foundation-easycla bot commented Dec 30, 2025

CLA Signed

The committers listed above are authorized under a signed CLA.

  • ✅ login: pmady / name: Pavan Madduri (cc26064)

@pmady pmady force-pushed the fix-pkg-cache-symlinks branch 2 times, most recently from 14e9550 to 1f16940 Compare December 30, 2025 03:43
By default, shutil.copytree follows symlinks which can cause failures
when symlink targets are inaccessible. This change adds symlinks=True
parameter to preserve symlinks instead of following them, matching the
default behavior of rez-cp.

Fixes AcademySoftwareFoundation#2047

Signed-off-by: pmady <pavan4devops@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

rez-pkg-cache follows symlinks

1 participant