Better warnings for empty hashes: state where it is from! #615

Open
opened 2025-01-06 17:19:27 +00:00 by jade · 0 comments
Owner

Currently Lix will output a warning like so when given an empty hash from some kind of fixed-output thing.

warning: found empty hash, assuming 'sha256-AAAAAAAAAAAAAAAAAAAAAААААААААААААААААААААА'

This is from this code:

https://git.lix.systems/lix-project/lix/src/b0d7a816135de1cd551b8a54f5497148bf59d81d/lix/libutil/hash.cc#L264-L275

This is used by builtins.fetchTree (and by extension builtins.fetchTarball) and the builtin:fetchurl builtin derivation builder (which could say something about what was being fetched) as well as by fixed-output derivations at eval time via builtins.derivation (which could at the very least output name and maybe a url property if present, like we do currently for hash mismatches).

For the builtins and especially builtins.derivation, this should really be an evaluation warning that can trigger the debugger (for which we need a system, but see #614). For the builtin builder, nearly nobody uses that thing so whatever, and the warning comes from the store so it's not going to be super easy to get rich debug info out of it regardless.

Currently Lix will output a warning like so when given an empty hash from some kind of fixed-output thing. ``` warning: found empty hash, assuming 'sha256-AAAAAAAAAAAAAAAAAAAAAААААААААААААААААААААА' ``` This is from this code: https://git.lix.systems/lix-project/lix/src/b0d7a816135de1cd551b8a54f5497148bf59d81d/lix/libutil/hash.cc#L264-L275 This is used by `builtins.fetchTree` (and by extension `builtins.fetchTarball`) and the `builtin:fetchurl` builtin derivation builder (which could say something about what was being fetched) as well as by fixed-output derivations at eval time via `builtins.derivation` (which could at the very least output `name` and maybe a `url` property if present, like we do currently for hash mismatches). For the builtins and especially `builtins.derivation`, this should really be an evaluation warning that can trigger the debugger (for which we need a system, but see https://git.lix.systems/lix-project/lix/issues/614). For the builtin builder, nearly nobody uses that thing so whatever, and the warning comes from the store so it's not going to be super easy to get rich debug info out of it regardless.
jade added this to the Error reporting project 2025-02-08 03:18:27 +00:00
Sign in to join this conversation.
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: lix-project/lix#615
No description provided.