Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

Make zero-length Unix stream reads return without blocking or reporting EOF

オープン 初心者向け
#990 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

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

評価

難易度
2/5
見積もり時間
1〜3時間
初心者へのやさしさ
90/100
issue の種類
バグ
明瞭さ
明確に書かれている
活発さ
活発
技術スタック
linux, rust

調査の方向性

std/net/unix.wave の unix_read から始め、そのゼロサイズの扱いを TCP およびベクタ化読み取りヘルパーと比較してください。既存のサイズとバッファーの検証を維持し、要求されたサイズがゼロの場合は、OS の読み取りを行う前に、カウントがゼロで EOF ではない成功結果を返してください。空のストリーム、キュー内のデータ、およびピア側のクローズをカバーする socketpair の回帰テストを追加し、O0 と O2 で結果を確認してください。

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

説明

bug good first issue

Problem

unix_read always calls recv and interprets a zero result as EOF, even when the caller requested zero bytes. On Linux a zero-length recv on an empty blocking stream can wait for data; once data is queued it returns zero, which Wave incorrectly labels as peer closure. The TCP result and vectored helpers already distinguish zero-sized requests.

Starting point: unix_read.

Reproduction

Audited canonical master 540728c2eb6cc12f5c69c3fb3fdb96e07ba059a4 on Linux amd64 with a checkout-built Wave 0.0.1-alpha-dev, matching checkout std, Rust 1.89.0 and LLVM 21.1.8. Compile this at O0 and O2:

import("std::net::unix")::{UnixStream,unix_read};
import("std::net::error")::{NetIoResult};
fun main() -> i32 {
    var r: NetIoResult = unix_read(UnixStream { fd: 3 }, null, 0);
    println("count={} eof={} kind={}", r.count, r.eof, r.error.kind);
    return 0;
}

Execute from Python with an inherited local socketpair (descriptor 3 in this minimal harness):

import socket, subprocess
left, right = socket.socketpair()
try:
    assert left.fileno() == 3
    right.send(b'x')
    result = subprocess.run(['./repro'], pass_fds=(3,), capture_output=True,
                            text=True, timeout=2)
    print(result.stdout)
    print(left.recv(1))
finally:
    left.close()
    right.close()

Both optimization levels print count=0 eof=1 kind=10; the subsequent Python read still receives b'x' and the peer was never closed. Omitting the send made the subprocess hit the two-second timeout. No external communication was used.

Scope

Preserve invalid-size/buffer validation, then return a successful zero-count, non-EOF result without an OS read for size zero. Keep EOF behavior for nonempty reads after real peer closure. Difficulty: small localized change with a real socketpair regression.

Completion criteria

  • Zero-length reads return immediately with count 0, eof false and no error on an open empty stream.
  • Null buffers are allowed for zero bytes; negative sizes and nonempty null buffers remain invalid.
  • Queued data is preserved and real nonempty EOF still reports EOF at O0/O2.
主要言語
Rust
スター
56
フォーク
21
平均マージ
10時間 10分
マージ済み PR(30日)
52

環境構築

はじめの一歩

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

wavefnd/Wave のほかの issue

wavefnd/Wave の issue をすべて見る

似ている issue

Rust の issue をもっと見る

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

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