Skip to content

APT multi-arch package parsing creates empty package names #15

Description

@bluet

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

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions