Snapcraft doesn't report no-op file filtering usage
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 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
Thank you for reporting us your feedback!
The internal ticket has been created: https://warthogs.atlassian.net/browse/CRAFT-3130.
This message was autogenerated
Thanks for reporting!
This is probably an issue upstream in craft-parts.