Skip to content

Output of "dhall freeze --cache" no longer works with Dhall v21.0.0 #2347

Closed
@joell

Description

@joell

The dhall freeze command has a --cache flag thats described purpose is to "Add fallback unprotected imports when using integrity checks purely for caching purposes". However, in dhall-haskell 1.40.1 the code generated from using this feature no longer works if the fetched URL content does not match the hash.

Example:

# observe how dhall freeze creates a cache-only fallback import for List/map
$ dhall freeze --cache <<< 'https://prelude.dhall-lang.org/List/map'
  https://prelude.dhall-lang.org/List/map
    sha256:dd845ffb4568d40327f2a817eb42d1c6138b929ca758d50bc33112ef3c885680
? https://prelude.dhall-lang.org/List/map

# submit the same code to Dhall but with a hash that does not match the content
$ echo '
  https://prelude.dhall-lang.org/List/map
    sha256:ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
? https://prelude.dhall-lang.org/List/map' | dhall
dhall: 
↳ https://prelude.dhall-lang.org/List/map
  sha256:ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff

Error: Import integrity check failed

Expected hash:

↳ ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff

Actual hash:

↳ dd845ffb4568d40327f2a817eb42d1c6138b929ca758d50bc33112ef3c885680


1│ https://prelude.dhall-lang.org/List/map sha256:ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff

(input):1:1

The expectation I had from the description of dhall freeze --check was that the ? operator should fallback from the integrity-check-failing import to the unprotected URL import and the expression should have succeeded (as long as https://prelude.dhall-lang.org/List/map could be loaded). Put simply, it seems this should work without emitting an error message.

Is dhall freeze --check's description out of date, dhall-haskell's implementation buggy, or my interpretation of all this faulty?

(Update: Given the breaking change to ? in Dhall v21.0.0, it seems the issue here is in the output of dhall freeze --cache not being revised to adapt to the breaking change.)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions