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

オープン
#16,591 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

まだ誰も着手していません。

評価

難易度
4/5
見積もり時間
3〜5日
初心者へのやさしさ
54/100
issue の種類
バグ
明瞭さ
おおむね明確
活発さ
活発
領域
build-system

調査の方向性

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.

索引モデルが issue の本文から書いたものです。

説明

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.

主要言語
Lean
スター
10.3k
フォーク
1.1k
平均マージ
19時間 8分
マージ済み PR(30日)
421

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

leanprover/lean4 のほかの issue

leanprover/lean4 の issue をすべて見る

似ている issue

Build System の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。