aptsources deb822 Section constructor fails on valid .sources file
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
python-apt (Ubuntu) |
New
|
Undecided
|
Unassigned |
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/
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).
no longer affects: | command-not-found (Ubuntu) |
Also, if it helps, here's a minimal example python file, triggering the error (requires attached `00ubuntu.sources` to be in cwd)