-
-
Notifications
You must be signed in to change notification settings - Fork 92
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
Fix: variable become undefined when extension not exist or connection… #868
base: master
Are you sure you want to change the base?
Conversation
a30786b
to
690f798
Compare
@tsteven4 could you please check the change? |
dd721f5
to
107dbc2
Compare
… error - Fixed the issue #867 Signed-off-by: Hiroshi Miura <miurahr@linux.com>
107dbc2
to
98fda2e
Compare
I agree I messed this up. I have an alternative fix in process. I will submit it for consideration. |
@@ -442,11 +442,12 @@ def _get_archives_base(self, name, target_packages): | |||
try: | |||
extensions_xml_text = self._download_update_xml(extensions_xml_url, True) | |||
except ArchiveDownloadError: | |||
# In case _download_update_xml ignores the hash and tries to get the url. | |||
# In case _download_update_xml failed to get the url because of no extension. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The primary failure when the extension doesn't exist is ChecksumDownloadFailure, which is caught by download_update_xml. I had to modify the code to simulate getting through that and failing with an ArchiveDownloadError.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
and I see in #867 the OP had set INSECURE_NOT_FOR_PRODUCTION_ignore_hash: True
So I think the original comment is more accurate.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When _download_update_xml
method failed to download sha256 checksum, it does not throw exception but set xml_hash = None
and call get_url
.
The exception is thrown from get_url
that try to download Updates.xml
itself.
So when got ArchiveDownloadError
here, it means that it failed to download Update.xml
not hash.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Assuming Settings.ignore_hash is False download_update_xml catches ChecksumDownloadFailure and RETURNS None. It doesn't call get_url (silent = True). This is the normal production behavior.
The OP set ignore_hash to True which behaves as you indicated.
if extensions_xml_text: | ||
self.logger.info("Found extension {}".format(ext)) | ||
update_xmls.append(UpdateXmls(extensions_target_folder, extensions_xml_text)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I moved this into the try block but putting them in the else block may be preferred. There are two places in metadata.py
related to "except (ChecksumDownloadFailure, ArchiveDownloadError)" where I also added additional code to the try block where an else block might be preferred.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
While you are in here it would be good to change
Line 436 in 98fda2e
for ext in ["qtwebengine", "qtpdf"]: |
to
for ext in QtRepoProperty.known_extensions(self.version):
so we only have the list of extensions in one place.
It is out of scope of the fix. |
… error