Skip to content

docs: pcapng.py generator cites line 1376 for a self.entry split that is at 1840, and may describe a fixed defect #791

Description

@JarryShaw

Describe the bug

examples/generators/pcapng.py:410-413 explains why its fixture adds a trailing newline, and cites the defect location:

The underlying defect is pcapkit/protocols/schema/misc/pcapng.py:1376 splitting self.entry without first stripping the block padding.

:1376 is wrong, and the code it describes may no longer exist at all. Measured on ef859f776:

$ git show origin/main:pcapkit/protocols/schema/misc/pcapng.py | grep -n "self.entry"
1805:            Entries used to be split apart with ``self.entry.split(b'\n\n')``
1840:        total = len(self.entry)
1841:        entry_data = io.BytesIO(self.entry)

So two things are stale, not one:

  1. The line number. Nothing about self.entry is at :1376; the relevant code is at :1840-1841.
  2. Possibly the mechanism. :1805 describes the self.entry.split(b'\n\n') approach in the past tense — "Entries used to be split apart with" — and the current code reads the entry through io.BytesIO instead. If the split-without-stripping defect is genuinely gone, the comment is not merely mis-citing, it is describing a defect that no longer exists and justifying a fixture workaround that may no longer be needed.

Expected behavior

The comment should cite the real location, or say plainly that the defect was fixed and why the fixture keeps the newline anyway. Whoever takes this should establish which of the two cases holds before editing the prose — that is the actual work here, not the line number.

Additional context

Found by the cross-review on #790, while sweeping for other copies of that PR's stale claims. This is a recurring defect class rather than a one-off: #756 was the same shape in extraction.py, and #785 in test_pcapng_end_to_end.py — which is why #790 now frames its retained number as a dated measurement rather than a fact. A cheap general guard would be worth considering as a follow-up: a test that greps prose for path.py:N citations and checks the cited line still contains the named construct.

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

    bugdocsPull requests that change documentation only (docs: subject prefix)

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions