`file_hash` opens the lowercased path on Windows, so files with uppercase names fail on case-sensitive dirs (`\wsl.localhost`)

Chiusa Adatta ai principianti
#4,925 1 commento 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

  • #4937 di @Deepjyoti-Sarmah — chiusa senza merge

Valutazione

Difficoltà
2/5
Tempo stimato
1-3 ore
Idoneità per principianti
65/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
python
Ambito
tooling

Direzione di ricerca

Inizia in graphify/cache.py da file_hash e _normalize_path. Il risultato in minuscolo di os.path.normcase deve restare solo la chiave della cache, mentre is_file(), il fastpath di stat e la lettura usano il percorso originale. Il commit e73b6060 (#629) ha introdotto _normalize_path, quindi verifica prima il suo scopo. È completato quando file_hash apre la grafia originale e le chiavi della cache restano stabili, cosa che un test che simula normcase può dimostrare senza WSL.

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

Descrizione

What happened?

On Windows, file_hash (graphify/cache.py) normalizes the path with _normalize_path, which calls os.path.normcase and so lowercases it, and then uses that lowercased path for the file itself: p.is_file(), the stat fastpath and the read. On a case-sensitive directory, a file with uppercase letters in its name is then "not a file", and the rebuild fails.

I hit it on the WSL share (\\wsl.localhost\<distro>\...), which is case-sensitive. README.md becomes ...\readme.md, which does not exist there:

warning: worker failed for \\wsl.localhost\Ubuntu\home\<user>\repro\README.md: file_hash requires a file, got: \\wsl.localhost\ubuntu\home\<user>\repro\readme.md
[graphify watch] Rebuild failed: file_hash requires a file, got: \\wsl.localhost\ubuntu\home\<user>\repro\readme.md
Nothing to update or rebuild failed — check output above.

graphify update exits 1.

The lowercasing makes sense for the cache key (stable keys across Windows path spellings, #629), but it should not be the path used to open the file.

Steps to reproduce
  1. On Windows with WSL, a repo inside the distro with any file with an uppercase letter (here README.md plus 40 .py files).
  2. From PowerShell, cd \\wsl.localhost\Ubuntu\home\<user>\repro and run graphify update . --force.

Today this step hangs first because of #4924; with that fix applied, it fails as above in about 10 s.

Graphify version

v8 at 0.9.100, plus the #4924 fix so the run gets past the lock.

Operating System

Windows 11 Pro (Insider build 26340), WSL 3.0.3, Ubuntu distro.

Python Version

3.11

Additional context

_normalize_path came in with e73b6060 (#629, UNC and extended-length paths in the semantic cache).

Lingua principale
Python
Stelle
124k
Fork
11.9k
Merge medio
2h 35m
PR unite (30g)
6

Preparare l'ambiente

Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.

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 Graphify-Labs/graphify

Tutte le issue di Graphify-Labs/graphify

Issue simili

Altre issue su Python

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.