Repository navigation
fix(cli): rvt-dump takes the resource-limit options and goes on past a stream it cannot read, rvt-info refuses a preview that is not a whole PNG, and gen-fixture refuses a name with a path in it (#1885) - #1906
Merged
Conversation
…a stream it cannot read, rvt-info refuses a preview that is not a whole PNG, and gen-fixture refuses a name with a path in it (#1885)
DrunkOnJava
marked this pull request as ready for review
November 13, 2026 11:37
Owner
Author
|
Approved at b468e6d by the review bot as a self-approval, under Griffin's answer of 2026-11-12 ("You are allowed to self-approve"): rvtDevelop's session has not read the head sent to it at about 11:50 UTC. I re-read the whole diff (rvt-dump's limits, the report and exit 3, the per-stream release and the Bytes enum, the IEND check, the separator check, the three end-to-end tests) as if another session had written it. The push since the tests ran is the merge of main after #1893 landed; the PR's own diff against main is the six files. |
This was referenced Nov 13, 2026
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.
Summary
Items 12, 13 and 14 of #1885, the three that are neither the write path (#1893) nor the CLIs' shared output rules (#1891, landed):
rvt-dumptakes the resource-limit options and goes on past a stream it cannot read,rvt-info --extract-previewrefuses a preview that is not a whole PNG, andgen-fixturerefuses a name with a path in it. Part of #1885; the issue closes when #1893 has landed too.Motivation
Batch 5's audit of the CLIs that write files (main at
e57db423; each finding confirmed by a second reader):rvt-dumpopened every file under the default limits, so one stream over 256 MiB stopped the whole dump with an error and no option changed it (rvt_dump.rs:59,72); and it kept every inflated partition in the reader's memo though it writes them one at a time (reader.rs:965-968; the memo's budget is 16 GiB).--extract-previewwrote what the stream held from the PNG signature on and said "preview PNG written", when a preview cut short has no IEND chunk (rvt_info.rs:156-159).gen-fixture NAMEwith no--outputwrotetests/fixtures/synthetic-NAME.rvt, so--name ../xwrote outside the folder (gen_fixture.rs:161-164). A developer tool and the user's own argument; low.Changes
src/bin/rvt_dump.rs:--max-stream-bytes,--max-inflate-bytes,--large-modeland--allow-partialasrvt-gltfhas them (rvt::cli::open_limits,unread_stream_report); a stream over the limit prints "not read: over the stream limit" and the dump goes on; at the end the reader's list of what a limit left unread goes to stderr and the exit status is 3 unless--allow-partial. A partition is written from the reader's shared buffer, not a copy, andRevitFile::release_inflated_partitions(waspub(crate), nowpub) runs after each stream.src/bin/rvt_info.rs:ends_with_iend; a preview without an IEND chunk is not written, and the command exits 1 saying the preview is cut short.src/bin/gen_fixture.rs: a name with/or\is refused when it would become a file name undertests/fixtures.tests/cli_ergonomics.rs(three tests, appended),src/reader.rs(the method's visibility and doc),changelog.d/fixed/1885-dump-preview-fixture.md.Testing
Unit tests are banned in this repository; each check is end to end through the built binaries, on a file
gen-fixturemakes:rvt_dump_lists_a_stream_over_the_limit_and_dumps_the_rest: with default limits the dump exits 0 with nothing on stderr; under--max-stream-bytes 100it exits 3, listsBasicFileInfoas not read, writes no file for it, dumps the preview stream after it, and reports the unread streams and--allow-partialon stderr; with--allow-partialit exits 0.extract_preview_writes_a_whole_png_and_refuses_one_cut_short: the fixture's preview comes out as a PNG ending in IEND; the same file with its preview stream replaced by a PNG signature and half an IHDR chunk exits 1, says "cut short" and writes nothing.gen_fixture_name_with_a_path_in_it_writes_nothing:../escape,a/banda\bexit 1 with "path separator" and make no folder;plainwritestests/fixtures/synthetic-plain.rvtunderCARGO_MANIFEST_DIR.Not measured: the memory
rvt-dumpsaves by dropping each partition after it is written (no peak was recorded before or after; the saving is by construction, one inflated partition at a time instead of all of them).Audit-honesty checklist
rvt-dump --helpandrvt-info --helpare the docs of these options)changelog.d/fixed/Legal and contribution hygiene
Breaking changes
rvt-dumpexits 3 where a resource limit left a stream unread (it used to stop with exit 1 on a stream over the stream limit, and exit 0 on a partition cut short by an inflate limit);--allow-partialrestores 0.rvt-info --extract-previewexits 1 for a preview cut short, where it wrote the bytes.RevitFile::release_inflated_partitionsis a new public method.Related issues
Part of #1885 (items 12 to 14).