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
- APT search finds:
libcurl4/jammy-updates,jammy-security,now 7.81.0-1ubuntu1.20 amd64 [installed]
- Parsed as:
{Name: "libcurl4", Arch: "amd64"}
- dpkg-query returns TWO packages:
libcurl4:amd64 AND libcurl4:i386
- First processing: Finds
libcurl4 in map, processes correctly, deletes from map
- 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
- ParseFindOutput: Use
name:arch as dictionary key instead of just name
- ParseDpkgQueryOutput: Parse architecture from dpkg output and use matching key
- 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
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:amd64andlibcurl4:i386), but our search parsing only finds one entry.Technical Details
libcurl4/jammy-updates,jammy-security,now 7.81.0-1ubuntu1.20 amd64 [installed]{Name: "libcurl4", Arch: "amd64"}libcurl4:amd64ANDlibcurl4:i386libcurl4in map, processes correctly, deletes from maplibcurl4in map (already deleted), creates empty PackageInfoCurrent Impact
: [7.81.0-1ubuntu1.20][] (installed)Proposed Solution
Implement proper multi-arch support by using
name:archas the key throughout the parsing pipeline:Changes Required
name:archas dictionary key instead of justnamepackage:arch(e.g.,libcurl4:amd64)Benefits
Implementation Notes
manager/apt/utils.go,manager/apt/utils_test.goTest Cases
Priority
Low - This is a cosmetic issue that doesn't affect core functionality. The system works correctly for 99.9%+ of packages.
Labels
enhancementaptparsingmulti-arch