Agent-mode PyPI apply leaves .dist-info/RECORD stale (advisory only): rewrite the rows of patched files

Aperta
#2,201 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
3/5
Tempo stimato
1-2 giorni
Idoneità per principianti
45/100
Tipo di issue
Funzionalità
Chiarezza
Abbastanza chiara
Stato di attività
Attiva
Stack tecnologico
python, rust
Ambito
backend

Direzione di ricerca

Start with the advisory's source at crates/socket-patch-core/src/patch/sidecars/types.rs (around line 104) and its dispatch in patch/sidecars/mod.rs (around line 191), then read the cargo sidecar that rewrites .cargo-checksum.json as the model to follow. Done means RECORD rows for patched files get a fresh sha256 urlsafe-base64 hash and size, line endings are kept, rollback restores them, and the advisory still fires when a row cannot be rewritten.

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

Descrizione

agent:triaged enhancement pm:pip priority:p1

Summary

After agent mode patches files of a PyPI distribution, the hashes in *.dist-info/RECORD are left stale and the tool emits the PypiRecordStale advisory (crates/socket-patch-core/src/patch/sidecars/types.rs:104: "we didn't rewrite .dist-info/RECORD"; dispatched from patch/sidecars/mod.rs:191). Vendored mode does not have the problem because the wheel it installs carries a regenerated RECORD.

Why this matters

RECORD is what pip and other installers use to verify and to uninstall a distribution, and integrity tools compare it with the files on disk. After a patch they report the patched files as modified. For a text patch that is one line per file; for a patch that replaces a compiled extension it is the same single line. Rewriting it is mechanical: I rewrote the RECORD line for one changed file in a 145-entry pillow wheel and re-validated all 139 hashed entries.

Suggested direction

Rewrite the RECORD rows of the files a patch wrote (sha256 urlsafe-base64 and size, preserving the file's line endings), as the cargo sidecar already does for .cargo-checksum.json, and restore them on rollback. Keep the advisory for the cases that cannot be rewritten (no RECORD, RECORD not writable, a row that did not match the pre-patch file).

Lingua principale
Rust
Stelle
9
Fork
2
Merge medio
1g 8h
PR unite (30g)
309

Preparare l'ambiente

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 SocketDev/socket-patch

Tutte le issue di SocketDev/socket-patch

Issue simili

Altre issue su Rust

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.