Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

Reject negative descriptors in single-descriptor readiness helpers

Aperta Adatta ai principianti
#710 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
2/5
Tempo stimato
1-3 ore
Idoneità per principianti
75/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
linux, rust

Direzione di ricerca

Il problema si trova in std/net/poll.wave, specificamente nelle funzioni net_wait_readable, net_wait_writable e net_wait_connected. Inizia esaminando la gestione di poll di Linux in quel file. Aggiungi una validazione per rifiutare i descrittori di file negativi (restituire -9). Assicurati che un timeout infinito non causi un'attesa indefinita. Scrivi un test di regressione utilizzando lo script di riproduzione fornito e verifica che il comportamento normale e le voci disabilitate in net_poll siano preservati.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

bug good first issue needs testing

Problem

On Linux, net_wait_readable, net_wait_writable, and net_wait_connected in std/net/poll.wave return a timeout result for a negative descriptor instead of a bad-descriptor error. Linux poll ignores negative entries. Source inspection therefore also indicates an indefinite-wait risk with an infinite timeout; the executed reproduction below uses a zero timeout.

Reproduction

Save as repro.wave:

import("std::net::poll")::{net_wait_readable};
fun main() -> i32 {
    if (net_wait_readable(-1, 0) == -9) { return 0; }
    return 1;
}

From the repository root, stage the matching std and run:

audit_home="$(mktemp -d)"
mkdir -p "$audit_home/.wave/lib/wave"
cp -R std "$audit_home/.wave/lib/wave/std"
HOME="$audit_home" target/release/wavec build repro.wave -O0 --run
HOME="$audit_home" target/release/wavec build repro.wave -O2 --run

Tested at 01955d715dda275de993948037091140bb859174 on Fedora Linux 43, x86_64, with LLVM 21.1.8, at both -O0 and -O2.

Expected: the helper returns -9 and the program exits 0. Actual: it returns 0 and the program exits 1, with no output. The other two helpers behave the same way. An invalid positive descriptor (2147483647) correctly returns -9 in all three helpers.

Scope

Validate negative POSIX descriptors at the single-descriptor helper boundary. Preserve the disabled-entry behavior of generic net_poll on POSIX targets. Windows uses Winsock socket handles rather than POSIX descriptors; do not infer its validation or error mapping from this Linux reproduction. Platform error classification in #508 is separate.

Completion criteria

  • All three helpers return -9 immediately for negative descriptors on Linux, including with an infinite timeout; bound the regression process with an external timeout.
  • Add regressions for negative and invalid positive descriptors.
  • Preserve normal readable, writable, and timeout behavior, and disabled entries in POSIX net_poll.

Difficulty: easy.

Lingua principale
Rust
Stelle
53
Fork
16
Merge medio
3h 38m
PR unite (30g)
48

Guida per i contributori

Apri la guida per i contributori

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di wavefnd/Wave

Tutte le issue di wavefnd/Wave

Issue simili

Altre issue su Rust

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.