leanprover / leanprover/lean4

lake: redundant missing import errors

Open
#4,793 1 comment 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

bug Lake P-medium
Dominant language
Lean
Stars
9.2k
Forks
990
Avg merge
1d 17h
Merged PRs (30d)
175

Description

Here is an example failing build of Mathport due to a moved upstream file:

$ lake build
✖ [63/1717] Running Mathlib.Init.ZeroOne
error: no such file or directory (error code: 2)
  file: ././.lake/packages/mathlib/././Mathlib/Init/ZeroOne.lean
✖ [64/1717] Running Mathport.Binary.Number
error: ././././Mathport/Binary/Number.lean: bad import 'Mathlib.Init.ZeroOne'
✖ [65/1717] Running Mathport.Binary.Heterogenize
error: ././././Mathport/Binary/Heterogenize.lean: bad import 'Mathport.Binary.Number'
✖ [66/1717] Running Mathport.Binary.TranslateExpr
error: ././././Mathport/Binary/TranslateExpr.lean: bad import 'Mathport.Binary.Number'
error: ././././Mathport/Binary/TranslateExpr.lean: bad import 'Mathport.Binary.Heterogenize'
✖ [67/1717] Running Mathport.Binary.Apply
error: ././././Mathport/Binary/Apply.lean: bad import 'Mathport.Binary.TranslateExpr'
✖ [68/1717] Running Mathport.Binary
error: ././././Mathport/Binary.lean: bad import 'Mathport.Binary.Apply'
✖ [1641/1717] Running Mathport
error: ././././Mathport.lean: bad import 'Mathport.Binary'
✖ [1642/1717] Running MathportApp
error: ././././MathportApp.lean: bad import 'Mathport'
✖ [1644/1717] Running mathport
error: ././././MathportApp.lean: bad import 'Mathport'

The first error is correct, but all subsequent errors are incorrect / misleading. Essentially, if a file imports a nonexistent file, then that file will itself be considered nonexistent by its dependencies, possibly leading to hundreds of cascading failures, within which the original error might be hard to spot.

Tested on Lake version 5.0.0-702c31b (Lean version 4.10.0-rc2).

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the cascade with lake build using the Mathport example, starting with the missing Mathlib.Init.ZeroOne import and the subsequent Mathport.Binary failures. Inspect Lake's import and dependency error handling; done means the original missing-file error remains visible without misleading cascading missing-import errors.

Written by the indexing model from the issue text.

Assessment

Domain
build-system, compilers
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.