Made small edits to the test case, given that `nala` is not available on
all releases we test on, and we actually want the binary to be different
rather than an alias to reproduce the bug.

After those tweaks, I was able to reproduce the bug when running from
the archive, and to verify that the proposed package fixes this for all
relases we support.

I am marking verification-done for all releases.

** Description changed:

  [ Impact ]
  
  If `apt` is masked by other helper tools, such as `nala`, as seen in the
  original description, `apt list --installed` will return data in a
  different format. This will cause the Pro Client to fail to parse the
  data, and break.
  
  The Pro Client should not be relying on CLI output when there are Python
  bindings available to perform the same task - and python3-apt provides
  ways to list installed packages.
  
  The fix to this bug is to rely on the programmatic integration with APT
  instead of calling the CLI.
  
- 
  [ Test Plan ]
  
  Listing installed packages is part of the regular operation of the Pro
  Client in many scenarios covered by the integration / acceptance tests.
  
  For this particular issue:
  - Launch a container for the release to be tested
  - install nala
- - alias `apt` to `nala` in the system
+ - alias `apt` to `nala` in the system (or better, link the nala binary to 
/usr/bin/apt)
  - see it fail
  - install the package from -proposed
  - see it does not fail anymore
- 
  
  [ Where problems could occur ]
  
  Switching from the CLI call to python3-apt brings the risk of wrong
  implementation of the integration, which would lead to a different
  package list to be returned by python3-apt. The regression potential is
  mitigated by extensive testing - unit, integration and acceptance tests
  rely on this functionality.
- 
  
  [ Original description ]
  
  This is in 22.04
  
  ❯ ua status
  An unexpected error occurred: list index out of range
  For more details, see the log: /home/marco/.cache/ubuntu-pro/ubuntu-pro.log
  If you think this is a bug, please run: ubuntu-bug ubuntu-advantage-tools
  
  ProblemType: Bug
  DistroRelease: Ubuntu 22.04
  Package: ubuntu-advantage-tools 31.2.3~22.04
  ProcVersionSignature: Ubuntu 6.8.0-35.35-generic 6.8.4
  Uname: Linux 6.8.0-35-generic x86_64
  ApportVersion: 2.20.11-0ubuntu82.5
  Architecture: amd64
  CasperMD5CheckResult: unknown
  CurrentDesktop: ubuntu:GNOME
  Date: Fri Jun  7 17:42:12 2024
  InstallationDate: Installed on 2010-07-10 (5081 days ago)
  InstallationMedia: Ubuntu 10.04 LTS "Lucid Lynx" - Release amd64 (20100429)
  PackageArchitecture: all
  RebootRequiredPkgs: Error: path contained symlinks.
  SourcePackage: ubuntu-advantage-tools
  UpgradeStatus: Upgraded to jammy on 2020-06-14 (1453 days ago)
  cloud-id.txt-error: Invalid command specified 'cloud-id'.
  jobs-status.json: {"metering": {"last_run": 
"2024-06-07T15:40:15.416242+00:00", "next_run": 
"2024-06-07T19:40:15.416242+00:00"}, "update_contract_info": null, 
"update_messaging": {"last_run": "2024-06-07T15:40:15.416242+00:00", 
"next_run": "2024-06-07T21:40:15.416242+00:00"}}
  uaclient.conf:
   contract_url: https://contracts.canonical.com
   log_level: debug

** Description changed:

  [ Impact ]
  
  If `apt` is masked by other helper tools, such as `nala`, as seen in the
  original description, `apt list --installed` will return data in a
  different format. This will cause the Pro Client to fail to parse the
  data, and break.
  
  The Pro Client should not be relying on CLI output when there are Python
  bindings available to perform the same task - and python3-apt provides
  ways to list installed packages.
  
  The fix to this bug is to rely on the programmatic integration with APT
  instead of calling the CLI.
  
  [ Test Plan ]
  
  Listing installed packages is part of the regular operation of the Pro
  Client in many scenarios covered by the integration / acceptance tests.
  
  For this particular issue:
  - Launch a container for the release to be tested
  - install nala
  - alias `apt` to `nala` in the system (or better, link the nala binary to 
/usr/bin/apt)
+ - alternatively, where `nala` is not available, backup /usr/bin/apt and make 
it a script that exits 1
  - see it fail
- - install the package from -proposed
+ - install the package from -proposed (use the backed up apt binary if needed)
  - see it does not fail anymore
  
  [ Where problems could occur ]
  
  Switching from the CLI call to python3-apt brings the risk of wrong
  implementation of the integration, which would lead to a different
  package list to be returned by python3-apt. The regression potential is
  mitigated by extensive testing - unit, integration and acceptance tests
  rely on this functionality.
  
  [ Original description ]
  
  This is in 22.04
  
  ❯ ua status
  An unexpected error occurred: list index out of range
  For more details, see the log: /home/marco/.cache/ubuntu-pro/ubuntu-pro.log
  If you think this is a bug, please run: ubuntu-bug ubuntu-advantage-tools
  
  ProblemType: Bug
  DistroRelease: Ubuntu 22.04
  Package: ubuntu-advantage-tools 31.2.3~22.04
  ProcVersionSignature: Ubuntu 6.8.0-35.35-generic 6.8.4
  Uname: Linux 6.8.0-35-generic x86_64
  ApportVersion: 2.20.11-0ubuntu82.5
  Architecture: amd64
  CasperMD5CheckResult: unknown
  CurrentDesktop: ubuntu:GNOME
  Date: Fri Jun  7 17:42:12 2024
  InstallationDate: Installed on 2010-07-10 (5081 days ago)
  InstallationMedia: Ubuntu 10.04 LTS "Lucid Lynx" - Release amd64 (20100429)
  PackageArchitecture: all
  RebootRequiredPkgs: Error: path contained symlinks.
  SourcePackage: ubuntu-advantage-tools
  UpgradeStatus: Upgraded to jammy on 2020-06-14 (1453 days ago)
  cloud-id.txt-error: Invalid command specified 'cloud-id'.
  jobs-status.json: {"metering": {"last_run": 
"2024-06-07T15:40:15.416242+00:00", "next_run": 
"2024-06-07T19:40:15.416242+00:00"}, "update_contract_info": null, 
"update_messaging": {"last_run": "2024-06-07T15:40:15.416242+00:00", 
"next_run": "2024-06-07T21:40:15.416242+00:00"}}
  uaclient.conf:
   contract_url: https://contracts.canonical.com
   log_level: debug

** Tags removed: verification-needed verification-needed-bionic 
verification-needed-focal verification-needed-jammy verification-needed-noble 
verification-needed-xenial
** Tags added: verification-done verification-done-bionic 
verification-done-focal verification-done-jammy verification-done-noble 
verification-done-xenial

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/2068744

Title:
  Launching ua status → An unexpected error occurred: list index out of
  range

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/ubuntu-advantage-tools/+bug/2068744/+subscriptions


-- 
ubuntu-bugs mailing list
ubuntu-bugs@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to