← Back to issue list

pluginhandler: do not walk symlinks for include filesets

View original Github issue

Metadata

Project
snapcraft
Number
#3406
Type
pull request
State
merged
Author
cjp256
Labels
Created
Updated
Closed

Current evaluation

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.

Suggested action:

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
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.
qwen3.6-35b-a3b-mtp-q6 Merged into master. Snapcraft now skips symlink traversal when generating include filesets, fixing a bug where symlinked directories caused unintended file inclusion and filtering failures. Approved by maintainers and passed full code coverage.

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 fix for symlink directory path handling in filesets, resolving usr-merge issues. Added regression tests, corrected faulty tests, and retained the follow_symlinks flag per reviewer request. Approved and passed CI.
79%
#1064 pluginhandler: collide with directories and symlinks snapcraft merged Merged to extend Snapcraft's collision detection to directories and symlinks, resolving bug LP: #1658225. The pull request was updated and re-opened to address dependencies and test failures before final approval and merge.
78%
#3317 plugin handler: properly handle snapcraftctl errors snapcraft merged Merged fix for plugin handler to properly catch snapcraftctl errors. Replaced specific exception handling with a broad catch in the scriptlet runner to prevent silent failures and redundant output. Approved, passed CI, and increased coverage.
73%
#1231 pluginhandler: exclude `/snap/` from libraries. snapcraft merged Merged. Excludes /snap/ paths from library collection during classic confinement builds, preventing unintended inclusion of snap libraries. Approved, passed CI, and resolves LP: #1670100.
71%
#2251 pluginhandler: stop using alias for snapcraftctl snapcraft merged Merged. Replaced snapcraftctl alias usage with direct PATH installation in the pluginhandler. This prepares the codebase for subshell scriptlet execution, where aliases fail. Approved by reviewers and passed all CI checks.
70%