Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

Reject negative descriptors in single-descriptor readiness helpers

Open Beginner friendly
#710 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
75/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
linux, rust

Research direction

The issue is in std/net/poll.wave, specifically the functions net_wait_readable, net_wait_writable, and net_wait_connected. Start by examining the Linux poll handling in that file. Add validation to reject negative file descriptors (return -9). Ensure infinite timeout does not cause indefinite wait. Write a regression test using the provided reproduction script, and verify that normal behavior and disabled entries in net_poll are preserved.

Written by the indexing model from the issue text.

Description

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.

Dominant language
Rust
Stars
53
Forks
16
Avg merge
3h 38m
Merged PRs (30d)
48

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from wavefnd/Wave

All issues in wavefnd/Wave

Similar issues

More Rust issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.