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

Package cannot automatically be dropped, but is currently #9

Open
richard-uk1 opened this issue Apr 13, 2017 · 2 comments
Open

Package cannot automatically be dropped, but is currently #9

richard-uk1 opened this issue Apr 13, 2017 · 2 comments

Comments

@richard-uk1
Copy link
Owner

richard-uk1 commented Apr 13, 2017

Quoted

The Package implementation must be changed. It's good that alpm_pkg_load is the only function that return a alpm_pkg_t which must owned but it can't be free automatically via Drop. In fact the common usage is to load a local tarball and then to install it. In the case of a successful install it must not be freed, otherwise it must be freed.
What I would do:

  • implement alpm_pkg_load in Transaction in a function which load a tarball and add the returned package to install, this way the package can freed manually in case of failure.
  • rename PackageRef as Package for name consistency.
  • maybe implement Package as Db with a struct keeping a reference to a alpm_pkg_t
@richard-uk1
Copy link
Owner Author

I need to look at this again, but my first thoughts:

Maybe a successful install could take ownership of the package, and then not run the drop (using mem::forget or similar).

@richard-uk1
Copy link
Owner Author

I've implemented an approach based on mem::forget. Need to check it works as expected.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant