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

Abierto
#16,591 0 comentarios 0 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 1 día

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
4/5
Tiempo estimado
3-5 días
Aptitud para principiantes
54/100
Tipo de issue
Error
Claridad
Bastante claro
Estado de actividad
Activo
Área
build-system

Línea de trabajo

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.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

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.

Lenguaje dominante
Lean
Estrellas
10.3k
Forks
1.1k
Merge medio
19 h 8 min
PR fusionados (30 d)
421

Preparar el entorno

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de leanprover/lean4

Todos los issues de leanprover/lean4

Issues similares

Más issues de Build System

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.