diff -e: extra empty "a" command after a "." line at the end of a hunk

未关闭 适合新手
#342 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 1 天内回复

@qodelicious 已经在做这个了。

开始于 2026年11月7日。

  • #343 来自 @qodelicious —— 未关闭

评估

难度
2/5
预计耗时
1-3 小时
新手友好度
78/100
Issue 类型
缺陷
描述清晰度
描述清楚
活跃度
活跃
技术栈
rust
领域
cli

调研方向

首先找到生成 diff -e 脚本的代码及其测试;issue 未指定具体文件。将 hunk 以仅包含 . 的行结尾时生成的脚本与 GNU diff 3.10 进行比较。输出省略末尾空的 a 命令并与示例一致,即为完成。

由索引模型根据 Issue 内容生成。

描述

A line that is just "." can't go straight into an ed script, so it's written as "..", the text is ended and s/.// fixes it up. We always start a new a after that, even when the "." was the last line of the hunk, so the script ends with an empty a and .. GNU diff only adds the a when more lines follow.

$ printf 'a\nb\n' > old
$ printf 'a\nb\n.\n' > new
$ diff -e old new          # GNU diff 3.10
2a
..
.
s/.//
$ diffutils diff -e old new
2a
..
.
s/.//
a
.

ed still gives the right result, but the output isn't the same as GNU.

主要语言
Rust
星标
280
派生
49
平均合并
4 天 12 小时
30 天内合并 PR
24

环境准备

  • 没有 Dockerfile 或 Docker Compose 文件
  • 没有 Pull Request 模板
  • 阅读贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

uutils/diffutils 的其他 Issue

查看 uutils/diffutils 的全部 Issue

相似的 Issue

更多 Rust Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。