diff -e: no script at all when a file has no newline at the end
Maintainer thường phản hồi trong vòng 1 ngày
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 2/5
- Thời gian dự kiến
- 1-3 giờ
- Mức phù hợp với người mới
- 35/100
Hướng nghiên cứu
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.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
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.
- Ngôn ngữ chính
- Rust
- Star
- 280
- Fork
- 49
- Merge trung bình
- 2 ngày 9 giờ
- Pull request đã merge (30 ngày)
- 16
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Không có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của uutils/diffutils
-
cmp: quiet mode compares full file sizes before applying -nCó thể đã có người làm @SichenLiang đã nhận 30 ngày trước. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
Maintainer thường phản hồi trong vòng 1 ngày
-
diff: `-y --tabsize=<huge>` overflows the column arithmetic (overflow-checks only)Có thể đã có người làm @sami-daniel đã nhận 81 ngày trước. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 70/100
Maintainer thường phản hồi trong vòng 1 ngày
-
diff panics on an oversized inline context count (`-c`/`-u`/`-C`/`-U`): parse overflow and capacity overflowCó thể đã có người làm @MsfPablo đã nhận 76 ngày trước. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
uutils/diffutils#245 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
Maintainer thường phản hồi trong vòng 1 ngày
-
sdiff: fix the layout of unchanged rows, blank lines and cut tabsCó thể đã có người làm @sami-daniel đã nhận 27 ngày trước. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 28/100
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của uutils/diffutils
Issue tương tự
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 70/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 70/100
libnativeapi/nativeapi#21 ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
longbridge/nsh#804 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 62/100
Maintainer thường phản hồi trong vòng 1 ngày