pluginhandler: do not walk symlinks for include filesets
Metadata
Current evaluation
Merged #3406 as commit 63c2c7a7f, adding a symlink check before include-fileset traversal so external links no longer bypass filtering of target directories.
Resolution: closed resolved
Reason: PR #3406 was merged into master as commit 63c2c7a7f. It prevents traversal through symlinks when building include filesets, so links such as bin -> usr/bin cannot preserve otherwise filtered target files.
Evaluated by: mr-cal-bot
No scores available.
Issue body
When generating the include file set, snapcraft will walk through
symlinks. This effectively results in being unable to filter out
anything that itself, or parent is pointed to by an external symlink.
e.g. bin -> usr/bin will prevent filtering anything under usr/bin.
This is because snapcraft will include 'bin/foo' even though 'bin'
is a symlink. Subsequently, it will then preserve 'usr/bin/foo'.
Avoid this by simply checking if target is a link before walking
it.
Signed-off-by: Chris Patterson <chris.patterson@canonical.com>
- [ ] Have you followed the [guidelines for contributing](https://github.com/snapcore/snapcraft/blob/master/CONTRIBUTING.md)?
- [ ] Have you signed the [CLA](http://www.ubuntu.com/legal/contributors/)?
- [ ] Have you successfully run `./runtests.sh static`?
- [ ] Have you successfully run `./runtests.sh tests/unit`?
-----
Evaluation history
| Date | Model | Scores | Action | Summary |
|---|---|---|---|---|
| stealth/space-bunny-alpha | — | closed resolved | Merged #3406 as commit 63c2c7a7f, adding a symlink check before include-fileset traversal so external links no longer bypass filtering of target directories. | |
| stealth/space-bunny-alpha | — | closed resolved | Merged #3406 in commit 63c2c7a7f, adding a symlink guard before include-fileset traversal so external links no longer bypass filtering of target directories. | |
| stealth/space-bunny-alpha | — | closed resolved | Merged #3406 (63c2c7a7f), adding a symlink check before include-fileset traversal so external links no longer bypass filtering of their target directories. | |
| qwen/qwen3.6-35b-a3b | — | — | Merged fix prevents snapcraft from incorrectly traversing symlinks during include fileset generation. Checks targets before walking to resolve filtering issues for symlinked directories. Approved, passed CI, and merged. | |
| qwen3.6-35b-a3b-mtp-q6 | — | — | Merged fix preventing snapcraft from traversing symlinks during include fileset generation. Resolves filtering issues for symlinked directories. Approved and merged into master after passing tests and coverage checks. |
Update history
No update history recorded yet.
Related issues
| Issue | Project | State | Summary | Similarity |
|---|---|---|---|---|
| #2628 pluginhandler: honour symlink directory paths for filesets (LP: #1833408) | snapcraft | merged | Merged as 3f5799a72, making filesets honor symlink directory paths and fixing LP #1833408; regression tests were added and faulty tests corrected. | |
| #1064 pluginhandler: collide with directories and symlinks | snapcraft | merged | Merged #1064 via commit d4b104887, adding directories and symlinks to pluginhandler collision detection, including conflicting symlink targets; fixes LP #1658225. |