Lake silently accepts import of built-and-then-removed library
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 54/100
- Issue type
- Bug
- Clarity
- Mostly clear
- Activity status
- Active
- Domain
- build-system
Research direction
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.
Written by the indexing model from the issue text.
Description
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
lake build Foo Bar- Remove the
Barlibrary fromlakefile.tomland deleteBar.lean. - Change
Foo.lean(for example, add a comment) and runlake 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.
- Dominant language
- Lean
- Stars
- 10.3k
- Forks
- 1.1k
- Avg merge
- 19h 8m
- Merged PRs (30d)
- 421
Getting set up
- No Dockerfile or Docker Compose file
- Has a pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from leanprover/lean4
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
leanprover/lean4#16681 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
leanprover/lean4#16305 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 86/100
leanprover/lean4#16299 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
leanprover/lean4#16257 ·
Maintainers usually reply within 1 day
-
`IO.FS.realPath` reports every failure as `noFileOrDirectory` instead of classifying by `errno`Openbug
Difficulty 2/5 1-3 hours Newbie friendliness 66/100
leanprover/lean4#15683 ·
Maintainers usually reply within 1 day
All issues in leanprover/lean4
Similar issues
-
sync cache dist/imgOpen
Difficulty 1/5 Under an hour Newbie friendliness 82/100
oleeskild/digitalgarden#435 ·
-
enhancement
Difficulty 1/5 Under an hour Newbie friendliness 78/100
Tarektouati/made#186 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
fluentmigrator/fluentmigrator#2463 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
Maintainers usually reply within 1 day
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
jenkins-infra/packer-images#3314 · 4 comments ·
Maintainers usually reply within 1 day