** No longer affects: command-not-found (Ubuntu) -- You received this bug notification because you are a member of Ubuntu Touch seeded packages, which is subscribed to python-apt in Ubuntu. https://bugs.launchpad.net/bugs/2025965
Title: aptsources deb822 Section constructor fails on valid .sources file Status in python-apt package in Ubuntu: New Bug description: When attempting to parse (what I believe is) a perfectly valid deb822-formated `.sources` file, the library's `_deb822.Section` constructor parses my file incorrectly, resulting in an exception being thrown. At a low level, the error is `ValueError: Unable to parse section data` and is thrown in the `_deb822.Section` constructor, located at line 41 of `aptsources/_deb822.py`. The error was caused by the evaluation of `apt_pkg.TagSection(trimmed_section)` on that line with `trimmed_section` being an empty string. At a high level, based on a cursory debug, it seems the parser incorrectly considers the first three lines of my `.sources` file -- which are, in fact, comments -- to be a stanza, and is trying to instantiate an object for them, despite them having no non-ignored content. Notably, -- supporting my conclusion -- this issue disappears entirely if I remove the first blank line in the file (located after those comments and before the first stanza). I am attaching my .sources file for reference. Notes: - FWIW, I don't use this library directly; the code at issue gets invoked by the `command-not-found` package/bash handler. (The warnings therefore show up every time I mistype a command.) In any case, I traced the issue down to this package. - My python3-apt package is version 2.5.3ubuntu1 from lunar/main. - This error began for me upon an upgrade from jammy to lunar. This sources file was unchanged during the upgrade (except for renaming `jammy` to `lunar`, and changing `Enabled` to `no` in the `partner` stanza). To manage notifications about this bug go to: https://bugs.launchpad.net/ubuntu/+source/python-apt/+bug/2025965/+subscriptions -- Mailing list: https://launchpad.net/~touch-packages Post to : touch-packages@lists.launchpad.net Unsubscribe : https://launchpad.net/~touch-packages More help : https://help.launchpad.net/ListHelp