Skip to content

fix(pcapng): option-guard messages end in a full stop and give the block type as a number #2301

Closed

Description

@JarryShaw

Describe the bug
The PCAP-NG option guards (_make_option_* and _read_option_*, the "must be only one" and "must be in X Block" checks) end in a full stop, which no other <prefix>: … message does (#2232, #2257). The placement guard is worse than a style slip: it formats self._type, an IntEnum, with {}, so the message gives the block type as a bare number.

Reproduction (main 9d504ead5)

>>> p._type = BlockType.Enhanced_Packet_Block; p._make_option_if_name(OptionType.if_name, name='eth0')
ProtocolError: PCAP-NG: [if_name] option must be in Interface Description Block, but found in 6 block.
>>> p._type = BlockType.Interface_Description_Block; p._opt[OptionType.if_name] = 1; p._make_option_if_name(...)
ProtocolError: PCAP-NG: [if_name] option must be only one, but 2 found.

Expected behavior
PCAP-NG: [if_name] option must be in Interface Description Block, not Enhanced_Packet_Block and PCAP-NG: [if_name] option must be only one, not 2. Use .name for the block. Pins to update: test_pcapng_roundtrip_unit matches option must be only one, but 2 found, and test_pcapng_unit checks [<option>] option must be only one with assertIn.

System information
Linux, CPython 3.14.9, checkout main 9d504ead5.

Activity

  1. added this to the PyPCAPKit v1.5 milestone on Oct 26, 2026
  2. added
    bugIssues reporting a defect (set by the bug report template; a default, not an assessment)
    on Oct 26, 2026
  3. moved this to Pending in PyPCAPKiton Oct 26, 2026
  4. JarryShaw commented on Oct 26, 2026

    @JarryShaw
    OwnerAuthor

    Blocked until the #2273 and #2278 fix PRs merge. Those fixes edit the PCAP-NG makers in pcapng.py, and this one edits the same file, so it starts from the merged tree.

  5. added
    blockedDeferred pending another issue or decision; see the last comment for what unblocks it
    on Oct 26, 2026
  6. moved this from Pending to Blocked in PyPCAPKiton Oct 26, 2026
  7. added
    pendingAccepted and unstarted - nobody is on it and nothing blocks it
    and removed
    blockedDeferred pending another issue or decision; see the last comment for what unblocks it
    on Oct 27, 2026
  8. JarryShaw commented on Oct 27, 2026

    @JarryShaw
    OwnerAuthor

    Unblocking — #2273 and #2278 merged. Open to pick up now.

  9. 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 27, 2026
  10. moved this from Blocked to WIP in PyPCAPKiton Oct 27, 2026
  11. removed
    wipWork in flight - a covering PR is open or an agent is actively on it
    on Oct 27, 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