[Bug 2025965] [NEW] aptsources deb822 Section constructor fails on valid .sources file
Mike Vastola
2025965 at bugs.launchpad.net
Wed Jul 5 06:17:16 UTC 2023
Public bug reported:
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).
** Affects: command-not-found (Ubuntu)
Importance: Undecided
Status: New
** Affects: python-apt (Ubuntu)
Importance: Undecided
Status: New
** Attachment added: "The .sources file causing this error."
https://bugs.launchpad.net/bugs/2025965/+attachment/5683960/+files/00ubuntu.sources
--
You received this bug notification because you are a member of Ubuntu
Foundations Bugs, 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 command-not-found package in Ubuntu:
New
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/command-not-found/+bug/2025965/+subscriptions
More information about the foundations-bugs
mailing list