Repository navigation
docs(logging,pcap): correct the per-frame logging note; pin Frame.read cap_len (#2236) - #2250
Merged
Merged
Conversation
…d's cap_len (#2236) Problem: the logging.rst DEBUG note said nothing is logged inside per-frame loops, but PyShark logs each skipped non-packet tshark record and reassembly logs each buffer abandoned on timeout. The Frame.read comment said no test pins the cap_len argument and reverting it leaves the suite green, yet a frame cut inside its IPv4 header warns "packet length < 0" only with cap_len. Fix: the note says no record is logged per frame parsed or field read, and names the two per-dropped-item lines. The comment states what the length does for the schemas and why, and names the test that pins it. Test: test_frame_read_cap_len_2236_unit asserts the SchemaWarning for that frame, identical to an uncut frame of the same octets; it fails when the argument is reverted to frame.len.
Owner
Author
|
Review: GOOD TO GO at
|
Contributor
|
Coverage: 91.56% (unit tier, Python 3.15,
Per-file detail: the |
Owner
Author
|
Ready to merge at
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
make testpasses, and a test case covers the changeWhat is the purpose of your pull request?
docs— documentation onlyDescription
Closes #2236.
logging.rst: "What DEBUG Will Tell You" says no record is logged per frame parsed or per field read. It names the two lines that fire per dropped item: PyShark'sskipping tshark frameand reassembly'sabandoning buffer. No other per-framelogger.debugorlogger.infoexists.Frame.read: the false "no test pins this line" comment is gone. The comment now states whycap_lenis passed: the schemas count down from it, so a truncated header warns. It cites the new test.test_truncated_ipv4_header_warns_whatever_the_on_wire_lengthbuilds Ethernet plus 10 IPv4 octets withorig_len154. It assertspacket length < 0: -10is warned, the same as for an uncut record.frame.len, the test fails ('packet length < 0: -10' not found in []).tests/protocols/misc/pcap,tests/utilities/test_logging.pyand the frame-length readers give 300 passed. The docstring contract, tier guard andtest_docs_*give 208 passed.