uutils / uutils/diffutils

diff&cmp not suitable to be called as library functions.

Aperta
#280 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Lingua principale
Rust
Stelle
276
Fork
39
Merge medio
3h 27m
PR unite (30g)
3

Descrizione

Problems with using diffutils.rs as a library:

  1. ExitCode is intended to be consumed only by the standard library ... For forwards compatibility with potentially unusual targets, this type currently does not provide Eq, Hash, or access to the raw value. ... so it seems library callers (such as myself) would prefer an i32.
  2. The exit(2) is worrying for library callers who don't want to be suddenly killed.

I got the hy3 model to create a fix for this for me. But it lumped it all into one big commit: https://github.com/gmatht/diffutils/commit/4bdd5219adf1485aaf60114ba10adf7e3a26ac7e

Should I make a pull request including two commits:

  1. Replace the ExitCode/exit() convention with i32 returns, everywhere except at the very top main function.
  2. Add Tests that ensure errors return an appropriate i32 instead of aborting the whole process.

Also should 1./2. be split into updating diff.rs and updating cmp.rs, resulting in 4 commits? If so, main should also should still be updated in each commit so e.g. it doesn't break the build.

Do you prefer that the test or the fix be commited first?

Guida per i contributori

Apri la guida per i contributori

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.

Direzione di ricerca

Inizia esaminando diff.rs e cmp.rs, poi ispeziona la funzione main di livello superiore e il commit di correzione collegato per il comportamento attuale di ExitCode ed exit(). Verifica come sono organizzati i test e aggiungi la copertura per i ritorni di errore senza terminazione del processo. Il lavoro è completato quando entrambi i comandi rimangono compilabili, i chiamanti della libreria ricevono risultati i32 appropriati e solo la funzione main di livello superiore gestisce l’uscita del processo.

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

Valutazione

Stack tecnologico
rust
Ambito
api, cli
Tipo di issue
Funzionalità
Difficoltà
4/5
Tempo stimato
3-5 giorni
Stato di attività
Attiva
Chiarezza
Abbastanza chiara
Idoneità per principianti
64/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.