Lake silently accepts import of built-and-then-removed library

Aperta
#16,591 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
54/100
Tipo di issue
Bug
Chiarezza
Abbastanza chiara
Stato di attività
Attiva
Ambito
build-system

Direzione di ricerca

Start by reading src/lake/Lake/Build/Module.lean, especially fetchImportInfo and its handling of findModules results. Trace how workspace import artifacts, ModuleSetup.importArts, and build-time LEAN_PATH interact for the missing-library case, then check the relevant Lake build tests. Done means rebuilding Foo fails after Bar is removed, while toolchain imports such as Init still work.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

bug
Description

Lake detects when a module of an existing library is missing even if its .olean file exists but does not do so if the library itself is missing.

Steps to Reproduce

lakefile.toml:

name = "repro"
[[lean_lib]]
name = "Foo"
[[lean_lib]]
name = "Bar"

Bar.lean:

def bar := 1

Foo.lean:

import Bar
def foo := bar
  1. lake build Foo Bar
  2. Remove the Bar library from lakefile.toml and delete Bar.lean.
  3. Change Foo.lean (for example, add a comment) and run lake build Foo.

Expected behavior: The build fails, because no library provides Bar.

Actual behavior: Foo is rebuilt against the stale .lake/build/lib/lean/Bar.olean and the build succeeds. After rm -rf .lake, the same build fails:

error: Foo.lean:1:0: unknown module prefix 'Bar'

No directory 'Bar' or file 'Bar.olean' in the search path entries:
Versions

Lean (version 4.37.0-pre, x86_64-unknown-linux-gnu, commit a9678c19851a8209310ed748045bae7425d5d60e, Release)

Additional Information

fetchImportInfo in src/lake/Lake/Build/Module.lean skips an import when findModules returns no module, which is also the path taken for toolchain modules such as Init. Lake already passes the artifacts of every workspace import to Lean through ModuleSetup.importArts, so the workspace entries in the build-time LEAN_PATH only serve this fallback. The stale file is also not part of the build trace.

Lingua principale
Lean
Stelle
10.3k
Fork
1.1k
Merge medio
19h 8m
PR unite (30g)
421

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di leanprover/lean4

Tutte le issue di leanprover/lean4

Issue simili

Altre issue su Build System

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.