unexpand: backspaces before the last tab stop do not resume tab conversion
I maintainer di solito rispondono entro 1 giorno
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 2/5
- Tempo stimato
- 1-3 ore
- Idoneità per principianti
- 78/100
Direzione di ricerca
Il bug si trova in src/uu/unexpand/src/unexpand.rs, in unexpand_buf vicino alla riga 583, dove il ciclo copia il resto del buffer così com'è e termina quando col raggiunge lastcol, quindi la gestione del backspace non viene mai raggiunta. Inizia eseguendo la riproduzione dell'issue (printf 'abcde\b\b X\n' | target/debug/unexpand -t 3,5) e confronta con l'output di GNU. Il lavoro è completato quando i due spazi diventano una tabulazione (09) e un test di regressione è aggiunto accanto ai test esistenti di unexpand in tests/by-util/.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
With a finite tab-stop list, unexpand stops converting spaces once it reaches the last stop, even when subsequent backspaces move the column back before that stop.
Verified on Linux x86_64 (Debian 13), LC_ALL=C LANG=C, using uutils 0.13.0 built from main at 9cc868bcab387842ea2fa7b8e85c76e05860c51f. GNU coreutils 9.12 (the reference package linked in CONTRIBUTING.md) and 9.7 both produce the expected output.
Reproduction
From the repository root:
cargo build --locked -p uu_unexpand
export LC_ALL=C LANG=C
printf 'abcde\b\b X\n' | target/debug/unexpand -t 3,5 | od -An -tx1
Actual bytes:
61 62 63 64 65 08 08 20 20 58 0a
Expected bytes (GNU 9.12 and 9.7):
61 62 63 64 65 08 08 09 58 0a
The two spaces (20 20) should become a tab (09). After abcde the column is 5; the two backspaces move it to 3, so the following two spaces reach the configured stop at 5. Both implementations exit 0 with empty stderr, but uutils leaves those spaces unconverted.
The same difference occurs without a trailing newline. As controls, both implementations agree when the tab list is 3,5,8, or when the initial text is abc instead of abcde. This isolates the failure to reaching the final configured stop before backspacing.
Cause
In unexpand.rs:583, unexpand_buf copies the remaining buffer verbatim and breaks as soon as col >= lastcol. That skips the backspace handling which would decrease the column and allow conversion again.
No matching report was found in searches of open and closed issues, relevant PRs, and discussions mentioning unexpand and backspaces.
- Lingua principale
- Rust
- Stelle
- 24.3k
- Fork
- 2.1k
- Merge medio
- 1g 22h
- PR unite (30g)
- 396
Preparare l'ambiente
Avvia il container di sviluppo del progetto nel browser, con il tuo account GitHub.
- Nessun Dockerfile né file Docker Compose
- Nessun modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di uutils/coreutils
-
U - od
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
I maintainer di solito rispondono entro 1 giorno
-
U - pr
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
I maintainer di solito rispondono entro 1 giorno
-
U - nl
Difficoltà 2/5 1-3 ore Idoneità per principianti 74/100
I maintainer di solito rispondono entro 1 giorno
-
uniq: overflowing -f/-s/-w values with trailing garbage are silently acceptedForse già presa Una pull request collegata a questa issue è aperta o già unita. ApertaU - uniq
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 72/100
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di uutils/coreutils
Issue simili
-
docs(metrics): replace stale src/metrics.rs line anchors in dashboard-metrics.md with symbol namesAperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 88/100
I maintainer di solito rispondono entro 1 giorno
-
ci-cd desktop size:low telemetry-improvement telemetry-round-1
Difficoltà 2/5 1-3 ore Idoneità per principianti 66/100
vfarcic/dot-agent-deck#2079 ·
I maintainer di solito rispondono entro 1 giorno
-
enhancement user-priority/P3
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 65/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 62/100
I maintainer di solito rispondono entro 2 giorni