← Back to issue list

Snapcraft doesn't report no-op file filtering usage

View original Github issue

Metadata

Project
snapcraft
Number
#4853
Type
issue
State
open
Author
dilyn-corner
Labels
Created
Updated
Closed

Current evaluation

Snapcraft does not warn when a stage/prime file filter (e.g. -foo) matches no files, risking unintended file inclusion. Maintainer acknowledged and redirected to craft-parts upstream; no fix implemented as of last check.

Suggested action: keep open

Reason: Maintainer lengau acknowledged the report on 2024-07-16 and noted it is likely an upstream craft-parts issue, constituting triage. No warning for no-op file filters exists in craft-parts' filesets.py as of the latest commit, so the issue remains valid and not outdated despite ~18 months of inactivity.

Impact: 40 Quick Win: 24.0 Staleness: 70 Complexity: 40 Confidence: 75 Support Request: 10

Issue body

### Bug Description In cases where a `snapcraft.yaml` author puts a: ``` stage: - -foo ``` for some part which *never* provides `foo`, snapcraft will never offer a warning that the directive to exclude `foo` is extraneous (or even outright incorrect). This could lead to someone erroneously including some library which they intend to never distribute, but still do. ### To Reproduce Clone the [avahi](https://github.com/kubiko/avahi/tree/master) snap repository and build on commit 1a8c89bb9b0e8c6a375997118f649202f2be13af using `snapcraft` (8.x any release -- I imagine this also applies to 7.x and even earlier but I have not tested yet). Find that `libnss_mdns*` still exists in the final snap (and the several linter warnings associated), and note that snapcraft never warns that in fact the `avahi` part does not provide this library, but instead the `glue` part does. ### Environment Ubuntu 23.10+, building in LXD managed by snapcraft, using at least snapcraft 8.2.10.post50+gita9badaa3 (but probably every earlier version since 6.x) ### snapcraft.yaml Specifically, https://github.com/kubiko/avahi/blob/1a8c89bb9b0e8c6a375997118f649202f2be13af/snap/snapcraft.yaml ### Relevant log output There actually isn't any relevant log output, though I will say: it would be useful if snapcraft could show the list of files being moved from `parts/foo/install/` to `stage/` and from `stage/` to `prime/` to make triaging this behaviour easier if emitting a warning is not feasible. ### Additional context _No response_

Evaluation history

Date Model Scores Action Summary
qwen/qwen3.8-27b
Impact: 40
Quick Win: 24.0
Staleness: 70
Complexity: 40
Confidence: 75
Support Request: 10
keep open Snapcraft does not warn when a stage/prime file filter (e.g. -foo) matches no files, risking unintended file inclusion. Maintainer acknowledged and redirected to craft-parts upstream; no fix implemented as of last check.
qwen/qwen3.6-35b-a3b
Staleness: 85
Complexity: 65
Confidence: 85
Support Request: 10
keep open Snapcraft silently ignores stage exclusion filters for files never provided by a part, causing confusion. Acknowledged by a maintainer as likely a craft-parts upstream issue, but inactive for over a year.
qwen3.6-35b-a3b-mtp-q6
Staleness: 85
Complexity: 50
Confidence: 80
Support Request: 10
needs triage Snapcraft silently ignores stage/pull file exclusions when the excluded file isn't provided by the part. Open, acknowledged by a maintainer who noted it likely belongs upstream in craft-parts, but remains unlabelled and inactive for over a year.
qwen3.6-35b-a3b-mtp-q6
Staleness: 85
Complexity: 40
Confidence: 75
Support Request: 10
close stale Snapcraft silently ignores stage and prune filters targeting non-existent files, risking unintended inclusions. Maintainers suspect the bug originates upstream in craft-parts. Report remains open with a Jira ticket created for tracking.

Update history

No update history recorded yet.

Related issues

Issue Project State Summary Similarity
#4835 File filtering handled incorrectly snapcraft open Snapcraft stage filter excludes a file, but priming its parent directory fails with CopyFileNotFound because prime lists files from the install dir. Triaged bug, blocked on craft-parts#766 design work; last maintainer update ~14 months ago.
76%
#1897337 snapcraft build <part> ignores the part snapcraft (launchpad) closed The snapcraft build command ignoring specified parts was closed without a fix or resolution. No comments or patches were provided, indicating the report was abandoned without addressing the filtering behavior.
71%