Make zero-length Unix stream reads return without blocking or reporting EOF
Los mantenedores suelen responder en 1 día
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 2/5
- Tiempo estimado
- 1-3 horas
- Aptitud para principiantes
- 90/100
- Tipo de issue
- Error
- Claridad
- Bien especificado
- Estado de actividad
- Activo
- Stack tecnológico
- linux, rust
- Área
- networking, operating-systems
Línea de trabajo
Comienza por unix_read en std/net/unix.wave y compara su tratamiento del tamaño cero con los helpers de lectura de TCP y vectorizada. Conserva la validación existente del tamaño y del búfer y devuelve un resultado correcto con recuento cero y sin EOF antes de cualquier lectura del SO cuando el tamaño solicitado sea cero. Añade una prueba de regresión de socketpair que cubra un stream vacío, datos en cola y el cierre del par, y verifica el resultado con O0 y O2.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
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.
- Lenguaje dominante
- Rust
- Estrellas
- 56
- Forks
- 21
- Merge medio
- 7 h 55 min
- PR fusionados (30 d)
- 56
Preparar el entorno
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de wavefnd/Wave
-
Validate CI command vectors before indexing Cargo subcommandsPosiblemente ocupada @amandeavor la tomó hace 1 día. Abiertobug ci good first issue
Dificultad 2/5 1-3 horas Aptitud para principiantes 88/100
Los mantenedores suelen responder en 1 día
-
bug good first issue
Dificultad 2/5 1-3 horas Aptitud para principiantes 76/100
Los mantenedores suelen responder en 1 día
-
bug good first issue
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
Los mantenedores suelen responder en 1 día
-
build good first issue
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
Los mantenedores suelen responder en 1 día
-
discussion enhancement help wanted
Dificultad 5/5 Más de una semana Aptitud para principiantes 35/100
Los mantenedores suelen responder en 1 día
Todos los issues de wavefnd/Wave
Issues similares
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 83/100
manuscript-lang/manuscript#1629 ·
Los mantenedores suelen responder en 1 día
-
autofixer: follow-up
Dificultad 2/5 1-3 horas Aptitud para principiantes 76/100
tursodatabase/turso#10885 ·
Los mantenedores suelen responder en 1 día
-
🐞 bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 75/100
nannou-org/gantz#475 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 62/100
-
bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
Los mantenedores suelen responder en 1 día