poetry icon indicating copy to clipboard operation
poetry copied to clipboard

hash check when installing packages from cache

Open ombschervister opened this issue 5 years ago • 7 comments

When installing packages, poetry uses cache to avoid redownloading files. If cached package file is corrupted (due to failed download, etc), poetry will not work until you delete this file from cache directory manually.

This PR adds hash check when installing packages from cache: if hash is incorrect, the file will be redownloaded.

Pull Request Check List

  • [x] Added tests for changed code.
  • [ ] Updated documentation for changed code.

ombschervister avatar Oct 28 '20 13:10 ombschervister

fixes: https://github.com/python-poetry/poetry/issues/3326

earonesty avatar Dec 20 '21 20:12 earonesty

I think it would be better to have Poetry remove the broken file from the cache in place of the user. The cache is the software's responsiblity, not the user's.

joooeey avatar Dec 28 '21 16:12 joooeey

@joooeey

I think it would be better to have Poetry remove the broken file from the cache in place of the user. The cache is the software's responsiblity, not the user's.

In this request, Poetry itself removes the broken files. When loading the library, Poettry warns about the corruption of the file in the cache, and then overwrites the file itself.

image

ombschervister avatar Jan 03 '22 22:01 ombschervister

some documentation should be added, but otherwise, looks good.

Is this something I should do? Do you mean that I should add comments to my code in the request? Also I see the documentation in the docs folder but I don't see a place for such detailed implementation details

ombschervister avatar May 22 '22 06:05 ombschervister

some documentation should be added, but otherwise, looks good.

Is this something I should do? Do you mean that I should add comments to my code in the request? Also I see the documentation in the docs folder but I don't see a place for such detailed implementation details

Hi. When it comes to documentation, it's expected to add necessary changes to docs if needed. .md files in the docs directory are named the same as sections in the documentation on the Poetry website. However, in this case, I don't think there is a need for change. We don't have information in the documentation about how the cache is working.

Also, please merge with master branch and resolve conflicts.

Secrus avatar May 22 '22 21:05 Secrus

@Secrus should i do something else?

ombschervister avatar May 24 '22 05:05 ombschervister

@0xDEC0DE and @sdispater worked on a similar issue, maybe they can approve.

earonesty avatar Jul 12 '22 14:07 earonesty

I think this PR is not relevant anymore (and must be closed), since, as far as I understand, current Poetry version already check hashes for every file, cached or not.

But, perhaps the author can salvage something. Two things come to my mind: (1) I didn't find on current code a dedicated test to verify cached hash mismatch, and (2) maybe it can be introduced the nice log messages when there is a cache mismatch.

wagnerluis1982 avatar Feb 21 '23 22:02 wagnerluis1982

This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

github-actions[bot] avatar Feb 29 '24 01:02 github-actions[bot]