opam icon indicating copy to clipboard operation
opam copied to clipboard

Opam does install package despite download hash error

Open MSoegtropIMC opened this issue 3 years ago • 3 comments

In a local patch opam repo I did a mistake in setting the download hash (I used the wrong type). Opam did detect the error but installed the package anyway. Is this expected behavior?

[ERROR] In the opam file for coq-unicoq.1.3+8.11:
          - At
            /Users/msoegtrop/.opam/repo/patch_coq-platform_.8.11.2.alpha1/packages/coq-unicoq/coq-unicoq.1.3+8.11/opam:22:145:
            while expecting checksum: Invalid_argument("OpamHash.of_string")
        'url.checksum' has been ignored.
The following actions will be performed:
  - install coq-unicoq 1.3+8.11

opam version = 2.0.7.

MSoegtropIMC avatar Aug 06 '20 14:08 MSoegtropIMC

It is the expected behavior as it is an parsing error and the field is not mandatory, so a wrong checksum (because of an parse error) results on a missing checksum.

rjbou avatar Aug 10 '20 13:08 rjbou

I must say I don't find this very agreeable. It is easy to overlook this - I tend to install 50 opam packages en batch. Are there good reasons for this choice or is it more that this is what the implementation does without explicitly handling it otherwise?

MSoegtropIMC avatar Aug 10 '20 20:08 MSoegtropIMC

This definitely needs to be fixed, but we'll address this for opam 2.2 as part of a wider check of the checksums!

dra27 avatar Jan 22 '21 09:01 dra27