Public bug reported:

When a PPA entry is added to Unattended-Upgrade::Allowed-Origins in
/etc/apt/apt.conf.d/50unattended-upgrades, apt's config system initializes
the list with a leading empty "" entry before appending the configured values.

The get_allowed_origins_legacy() function at line 772 of 
/usr/bin/unattended-upgrade
iterates over all values including this empty string, and calling "".split()
returns an empty list, causing the tuple unpack to fail:

    (distro_id, distro_codename) = s.split()
    ValueError: not enough values to unpack (expected 2, got 1)

Fix: add a guard to skip empty entries:

    for s in apt_pkg.config.value_list(key):
        if not s.strip():
            continue

Triggered by adding "LP-PPA-mozillateam:noble" to Allowed-Origins.
The empty string only appears when the list has been modified from its
default state.

Steps to reproduce:
1. Add any extra entry to Unattended-Upgrade::Allowed-Origins in
   /etc/apt/apt.conf.d/50unattended-upgrades, for example:
   "LP-PPA-mozillateam:noble";
2. Run: sudo unattended-upgrade --dry-run --verbose
3. Observe crash with ValueError: not enough values to unpack

Workaround applied locally:
Added "if not s.strip(): continue" guard at line 772 in
/usr/bin/unattended-upgrade inside the get_allowed_origins_legacy() loop.

** Affects: unattended-upgrades (Ubuntu)
     Importance: Undecided
         Status: New

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

Title:
  ValueError: not enough values to unpack when Allowed-Origins contains
  empty string from apt config initialization

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/unattended-upgrades/+bug/2144439/+subscriptions


-- 
ubuntu-bugs mailing list
[email protected]
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to