← Back to issue list

Follow symlinks while hard-linking migrated files.

View original Github issue

Metadata

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

Current evaluation

Merged PR #478 as commit 313023188, resolving symlinks with os.path.realpath() before hard-linking migrated files and preventing broken links in generated snaps.

Resolution: closed resolved

Reason: PR #478 was merged as commit 313023188. It resolves source paths with os.path.realpath() before calling os.link(), fixing LP #1572664.

Evaluated by: mr-cal-bot

No scores available.

Issue body

Currently Snapcraft does its best to migrate files efficiently by utilizing hard links. However, `os.link()` doesn't seem to respect its `follow_symlinks` parameter, which results in broken symlinks in the final snap. This PR fixes LP: [#1572664](https://bugs.launchpad.net/snapcraft/+bug/1572664), working around that issue by utilizing `os.path.realpath()`.

Evaluation history

Date Model Scores Action Summary
stealth/space-bunny-alpha — closed resolved Merged PR #478 as commit 313023188, resolving symlinks with os.path.realpath() before hard-linking migrated files and preventing broken links in generated snaps.
stealth/space-bunny-alpha — closed resolved Merged PR #478 as commit 313023188, fixing broken symlinks during hard-link migration by resolving paths with os.path.realpath() (LP #1572664).
stealth/space-bunny-alpha — closed resolved Merged PR #478 as commit 313023188, fixing broken symlinks during hard-link migration by resolving source links with os.path.realpath() (LP #1572664).
qwen/qwen3.6-35b-a3b — — Merged fix for broken symlinks during Snapcraft file migration. Replaced os.link() with os.path.realpath() to properly follow symlinks, resolving Launchpad bug 1572664. Two files changed, +51/-3 lines.
qwen3.6-35b-a3b-mtp-q6 — — Merged a fix for broken symlinks during file migration in Snapcraft. The change uses os.path.realpath() to properly follow symlinks before hard-linking, resolving Launchpad bug #1572664.

Update history

No update history recorded yet.

Related work

Related issues

Issue Project State Summary Similarity
#1572664 Migrated files don't follow symlinks if they're hard linked snapcraft (launchpad) closed Broken symlinks from hard-linking migrated files fixed by ubuntu-core/snapcraft PR #478, merged as commit 313023188 which resolves sources with os.path.realpath() before os.link(); LP bug closed.
83%
#3174 link_or_copy: do not try to create hardlinks to symlinks. snapcraft merged Merged PR #3174 (commit 221a43803) to copy symlinks instead of attempting hard links, preventing errors on mounted macOS volumes.
72%
#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%
#3370 repo: address issue with fix_symlink() when pointed at directory snapcraft merged PR #3370 merged as 44d5277a7: fix_symlink() now warns about dangling symlinks pointing at directories instead of crashing shutil.copyfile (SNAPCRAFT-2AV), plus refactor/docs.
70%