Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.debian.bugs.dist > #1171242 > unrolled thread

Bug#1053712: python3-apt: Please make network errors downloading changelogs visible to caller

Started byJonathan Kamens <jik@kamens.us>
First post2023-10-09 14:10 +0200
Last post2023-10-10 01:10 +0200
Articles 3 — 2 participants

Back to article view | Back to linux.debian.bugs.dist


Contents

  Bug#1053712: python3-apt: Please make network errors downloading changelogs visible to caller Jonathan Kamens <jik@kamens.us> - 2023-10-09 14:10 +0200
    Bug#1053712: python3-apt: Please make network errors downloading changelogs visible to caller Julian Andres Klode <jak@debian.org> - 2023-10-09 15:30 +0200
      Bug#1053712: python3-apt: Please make network errors downloading changelogs visible to caller Jonathan Kamens <jik@kamens.us> - 2023-10-10 01:10 +0200

#1171242 — Bug#1053712: python3-apt: Please make network errors downloading changelogs visible to caller

FromJonathan Kamens <jik@kamens.us>
Date2023-10-09 14:10 +0200
SubjectBug#1053712: python3-apt: Please make network errors downloading changelogs visible to caller
Message-ID<HmXfb-eBQk-3@gated-at.bofh.it>
Package: python3-apt
Version: 2.6.0ubuntu1
Severity: normal

My use case of apt.package.Package.get_changelog needs to know whether
a changelog failed to download because it is not available on the
server vs. it failed because of a connectivity issue with the server.
Right now the function completely masks that information, simply
returning a string in both cases. I can't try to parse the string to
extract the information because it's not always explicit and because
it's internationalized so that's a whole can of worms.

I know you probably can't change the default behavior of the
get_changelog function because too many things depend on it, but two
other options would be to (a) add a lower-level function that just
tries to do the download and lets exceptions bubble up instead of
catching them and turning them into strings, or (b) add a keyword
argument to get_changelog which enables bubbling up exceptions instead
of converting them to strings.

Thank you,

Jonathan Kamens

[toc] | [next] | [standalone]


#1171255

FromJulian Andres Klode <jak@debian.org>
Date2023-10-09 15:30 +0200
Message-ID<HmYuB-eD9x-5@gated-at.bofh.it>
In reply to#1171242
Control: notfound -1 2.6.0ubuntu1
Control: found -1 2.6.0

On Mon, Oct 09, 2023 at 08:03:44AM -0400, Jonathan Kamens wrote:
> Package: python3-apt
> Version: 2.6.0ubuntu1
> Severity: normal
> 
> My use case of apt.package.Package.get_changelog needs to know whether
> a changelog failed to download because it is not available on the
> server vs. it failed because of a connectivity issue with the server.
> Right now the function completely masks that information, simply
> returning a string in both cases. I can't try to parse the string to
> extract the information because it's not always explicit and because
> it's internationalized so that's a whole can of worms.
> 
> I know you probably can't change the default behavior of the
> get_changelog function because too many things depend on it, but two
> other options would be to (a) add a lower-level function that just
> tries to do the download and lets exceptions bubble up instead of
> catching them and turning them into strings, or (b) add a keyword
> argument to get_changelog which enables bubbling up exceptions instead
> of converting them to strings.

I'm afraid that this is not an option. I noticed the code is currently
using Python URL downloading facilities which is a bug, it should be
using apt_pkg.Acquire instead (and really it should use APT's native
changelog support instead of partially badly reimplementing it).

APT's error handling meanwhile does not have error codes or anything
so all you get back is an apt_pkg.Error which is not going to help
you.

This is something I want to address for the APT 3.0 API break in
April so it's possible that we can have this addressed in 9 months
or so, but it's not a priority as people should not be using the
'apt' set of Python modules anyhow, but use apt_pkg directly; and
the fix essentially will be adding apt_pkg.AcquireChangelog class
and may not involve any changes to apt.package.

There is a limited set of utility functions that we should make
available on top of apt_pkg, and then we really need to raise
DeprecationWarning.

People write so many broken incredibly slow code by using the
apt modules that it is not funny. The API is utterly misleading
and destructive.

-- 
debian developer - deb.li/jak | jak-linux.org - free software dev
ubuntu core developer                              i speak de, en

[toc] | [prev] | [next] | [standalone]


#1171300

FromJonathan Kamens <jik@kamens.us>
Date2023-10-10 01:10 +0200
Message-ID<Hn7xT-eJYT-5@gated-at.bofh.it>
In reply to#1171255

[Multipart message — attachments visible in raw view] — view raw

Makes sense. Thanks for the response!

On 10/9/23 09:20, Julian Andres Klode wrote:
> Control: notfound -1 2.6.0ubuntu1
> Control: found -1 2.6.0
>
> On Mon, Oct 09, 2023 at 08:03:44AM -0400, Jonathan Kamens wrote:
>> Package: python3-apt
>> Version: 2.6.0ubuntu1
>> Severity: normal
>>
>> My use case of apt.package.Package.get_changelog needs to know whether
>> a changelog failed to download because it is not available on the
>> server vs. it failed because of a connectivity issue with the server.
>> Right now the function completely masks that information, simply
>> returning a string in both cases. I can't try to parse the string to
>> extract the information because it's not always explicit and because
>> it's internationalized so that's a whole can of worms.
>>
>> I know you probably can't change the default behavior of the
>> get_changelog function because too many things depend on it, but two
>> other options would be to (a) add a lower-level function that just
>> tries to do the download and lets exceptions bubble up instead of
>> catching them and turning them into strings, or (b) add a keyword
>> argument to get_changelog which enables bubbling up exceptions instead
>> of converting them to strings.
> I'm afraid that this is not an option. I noticed the code is currently
> using Python URL downloading facilities which is a bug, it should be
> using apt_pkg.Acquire instead (and really it should use APT's native
> changelog support instead of partially badly reimplementing it).
>
> APT's error handling meanwhile does not have error codes or anything
> so all you get back is an apt_pkg.Error which is not going to help
> you.
>
> This is something I want to address for the APT 3.0 API break in
> April so it's possible that we can have this addressed in 9 months
> or so, but it's not a priority as people should not be using the
> 'apt' set of Python modules anyhow, but use apt_pkg directly; and
> the fix essentially will be adding apt_pkg.AcquireChangelog class
> and may not involve any changes to apt.package.
>
> There is a limited set of utility functions that we should make
> available on top of apt_pkg, and then we really need to raise
> DeprecationWarning.
>
> People write so many broken incredibly slow code by using the
> apt modules that it is not funny. The API is utterly misleading
> and destructive.
>

[toc] | [prev] | [standalone]


Back to top | Article view | linux.debian.bugs.dist


csiph-web