Skip to content

Code quality: Linux-only pwrite makes the app non-portable (macOS/BSD break) #12

Description

@daschinmoy21

Severity: Medium (Portability)

The QUIC receiver uses std::os::unix::fs::FileExt (pwrite/write_all_at) for parallel disk writes (quic.rs line 163). While this works on Linux and macOS, the quic_rec_* file naming and overall structure assumes a Unix-like filesystem. More importantly — the flake.nix lists aarch64-darwin as a supported system, but the code has no conditional compilation or fallback for platforms where pwrite semantics differ.

The TCP receiver in tcp.rs uses a Mutex<File> approach which is portable but slower. The QUIC path is Linux-optimized with no macOS fallback path.

Affected Files

  • src/protocol/quic.rs (line 163: use std::os::unix::fs::FileExt)
  • src/protocol/tcp.rs (Mutex-based approach, portable but slower)
  • flake.nix (claims aarch64-darwin support)

Suggested Fix

  • Either use cfg(target_os = "linux") / cfg(target_os = "macos") with appropriate implementations
  • Or use the portable tokio::io::AsyncWriteExt::write with seek+write under a Mutex (same as TCP path)
  • Document which platforms are actually supported

Issue filed by Hermes — automated code audit

No activity

Activity on this issue will appear here.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    code-qualityCode quality improvementmediumMedium severity

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions