APT multi-arch package parsing creates empty package names

Open
#15 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
55/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Stale
Tech stack
go, linux

Research direction

Read manager/apt/utils.go to trace ParseFindOutput and ParseDpkgQueryOutput, then inspect the related cases in manager/apt/utils_test.go. Run the APT parser tests first and add coverage for packages installed under multiple architectures. Done means both architecture-specific packages retain distinct names and no empty package entry is produced.

Written by the indexing model from the issue text.

Description

Summary

APT search results occasionally show entries with empty package names (e.g., : [version][] (installed)) when multi-architecture packages are installed.

Root Cause Analysis

The issue occurs when dpkg returns multiple architectures for the same package (e.g., libcurl4:amd64 and libcurl4:i386), but our search parsing only finds one entry.

Technical Details
  1. APT search finds: libcurl4/jammy-updates,jammy-security,now 7.81.0-1ubuntu1.20 amd64 [installed]
  2. Parsed as: {Name: "libcurl4", Arch: "amd64"}
  3. dpkg-query returns TWO packages: libcurl4:amd64 AND libcurl4:i386
  4. First processing: Finds libcurl4 in map, processes correctly, deletes from map
  5. Second processing: Can't find libcurl4 in map (already deleted), creates empty PackageInfo
Current Impact
  • Frequency: <0.1% of packages affected
  • Severity: Cosmetic only - no functional impact
  • Example Output: : [7.81.0-1ubuntu1.20][] (installed)

Proposed Solution

Implement proper multi-arch support by using name:arch as the key throughout the parsing pipeline:

Changes Required
  1. ParseFindOutput: Use name:arch as dictionary key instead of just name
  2. ParseDpkgQueryOutput: Parse architecture from dpkg output and use matching key
  3. Display: Show multi-arch packages as package:arch (e.g., libcurl4:amd64)
Benefits
  • ✅ Eliminates cosmetic parsing bug
  • ✅ Provides accurate multi-arch representation
  • ✅ Matches APT's actual behavior
  • ✅ Useful for debugging multi-arch dependency issues

Implementation Notes

  • Scope: APT-specific (other package managers already handle this correctly)
  • Breaking Changes: None - just improved accuracy
  • Files: manager/apt/utils.go, manager/apt/utils_test.go
  • Complexity: Low - ~20 lines of changes

Test Cases

# Before fix
apt: libcurl4 [version][version] (installed)
:  [version][] (installed)  # ← Bug

# After fix  
apt: libcurl4:amd64 [version][version] (installed)
apt: libcurl4:i386 [version][version] (installed)

Priority

Low - This is a cosmetic issue that doesn't affect core functionality. The system works correctly for 99.9%+ of packages.

Labels

  • enhancement
  • apt
  • parsing
  • multi-arch
Dominant language
Go
Stars
17
Forks
8
PR merge metrics
No merged PRs in 30d

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from bluet/syspkg

All issues in bluet/syspkg

Similar issues

More Go issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.