diff -e: no script at all when a file has no newline at the end
Mantenedores costumam responder em até 1 dia
Ninguém assumiu esta issue ainda.
Avaliação
- Dificuldade
- 2/5
- Tempo estimado
- 1-3 horas
- Facilidade para iniciantes
- 35/100
Direção de pesquisa
Read src/ed_diff.rs around lines 65 and 71, where DiffError::MissingNL causes an early return, and inspect the missing_newline test in tests/by-util/test_diff.rs around line 122. Compare diff -e output for files with missing final newlines against GNU diff; done means the ed script is printed and missing-newline warnings match the described behavior.
Escrita pelo modelo de indexação a partir do texto da issue.
Descrição
When either file's last line has no newline, diff -e prints nothing on stdout:
$ printf 'a\nb' > x; printf 'a\nc\n' > y
$ diffutils diff -e x y
No newline at end of file
$ echo $?
2
$ /usr/bin/diff -e x y # GNU diff 3.12
2c
c
.
/usr/bin/diff: x: No newline at end of file
$ echo $?
2
GNU still writes the ed script, then warns on stderr for each file that lacks the final newline (diff: FILE: No newline at end of file, then a blank line) and exits 2. Both exit 2, but a caller that applies the script, or shows it, gets nothing from uutils.
The early return is in src/ed_diff.rs:65 and src/ed_diff.rs:71 (DiffError::MissingNL). The test missing_newline (tests/by-util/test_diff.rs:122) checks for the current stderr (starts_with("No newline at end of file")), so matching GNU means changing that test. I have a change that matches GNU for either file, both, two different files with the same content, an empty file and stdin (apart from 2,2d, which is #308); happy to open a PR if you want GNU's output here.
uutils diffutils main 8ff5bda and v0.6.0.
- Linguagem predominante
- Rust
- Estrelas
- 280
- Forks
- 49
- Merge médio
- 2d 9h
- PRs com merge (30d)
- 16
Preparar o ambiente
- Sem Dockerfile nem arquivo Docker Compose
- Sem modelo de pull request
- Ler o guia de contribuição
Primeiros passos
- Leia a issue inteira e depois o guia de contribuição do projeto.
- Comente na issue dizendo que vai assumir — evita que duas pessoas façam o mesmo trabalho.
- Faça um fork do repositório e trabalhe em uma branch.
- Abra um pull request que referencie o número da issue.
Mais de uutils/diffutils
-
cmp: quiet mode compares full file sizes before applying -nTalvez já em andamento @SichenLiang assumiu há 30 dias. Aberta
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 78/100
Mantenedores costumam responder em até 1 dia
-
diff: `-y --tabsize=<huge>` overflows the column arithmetic (overflow-checks only)Talvez já em andamento @sami-daniel assumiu há 81 dias. Aberta
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 70/100
Mantenedores costumam responder em até 1 dia
-
diff panics on an oversized inline context count (`-c`/`-u`/`-C`/`-U`): parse overflow and capacity overflowTalvez já em andamento @MsfPablo assumiu há 76 dias. Aberta
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 72/100
uutils/diffutils#245 · 1 comentário ·
Mantenedores costumam responder em até 1 dia
-
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 68/100
Mantenedores costumam responder em até 1 dia
-
sdiff: fix the layout of unchanged rows, blank lines and cut tabsTalvez já em andamento @sami-daniel assumiu há 27 dias. Aberta
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 28/100
Mantenedores costumam responder em até 1 dia
Todas as issues de uutils/diffutils
Issues semelhantes
-
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 70/100
Mantenedores costumam responder em até 1 dia
-
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 70/100
libnativeapi/nativeapi#21 ·
-
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 78/100
Mantenedores costumam responder em até 1 dia
-
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 68/100
longbridge/nsh#804 ·
Mantenedores costumam responder em até 1 dia
-
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 62/100
Mantenedores costumam responder em até 1 dia