diff&cmp not suitable to be called as library functions.
还没有人认领这个 Issue。
评估
调研方向
先查看 diff.rs 和 cmp.rs,然后检查顶层 main 函数以及关联的修复提交,以了解当前 ExitCode 和 exit() 的行为。检查测试的组织方式,并为返回错误但不终止进程的情况添加覆盖。完成的标准是两个命令仍然可以构建,库调用方能够收到适当的 i32 结果,并且只有顶层 main 负责退出进程。
由索引模型根据 Issue 内容生成。
描述
Problems with using diffutils.rs as a library:
- ExitCode is intended to be consumed only by the standard library ... For forwards compatibility with potentially unusual targets, this type currently does not provide Eq, Hash, or access to the raw value. ... so it seems library callers (such as myself) would prefer an i32.
- The exit(2) is worrying for library callers who don't want to be suddenly killed.
I got the hy3 model to create a fix for this for me. But it lumped it all into one big commit: https://github.com/gmatht/diffutils/commit/4bdd5219adf1485aaf60114ba10adf7e3a26ac7e
Should I make a pull request including two commits:
- Replace the ExitCode/exit() convention with i32 returns, everywhere except at the very top main function.
- Add Tests that ensure errors return an appropriate i32 instead of aborting the whole process.
Also should 1./2. be split into updating diff.rs and updating cmp.rs, resulting in 4 commits? If so, main should also should still be updated in each commit so e.g. it doesn't break the build.
Do you prefer that the test or the fix be commited first?
- 主要语言
- Rust
- 星标
- 276
- 派生
- 39
- 平均合并
- 3 小时 27 分钟
- 30 天内合并 PR
- 3
贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
uutils/diffutils 的其他 Issue
-
难度 2/5 1-3 小时 新手友好度 70/100
-
难度 2/5 1-3 小时 新手友好度 85/100
-
难度 2/5 1-3 小时 新手友好度 72/100
-
难度 2/5 1-3 小时 新手友好度 68/100
-
难度 3/5 1-2 天 新手友好度 76/100
相似的 Issue
-
risk:low runtime status:in-progress type:test
难度 1/5 1 小时以内 新手友好度 92/100
zeroclaw-labs/zeroclaw#11023 ·
-
good first issue refactor
难度 2/5 1-3 小时 新手友好度 72/100
-
难度 2/5 1-3 小时 新手友好度 84/100
EricSpencer00/Resilient#4835 · 1 条评论 ·
-
难度 2/5 1-3 小时 新手友好度 74/100
bisq-network/bisq-musig#204 ·
-
agent:ready documentation
难度 2/5 1-3 小时 新手友好度 88/100
cesarferreira/stax#890 ·