diff -e: no script at all when a file has no newline at the end
Les mainteneurs répondent en général sous 1 jour
Personne n'a encore pris cette issue.
Évaluation
- Difficulté
- 2/5
- Temps estimé
- 1-3 heures
- Accessibilité débutants
- 35/100
Piste de recherche
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.
Rédigé par le modèle d'indexation à partir du texte de l'issue.
Description
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.
- Langage dominant
- Rust
- Étoiles
- 280
- Forks
- 49
- Merge moyen
- 2 j 7 h
- PR mergées (30 j)
- 17
Préparer son environnement
- Aucun Dockerfile ni fichier Docker Compose
- Aucun modèle de pull request
- Lire le guide de contribution
Par où commencer
- Lisez l'issue en entier, puis le guide de contribution du projet.
- Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
- Forkez le dépôt et travaillez sur une branche.
- Ouvrez une pull request qui référence le numéro de l'issue.
Autres issues de uutils/diffutils
-
cmp: quiet mode compares full file sizes before applying -nPeut-être pris @SichenLiang l’a pris il y a 31 jours. Ouverte
Difficulté 2/5 1-3 heures Accessibilité débutants 78/100
Les mainteneurs répondent en général sous 1 jour
-
diff: `-y --tabsize=<huge>` overflows the column arithmetic (overflow-checks only)Peut-être pris @sami-daniel l’a pris il y a 82 jours. Ouverte
Difficulté 2/5 1-3 heures Accessibilité débutants 70/100
Les mainteneurs répondent en général sous 1 jour
-
diff panics on an oversized inline context count (`-c`/`-u`/`-C`/`-U`): parse overflow and capacity overflowPeut-être pris @MsfPablo l’a pris il y a 77 jours. Ouverte
Difficulté 2/5 1-3 heures Accessibilité débutants 72/100
uutils/diffutils#245 · 1 commentaire ·
Les mainteneurs répondent en général sous 1 jour
-
Difficulté 2/5 1-3 heures Accessibilité débutants 68/100
Les mainteneurs répondent en général sous 1 jour
-
sdiff: fix the layout of unchanged rows, blank lines and cut tabsPeut-être pris @sami-daniel l’a pris il y a 28 jours. Ouverte
Difficulté 2/5 1-3 heures Accessibilité débutants 28/100
Les mainteneurs répondent en général sous 1 jour
Toutes les issues de uutils/diffutils
Issues similaires
-
docs(metrics): replace stale src/metrics.rs line anchors in dashboard-metrics.md with symbol namesOuverte
Difficulté 2/5 1-3 heures Accessibilité débutants 88/100
Les mainteneurs répondent en général sous 1 jour
-
ci-cd desktop size:low telemetry-improvement telemetry-round-1
Difficulté 2/5 1-3 heures Accessibilité débutants 66/100
vfarcic/dot-agent-deck#2079 ·
Les mainteneurs répondent en général sous 1 jour
-
修改文件名时主键盘上的数字无法输入Ouvertebug
Difficulté 2/5 1-3 heures Accessibilité débutants 63/100
qingjian-team/qingjian#894 ·
Les mainteneurs répondent en général sous 2 jours
-
Difficulté 2/5 1-3 heures Accessibilité débutants 85/100
rubys/roundhouse#1757 ·
-
[Feature] 侧边栏Agent HTTP请求UA适配Ouverteenhancement user-priority/P3
Difficulté 2/5 1-3 heures Accessibilité débutants 68/100
t8y2/dbx#14196 · 1 commentaire ·
Les mainteneurs répondent en général sous 1 jour