Skip to content

fix(foundation): a Windows pipe passes seekable(), so its peeked octets are lost #2097

Closed

Description

@JarryShaw

The first Windows run of #2095's leg (job 120605026883) fails 25 pipe cases in test_extraction_non_seekable_stream_1586_unit, including pcapkit - reading from stdin. PCAP reads its magic as b'\x02\x00\x04\x00', which is the version bytes at offset 4, so the bytes the peek consumed are lost.

Inferred, not yet probed on a runner: on a Windows pipe, seekable() returns True and seek silently does nothing. The Extractor.__init__ branch then skips the SeekableReader wrapper, and PeekableStream.peek's seek-back never rewinds. A one-line probe on the leg would confirm it.

Proposed: trust seekable() only for a regular file (stat.S_ISREG(os.fstat(fileno).st_mode)), and otherwise wrap in SeekableReader. This is a user-visible defect, so it blocks #2060 phase 2.

Activity

  1. added
    bugIssues reporting a defect (set by the bug report template; a default, not an assessment)
    pendingAccepted and unstarted - nobody is on it and nothing blocks it
    on Oct 23, 2026
  2. moved this to Pending in PyPCAPKiton Oct 23, 2026
  3. added
    wipWork in flight - a covering PR is open or an agent is actively on it
    and removed
    pendingAccepted and unstarted - nobody is on it and nothing blocks it
    on Oct 23, 2026
  4. moved this from Pending to WIP in PyPCAPKiton Oct 23, 2026
  5. removed
    wipWork in flight - a covering PR is open or an agent is actively on it
    on Oct 23, 2026
  6. added this to the PyPCAPKit v1.5 milestone on Oct 26, 2026
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

    bugIssues reporting a defect (set by the bug report template; a default, not an assessment)

    Projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions