← 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
Updated
Closed

Current evaluation

Stage package filtering in craft-parts deb.py matches by name only, ignoring architecture, so foreign-arch packages (e.g. i386 on amd64) pull in duplicate content like all of libc6. Confirmed still present on core26; maintainer says it is a design-first task needing craft-team coordination.

Suggested action: keep open

Reason: Maintainer @mr-cal (2026-07-02) explicitly acknowledged this as a valid bug requiring a design-first approach by a craft team member, and @Saviq confirmed the behaviour still reproduces on core26. The underlying code (_get_filtered_stage_package_names in craft-parts deb.py) still performs name-only matching, so the bug is unfixed. It is triaged, scoped, and awaiting architectural design, so it should remain open.

Impact: 45 Quick Win: 13.5 Staleness: 40 Complexity: 70 Confidence: 80 Support Request: 5

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

Date Model Scores Action Summary
qwen/qwen3.8-27b
Impact: 45
Quick Win: 13.5
Staleness: 40
Complexity: 70
Confidence: 80
Support Request: 5
keep open Stage package filtering in craft-parts deb.py matches by name only, ignoring architecture, so foreign-arch packages (e.g. i386 on amd64) pull in duplicate content like all of libc6. Confirmed still present on core26; maintainer says it is a design-first task needing craft-team coordination.
qwen/qwen3.6-35b-a3b
Staleness: 15
Complexity: 75
Confidence: 85
Support Request: 5
keep open Stage package filtering ignores architecture, causing duplicate foreign arch content in snaps. Maintainers acknowledge it as a valid bug but note it requires architectural design and backward compatibility considerations before implementation.
qwen3.6-35b-a3b-mtp-q6
Staleness: 20
Complexity: 75
Confidence: 85
Support Request: 5
keep open Stage package filtering ignores architecture, causing duplicate foreign arch packages in snaps. Maintainers have acknowledged the bug but note it requires architectural design and team coordination before implementation.
qwen3.6-35b-a3b-mtp-q6
Staleness: 45
Complexity: 40
Confidence: 85
Support Request: 5
needs triage Stage package filtering ignores architecture, causing duplicate foreign arch packages in snaps. Impacts content snaps and desktop extensions. Open with two comments exploring dpkg-based deduplication. Requires triage and code fix.

Update history

No update history recorded yet.

Related work

  • Related To: snapcraft#5998 (confidence 75%)

    Both issues stem from architecture information being dropped in craft-parts deb.py; #5998 is about manifest.yaml losing arch qualifiers (fixed by craft-parts PR #1558), while #5997 is about the stage-package filter ignoring arch.

Related issues

Issue Project State Summary Similarity
#2012503 wrong arch of stage packages snapcraft (launchpad) open Snapcraft 7.3 picks host architecture for stage packages when cross-building (build-on amd64, build-for arm64). No maintainer response in 3.4 years. Nearly identical issue #5335 was closed as expected behavior requiring explicit :$CRAFT_ARCH_BUILD_FOR suffix on stage packages.
71%