← Back to issue list

Don't follow symlinks for remote-builds

View original Github issue

Metadata

Project
craft-application
Number
#721
Type
issue
State
open
Author
mr-cal
Labels
Status: Triaged Type: Enhancement
Created
Updated
Closed
—

Current evaluation

Remote-build worktree copy still follows symlinks and has no try/except around copytree, so copy failures bubble up as internal errors. Only dangling-symlink skipping (PR #1104) landed.

Suggested action: keep open

Reason: Triaged enhancement from a maintainer with a pinpointed target (worktree.py copytree call). Inspecting the current file shows only one of the two asks was partially addressed: `copytree(self._project_dir, self._repo_dir, ignore_dangling_symlinks=True)` landed via commit 8256b7a2 "fix(remote-build): ignore dangling symlinks (#1104)", but `symlinks=True` is still absent (the only `follow_symlinks=False` in the repo is in services/init.py:237) and the copytree call still has no try/except, so shutil errors still surface as internal errors. The issue remains valid and should stay open.

Evaluated by: mr-cal-bot

Impact: 45 Quick Win: 29 Complexity: 25 Confidence: 88 Actionability: 85

Issue body

### What needs to get done Craft-application should set `symlinks=True` when setting up the [remote-build work dir](https://github.com/canonical/craft-application/blob/ea697712fc92177a3669270e168f638272cc22f6/craft_application/remote/worktree.py#L54). Additionally, there should be a try/except when copying files. Currently, it bubbles up as an internal error. ### Why it needs to get done Craft-application shouldn't follow symlinks when copying the project directory to a temporary working directory. The working directory should be as identical as possible to the project directory. Additionally, following symlinks may fail. Source: https://github.com/canonical/snapcraft/issues/5384

Evaluation history

Date Model Scores Action Summary
stealth/space-bunny-alpha
Impact: 45
Quick Win: 29
Complexity: 25
Confidence: 88
Actionability: 85
keep open Remote-build worktree copy still follows symlinks and has no try/except around copytree, so copy failures bubble up as internal errors. Only dangling-symlink skipping (PR #1104) landed.
qwen/qwen3.6-35b-a3b
Impact: 40
Quick Win: 26
Complexity: 20
Confidence: 80
Actionability: 80
close resolved Issue requesting symlinks=True for remote-build work dir and try/except handling. Resolved by PR #1104 which added ignore_dangling_symlinks=True to copytree.
qwen/qwen3.8-27b
Impact: 45
Quick Win: 34
Staleness: 70
Complexity: 25
Confidence: 85
Support Request: 0
keep open Remote builds copy the project dir via copytree without symlinks=True, so symlinks are followed and failures surface as internal errors. Fix still unimplemented in worktree.py; triaged enhancement, still referenced by open snapcraft#5384.
qwen/qwen3.6-35b-a3b
Staleness: 45
Complexity: 30
Confidence: 85
Support Request: 10
keep open Enhancement request to prevent following symlinks during remote-build file copying and add error handling. Triaged, linked to external issue, awaiting implementation.
qwen3.6-35b-a3b-mtp-q6
Staleness: 90
Complexity: 20
Confidence: 85
Support Request: 5
keep open Enhancement to prevent following symlinks during remote-build setup by enabling symlinks=True and adding error handling for file copies. Currently triaged but inactive for over a year.

Update history

No update history recorded yet.

Related work

  • Related To: craft-application#1103 (confidence 90%)

    "Remote build fails on dangling symlinks" was the concrete regression from this request; fixed by PR #1104 (commit 8256b7a2), which added ignore_dangling_symlinks=True and test_worktree_init_dangling_symlinks.

  • Related To: canonical/craft-application#1104 (confidence 85%)

    Merged PR that partially addressed this issue by skipping broken symlinks during work-tree copying (released in 7.1.1); does not set symlinks=True nor wrap copy errors.

Related issues

Issue Project State Summary Similarity
#1103 Remote build fails on dangling symlinks craft-application closed remote-build crashed with shutil.Error on dangling symlinks because worktree copytree used default symlinks=False. Fixed by merged PR #1104 (commit 8256b7a2), which passes ignore_dangling_symlinks=True to copytree; released in 7.1.1.
84%
#1104 fix(remote-build): ignore dangling symlinks craft-application merged Merged PR #1104 (commit 8256b7a2) makes remote-build copy the work tree with ignore_dangling_symlinks=True, fixing #1103. Merge conflicts resolved and changelog entry shipped under 7.1.1.
79%
#1100 fix(remotebuild): allow building projects with dangling symlinks craft-application closed PR #1100 by mr-cal fixed remote builds failing on dangling symlinks, but was closed unmerged in favour of @bepri's PR #1104, which merged the same fix for #1103 in craft-application 7.1.1.
73%