← Back to issue list

file_utils.link_or_copy_tree doesn't maintain symlinks to directories

View original Launchpad issue

Metadata

Project
snapcraft (launchpad)
Number
#1658155
Type
issue
State
closed
Author
~kyrofa
Labels
—
Created
Updated
Closed

Current evaluation

Fixed directory-symlink handling in file_utils.link_or_copy_tree by merging snapcore/snapcraft PR #1063 in commit 7768cd33b.

Resolution: closed resolved

Reason: PR #1063 was merged as commit 7768cd33b, preserving symlinks to directories as symlinks rather than copying them as directories.

Evaluated by: mr-cal-bot

No scores available.

Issue body

Numerous plugins (and snapcraft internals) use file_utils.link_or_copy_tree to migrate files around. However, it doesn't copy symlinks pointing to directories as symlinks-- it creates new directories instead. It should handle symlinks to directories exactly the same way as symlinks to files.

Evaluation history

Date Model Scores Action Summary
stealth/space-bunny-alpha — closed resolved Fixed directory-symlink handling in file_utils.link_or_copy_tree by merging snapcore/snapcraft PR #1063 in commit 7768cd33b.
stealth/space-bunny-alpha — closed resolved Fixed directory-symlink handling in file_utils.link_or_copy_tree by merging snapcore/snapcraft#1063 (commit 7768cd33b).
stealth/space-bunny-alpha — closed resolved Fixed directory-symlink handling in file_utils.link_or_copy_tree via merged PR #1063 (commit 7768cd33b).
qwen/qwen3.6-35b-a3b — — file_utils.link_or_copy_tree fails to preserve symlinks to directories. The report was abandoned and closed without resolution.
qwen/qwen3.6-35b-a3b — — Closed without comments or resolution details. The issue reported that file_utils.link_or_copy_tree failed to preserve symlinks to directories, requesting it handle them like file symlinks.

Update history

Date Change
created

Related work

  • Likely Fixed By: snapcraft#1063 (confidence 100%)

    Merged PR #1063 fixed LP #1658155 in commit 7768cd33b.

Related issues

Issue Project State Summary Similarity
#1063 file_utils: copy symlinks to directories as symlinks. snapcraft merged Merged PR #1063 as 7768cd33b, fixing LP #1658155 by preserving directory symlinks in file_utils.link_or_copy_tree().
84%
#34 utils: add helpers to link or copy files and trees craft-parts merged Merged PR #34 added helpers for linking or copying files and trees, largely ported from Snapcraft; implementation commit: 35207ac6.
73%
#1628 fix: prevent file deletion during self-linking in link_or_copy craft-parts merged PR #1628 merged (commit 98281de6): adds a samefile() guard in link_or_copy (craft_parts/utils/file_utils.py) so organize no longer unlinks/deletes the source file when a staged symlink self-links, fixing snapcraft#6168.
73%
#2123 file_utils: don't let FileNotFoundError escape snapcraft merged Merged PR #2123 in commit ae7ac6ae1, converting missing-file errors from file_utils.link_or_copy into SnapcraftError-based exceptions.
72%
#1658225 Collision detection doesn't compare symlinks to files or directories snapcraft (launchpad) closed Collision handling was fixed by snapcore/snapcraft#1064, merged as commit d4b104887, adding directory/symlink comparisons.
70%
#1614913 FAIL: test_dump_symlinks (snapcraft.tests.test_plugin_dump.DumpPluginTestCase) snapcraft (launchpad) closed Fixed by merged PR snapcraft#767 (commit d14329836), which copied common.SNAPCRAFT_FILES before use, preventing leaked test state from breaking dump symlink tests.
70%