← Back to issue list

Stage package filtering doesn't deal with foreign arch packages (e.g. i386 on amd64)

View original Github issue

Metadata

Project
snapcraft
Number
#5997
Type
issue
State
open
Author
Saviq
Labels
Type: Bug
Created
2026-01-30 09:29:14+00:00
Updated
2026-01-30 16:08:19+00:00
Closed

Current evaluation

No evaluation has been recorded for this issue yet.

Issue body

### Check existing issues - [x] I've verified that this bug isn't described by any existing issues. ### Bug description The code filtering stage packages only matches packages by name, ignoring architecture: https://github.com/canonical/craft-parts/blob/c5bf8edf35b0739081cd354c1c695496f5a4be2b/craft_parts/packages/deb.py#L316-L332 This results in duplicate content in downstream snaps if foreign architecture packages are included. This was originally filed in https://bugs.launchpad.net/snapcraft/+bug/2076115, though not understood enough. ### Steps to reproduce `snapcraft pack` the YAML below and inspect the contents, you'll see not only `liblzma5`, but also all of `libc6` in the resulting snap: ``` $ tree squashfs-root squashfs-root ├── etc │   └── ld.so.conf.d │   └── i386-linux-gnu.conf ├── meta │   ├── gui │   └── snap.yaml └── usr ├── bin │   ├── lzmainfo │   ├── unxz -> xz │   ├── xz │   ├── xzcat -> xz │   ├── xzcmp -> xzdiff │   ├── xzdiff │   ├── xzegrep -> xzgrep │   ├── xzfgrep -> xzgrep │   ├── xzgrep │   ├── xzless │   └── xzmore ├── lib │   ├── i386-linux-gnu │   │   ├── gconv │   │   │   ├── ANSI_X3.110.so # ... │   │   │   └── VISCII.so │   │   ├── ld-linux.so.2 │   │   ├── libanl.so.1 │   │   ├── libBrokenLocale.so.1 │   │   ├── libc_malloc_debug.so.0 │   │   ├── libc.so.6 │   │   ├── libdl.so.2 │   │   ├── libgcc_s.so.1 │   │   ├── liblzma.so.5 -> liblzma.so.5.4.5 │   │   ├── liblzma.so.5.4.5 │   │   ├── libmemusage.so │   │   ├── libm.so.6 │   │   ├── libnsl.so.1 │   │   ├── libnss_compat.so.2 │   │   ├── libnss_dns.so.2 │   │   ├── libnss_files.so.2 │   │   ├── libnss_hesiod.so.2 │   │   ├── libpcprofile.so │   │   ├── libpthread.so.0 │   │   ├── libresolv.so.2 │   │   ├── librt.so.1 │   │   ├── libthread_db.so.1 │   │   └── libutil.so.1 │   └── ld-linux.so.2 -> i386-linux-gnu/ld-linux.so.2 # ... ``` Most of that is also available in the `core24` snap, and shouldn't be staged. ### Environment Ubuntu 25.10 Snapcraft 8.13.2 ### snapcraft.yaml ```yaml name: base-cleanup base: core24 version: '0.1' summary: Cleanup verifier description: Cleanup verifier grade: devel confinement: devmode package-repositories: - type: apt url: http://archive.ubuntu.com/ubuntu suites: [noble] components: [main] architectures: [i386] key-id: F6ECB3762474EDA9D21B7022871920D1991BC93C key-server: keyserver.ubuntu.com parts: my-part: plugin: nil stage-packages: - xz-utils:i386 ``` ### Log output ```shell ```

Evaluation history

No evaluation history available.