diff&cmp not suitable to be called as library functions.

オープン
#280 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

評価

難易度
4/5
見積もり時間
3〜5日
初心者へのやさしさ
64/100
issue の種類
機能追加
明瞭さ
おおむね明確
活発さ
活発
技術スタック
rust
領域
api, cli

調査の方向性

まず diff.rs と cmp.rs を確認し、次にトップレベルの main 関数とリンクされた修正コミットを調べて、現在の ExitCode と exit() の動作を確認します。テストがどのように構成されているかを確認し、プロセスを終了させずにエラーを返すケースのカバレッジを追加します。完了の条件は、両方のコマンドが引き続きビルド可能で、ライブラリの呼び出し元が適切な i32 の結果を受け取り、プロセスの終了を処理するのがトップレベルの main 関数だけであることです。

索引モデルが issue の本文から書いたものです。

説明

Problems with using diffutils.rs as a library:

  1. 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.
  2. 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:

  1. Replace the ExitCode/exit() convention with i32 returns, everywhere except at the very top main function.
  2. 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分
マージ済み PR(30日)
3

コントリビューションガイド

コントリビューションガイドを開く

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

uutils/diffutils のほかの issue

uutils/diffutils の issue をすべて見る

似ている issue

Rust の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。