← Back to issue list

snapcraft indiscriminately removes *.snap files

View original Github issue

Metadata

Project
snapcraft
Number
#4880
Type
issue
State
closed
Author
dilyn-corner
Labels
—
Created
Updated
Closed

Current evaluation

Closed as an upstream snap pack issue, not a Snapcraft bug; the omission was reproduced with `snap pack` alone and the reporter was redirected to snapd.

Resolution: closed not a bug

Reason: Maintainer @mr-cal reproduced the missing file using `snap pack` without Snapcraft. The issue was closed after the reporter agreed to report the upstream behavior to snapd; no Snapcraft fix was identified.

Evaluated by: mr-cal-bot

No scores available.

Issue body

### Bug Description After performing a build, snapcraft will prune any files with a `.snap` extension regardless of what the file actually is, and not provide any warning that such a pruning is happening. ### To Reproduce Using the provided `snapcraft.yaml`, build with `snapcraft --use-lxd --verbose` ### Environment Ubuntu 23.10 with snapcraft 8.x with `--use-lxd` ### snapcraft.yaml ```shell name: my-snap-name # you probably want to 'snapcraft register <name>' base: core24 # the base snap is the execution environment for this snap version: '0.1' # just for humans, typically '1.2+git' or '1.3.2' summary: Single-line elevator pitch for your amazing snap # 79 char long summary description: | This is my-snap's description. You have a paragraph or two to tell the most important story about your snap. Keep it under 100 words though, we live in tweetspace and your description wants to look good in the snap store. grade: devel # must be 'stable' to release into candidate/stable channels confinement: devmode # use 'strict' once you have the right plugs and slots parts: my-part: # See 'snapcraft plugins' plugin: nil override-build: | touch foo install -Dm 644 "${CRAFT_PART_BUILD}/foo" "${CRAFT_PART_INSTALL}/foo.snap" ``` ### Relevant log output ```shell dilyn@Ares:~/test -> snapcraft --verbose Starting snapcraft, version 8.2.11.post61+git14dbf54c Logging execution to '/home/dilyn/.local/state/snapcraft/log/snapcraft-20240625-003754.386495.log' Starting snapcraft, version 8.2.11.post61+git14dbf54c Logging execution to '/home/dilyn/.local/state/snapcraft/log/snapcraft-20240625-003754.386495.log' Launching managed ubuntu 24.04 instance... Creating instance from base instance Starting instance Starting snapcraft, version 8.2.11.post61+git14dbf54c Logging execution to '/tmp/snapcraft.log' Starting snapcraft, version 8.2.11.post61+git14dbf54c Logging execution to '/tmp/snapcraft.log' Initialising lifecycle Installing build-packages Installing build-snaps Pulling my-part Building my-part :: + touch foo :: + install -Dm 644 /root/parts/my-part/build/foo /root/parts/my-part/install/foo.snap Staging my-part Priming my-part Packing... Reading snap metadata... Running linters... Running linter: classic Running linter: library Creating snap package... Packed my-snap-name_0.1_amd64.snap dilyn@Ares:~/test -> unsquashfs my-snap-name_0.1_amd64.snap Parallel unsquashfs: Using 24 processors 3 inodes (3 blocks) to write [===================================================================================================================================================|] 6/6 100% created 3 files created 4 directories created 0 symlinks created 0 devices created 0 fifos created 0 sockets created 0 hardlinks dilyn@Ares:~/test -> tree squashfs-root/ squashfs-root/ ├── meta │   ├── gui │   └── snap.yaml └── snap ├── manifest.yaml └── snapcraft.yaml 4 directories, 3 files ``` ### Additional context Originally discovered because my convention for licenses is to use `license.foo` as the filename; in this case, I wanted to copy the license of the snap which is named `license.snap`. This removal happens regardless of what level the `license.snap` is at. At the very least I would like a message telling me a file has been removed that I explicitly said to include. An ideal solution is that snapcraft uses a more intelligent way of determining if the file is a snap or not. At least `file foo.snap` (which will return squashfs info if it's at least a snap), if not the better option of `snap info foo.snap` (which returns 1 if it isn't a snap and 0 if it is).

Evaluation history

Date Model Scores Action Summary
stealth/space-bunny-alpha — closed not a bug Closed as an upstream snap pack issue, not a Snapcraft bug; the omission was reproduced with `snap pack` alone and the reporter was redirected to snapd.
stealth/space-bunny-alpha — closed not a bug Closed as an upstream snap pack issue, not a Snapcraft bug: the omission was reproduced with `snap pack` alone, and the reporter was redirected to snapd.
qwen/qwen3.6-35b-a3b — — Closed as a snap pack issue rather than a snapcraft bug. Developers confirmed the stripping occurs upstream, redirecting the fix to snapd.
qwen/qwen3.6-35b-a3b — — Closed. Developers identified the incorrect removal of .snap files as a snap pack bug within snapd, not a snapcraft issue. The report was redirected to the snapd repository for investigation and resolution.
qwen/qwen3.6-35b-a3b — — Closed as a snapd issue. Maintainers traced the bug to snap pack, which incorrectly strips all .snap files. The reporter redirected the issue to the snapd repository for resolution.
qwen3.6-35b-a3b-mtp-q6 — — Closed and redirected to snapd maintainers after developers identified the root cause as a snap pack bug. No fix was applied here.

Update history

No update history recorded yet.

Related issues

Issue Project State Summary Similarity
#4870 snapcraft pack error obtuse on snapd errors snapcraft closed Closed as a duplicate of #4548, which was tracked by #4499; hidden snapd pack diagnostics were fixed by merged PR #5188 (a9fc44093).
74%
#4923 Increase verbosity of `snapcraft`'s missing files error snapcraft closed Closed as a duplicate of #4499; suppressed `snap pack` errors were fixed by merged PR #5188 (commit a9fc44093), which surfaced snapd's stderr.
72%
#1567054 Snapcraft clean doesn't remove pkg-config override snapcraft (launchpad) closed Closed as unreproducible: the maintainer could not reproduce the reported `snapcraft clean` or `snapcraft clean <part-name>` behavior.
71%