Skip to content
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

[DYN-2609] Fix crash when installing empty package #10561

Merged
merged 1 commit into from
Apr 13, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -525,9 +525,15 @@ internal void ExecutePackageDownload(string name, PackageVersion version, string

// determine if any of the packages contain binaries or python scripts.
var containsBinariesOrPythonScripts = dependencyVersionHeaders.Any(x =>
x.contains_binaries ||
x.contents.Contains(PackageManagerClient.PackageContainsBinariesConstant) ||
x.contents.Contains(PackageManagerClient.PackageContainsPythonScriptsConstant));
{
var are_contents_empty = string.IsNullOrEmpty(x.contents);
var contains_binaries = x.contains_binaries ||
!are_contents_empty && x.contents.Contains(PackageManagerClient.PackageContainsBinariesConstant);
var contains_python =
!are_contents_empty && x.contents.Contains(PackageManagerClient.PackageContainsPythonScriptsConstant);
return contains_binaries || contains_python;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PackageManagerClient.PackageContainsPythonScriptsConstant and PackageManagerClient.PackageContainsBinariesConstant are deprecated so I'm not sure if we should use these or something else.

Copy link
Member

@mjkkirschner mjkkirschner Apr 13, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure either, but the package header only contains one boolean field -contains binaries which is true if the package contains binaries or python...

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are 41 versions across 22 packages that are still using this "obsolete" method of marking packages. We could theoretically update those version records in the database to have the contains_binaries field set to true and then we could remove these constants.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a contains_python field as well? If so, then we need to add it to the check here.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, there is only a single field for both.


});

// if any do, notify user and allow cancellation
if (containsBinariesOrPythonScripts)
Expand Down