← Back to issue list

Copy plugin: Follow symlinks if outside of snap.

View original Github issue

Metadata

Project
snapcraft
Number
#426
Type
pull request
State
merged
Author
kyrofa
Labels
—
Created
Updated
Closed

Current evaluation

Merged in canonical/snapcraft#426 (b332715a8), following absolute or out-of-part symlinks to prevent broken links and fix LP #1532515.

Resolution: closed resolved

Reason: PR #426 was merged as commit b332715a8. Its copy-plugin checks follow absolute symlinks and targets outside the part's install directory, resolving the linked Launchpad bug.

Evaluated by: mr-cal-bot

No scores available.

Issue body

Currently the copy plugin copies all symlinks (using a hard link to them if possible). It should do its best to ensure symlinks will be valid when snapped, however, and follow the ones that aren't. This PR resolves LP: [#1532515](https://bugs.launchpad.net/snapcraft/+bug/1532515) by updating the copy plugin to do a relatively conservative check for invalid symlinks. The symlink will be followed if any of the following conditions are true: - The symlink is absolute. - The symlink is pointing outside of the part's install directory. It's possible to still get broken symlinks into a snap using this plugin with certain special cases, but this should catch the majority of use-cases and avoids the complexity of trying to catch all edge cases which would involve actually rewriting symlinks.

Evaluation history

Date Model Scores Action Summary
stealth/space-bunny-alpha — closed resolved Merged in canonical/snapcraft#426 (b332715a8), following absolute or out-of-part symlinks to prevent broken links and fix LP #1532515.
stealth/space-bunny-alpha — closed resolved Merged canonical/snapcraft#426 to follow absolute symlinks and those outside the part’s install directory, keeping them valid in snaps and fixing LP #1532515.
qwen/qwen3.6-35b-a3b — — Merged. Updates the copy plugin to follow absolute symlinks and those pointing outside the part's install directory, preserving validity when snapped. Resolves LP #1532515. Modified 2 files with 142 additions and 14 deletions.
qwen3.6-35b-a3b-mtp-q6 — — Merged update to the copy plugin that follows absolute symlinks and those pointing outside the part's install directory, ensuring validity in snapped packages. Resolves Launchpad bug #1532515.

Update history

No update history recorded yet.

Related work

Related issues

Issue Project State Summary Similarity
#1532515 Copy plugin should follow symlinks that point outside of the snap snapcraft (launchpad) closed Merged in canonical/snapcraft#426 (commit b332715a8): the copy plugin now follows absolute and part-external symlinks so copied targets remain valid inside the snap.
88%
#209 Added symlinks option to the copy plugin snapcraft closed Closed unmerged in favor of redesigning copy-plugin symlink handling; commit b332715a8 later added following for symlinks pointing outside the snap.
76%
#1658774 Symlinks to libc are followed by the dump and copy plugins snapcraft (launchpad) closed Merged snapcraft#1174 as commit 2b8bac953, changing copy and dump plugins to ignore staged-package symlinks to libc instead of following or removing them.
71%
#622 Hard-link local sources instead of symlinking them. snapcraft merged Merged in canonical/snapcraft#622 (a07fa0faa), replacing local-source symlinks with hard links and falling back to copies, fixing LP #1590108.
71%
#1590108 Go plugin breaks with snapcraft.yaml in tree snapcraft (launchpad) closed Fixed by hard-linking local sources instead of symlinking them, preventing recursive GOPATH traversal; merged in snapcore/snapcraft#622 (commit a07fa0faa).
71%