crash when type checking file in a read only directory
Dieses Issue hat noch niemand übernommen.
- Vorherrschende Sprache
- Python
- Sterne
- 20.6k
- Forks
- 3.3k
- PR-Merge-Kennzahlen
- PR-Kennzahlen ausstehend
Beschreibung
Crash Report
mypy gives INTERNAL_ERROR when type checking files on read only filesystem (e.g. ro bind mount).
This can happen when running inside docker/checking files that you don't have write permission to.
Traceback
$ mypy hello.py --show-traceback
error: INTERNAL ERROR -- Please try using mypy master on GitHub:
https://mypy.readthedocs.io/en/stable/common_issues.html#using-a-development-mypy-build
Please report a bug at https://github.com/python/mypy/issues
version: 2.1.0
Traceback (most recent call last):
File "/home/karlicos/.local/share/uv/tools/mypy/lib/python3.14/site-packages/mypy/__main__.py", line 16, in console_entry
main()
~~~~^^
File "mypy/main.py", line 154, in main
File "mypy/main.py", line 244, in run_build
res = build.build(sources, options, None, flush_errors, fscache, stdout, stderr)
File "mypy/build.py", line 385, in build
File "mypy/build.py", line 1916, in create_metastore
mds: MetadataStore = SqliteMetadataStore(
File "mypy/metastore.py", line 192, in __init__
File "<frozen os>", line 226, in makedirs
File "<frozen os>", line 236, in makedirs
OSError: [Errno 30] Read-only file system: '.mypy_cache'
To Reproduce
mkdir /tmp/ro
cd /tmp/ro
echo 'x: int = "a"' > hello.py
chmod -w /tmp/ro
mypy hello.py --show-traceback
Your Environment
- Mypy version used: 2.1.0
- Mypy command-line flags: N/A
- Mypy configuration options from
mypy.ini(and other config files): N/A - Python version used: 3.14
- Operating system and version:
Linux 7.0.0-15-generic #15-Ubuntu SMP PREEMPT_DYNAMIC
Debugging attempt
I also reproduced in a clean environment with Claude, so pretty sure it's unaffected by my system conviguration.
- with
--no-sqlite-cachethe crash doesn't happen - bisection shows that it started happening when sqlite cache became the default, on 1.20
Beitragsleitfaden
Erste Schritte
- Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
- Forke das Repository und arbeite in einem Branch.
- Öffne einen Pull Request, der die Issue-Nummer nennt.
Rechercherichtung
Reproduziere das Problem mit dem schreibgeschützten /tmp/ro-Setup, lies dann mypy/build.py im Bereich von create_metastore und mypy/metastore.py im Bereich von SqliteMetadataStore. Vergleiche das Verhalten mit --no-sqlite-cache und verifiziere, dass die Typprüfung eines schreibgeschützten Verzeichnisses den Quellfehler meldet, ohne einen INTERNAL_ERROR oder einen Fehler beim Versuch, den Cache zu erstellen.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Bewertung
- Tech-Stack
- python, sqlite
- Bereich
- cli, tooling
- Issue-Typ
- Bug
- Schwierigkeit
- 3/5
- Geschätzter Aufwand
- 1-2 Tage
- Aktivitätsstatus
- Ruhig
- Klarheit
- Klar beschrieben
- Anfängerfreundlichkeit
- 68/100