New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
aptcc: Only report errors if there are errors #321
aptcc: Only report errors if there are errors #321
Conversation
LGTM +1 |
Comment copied from #295 for visibility:
|
How would your string matching work if the string is localized? |
It looks like the "C" locale is forced so localization shouldn't be an issue. However, there doesn't appear to be a way of getting constants from the backend that would allow cleaner checking for errors. I'm simply trying to fix an issue that causes PackageKit to go into an infinite loop and there is already code in that file that checks strings. If this can be improved in some way, I'm happy to do so, but this PR that now obsoletes my PR doesn't solve the issue I was originally trying to fix. |
I think we probably should not report PK_ERROR_ENUM_GPG_FAILURE at all, just some generic download failure, since we don't know it's a GPG error. |
I should add error categories to apt, and the ability to differentiate between different kinds of non-error error items (warnings vs notices). |
And did that - we now always emit PK_ERROR_ENUM_CANNOT_FETCH_SOURCES |
I disagree about ignoring "does not have a Release file" - that's a very important error, and should be shown as such. Even the other 404 errors should not be filtered out, that's non-sense. If a repository does not work like that, the user needs to know. |
FWIW, PK_ERROR_ENUM_GPG_FAILURE behavior is fundamentally wrong in my perspective. Retrying without verification opens up attack vectors everywhere, such as decompressors and stuff. If users want to configure untrusted repositories, they can allow them in their sources.list files, but circumventing essential security functions like that is a bad idea. |
Not sure what not failing the
It's always possible that updates fail with an error, but this should not prevent any calculations of new updates or prevent installs or something. The error should be shown, but if any of the repos was successfully updated, it should be considered successful otherwise. |
@julian-klode friendly ping? |
7329870
to
d470b16
Compare
Rebased |
If it's good enough for @dantti then it's good enough for me :) |
hmm actually it seems errorCount should be initialized. |
Previously aptcc would report some warnings as errors. This way, it will drop any warning if there is no error. This matches the behavior of python-apt. As a bonus, we also log the entire message as a warning to the journal.
This prevents an apparently infinite loop due to automatic retrying. We cannot be sure whether we had a GPG error and/or other errors, so raising an error that causes automatic retrying is a bad idea. This will cause PK_ERROR_ENUM_CANNOT_FETCH_SOURCES to be emitted by the caller of the function.
d470b16
to
9a2eab8
Compare
@dantti Fixed (and rebased again) |
Previously aptcc would report some warnings as errors. This way,
it will drop any warning if there is no error. This matches the
behavior of python-apt.
As a bonus, we also log the entire message as a warning to the
journal.
This obsoletes #295