Skip to content

rvt-write dry run and framing checks, rvt-info CSV formulas, rvt-ifc overwriting its input, and rvt-dump output #1885

Closed

Description

@DrunkOnJava

Batch 5's audit of the write path and the CLIs that write files (main at e57db42), each finding confirmed by a second reader unless marked; items 1, 2, 8 and 9 were also re-read by the maintainer session.

rvt-write and writer.rs

  1. --patches is required even with --dry-run. rvt_write.rs:198 unwraps --patches before looking at dry_run, so the manifest-less dry run the flag's help documents (:60-71, "Required unless --dry-run is set") is unreachable.
  2. --dry-run exits 0 without checking the streams exist. The help says it exits 0 when "every listed stream exists in src"; :212 prints the patches and returns without looking, and without the writer's own refusals (writer.rs:206-217).
  3. The manifest alone picks a stream's on-disk framing (writer.rs:197, :705), and verification reads back with the same framing, so a Formats/Latest written with the wrong framing passes. Fix: check the framing against the stream's convention (writer.rs:144-159 documents it) and refuse a mismatch. (medium)
  4. A pad-only base64 value ("=") decodes to zero bytes and silently empties the stream (rvt_write.rs:137). Fix: refuse an empty decode unless the manifest says so.
  5. An empty patches array writes the copy and then exits 1 with "0 stream(s) failed verification" (writer.rs:613, rvt_write.rs:232-248).
  6. --src X --dst X skips both fast paths and rebuilds the container in place, contradicting the byte-for-byte promise for a patch-free copy (writer.rs:223-224, :280). (The second reader refuted the claim that the source is destroyed: RevitFile::open reads the whole file into memory first, reader.rs:471-473.)
  7. The empty-patch fast path leaves .<dst>.copy-<pid> behind when the copy or rename fails (writer.rs:294-297), against the module doc (:37-38).

Other CLIs

  1. rvt-info -f csv writes file text as spreadsheet formulas. csv_field (rvt_info.rs:594-599) quotes commas and quotes but leaves a leading =, +, - or @, so a PartAtom title or user name from a crafted file runs as a formula when the CSV is opened. Fix: prefix such a field with '.
  2. rvt-ifc model.rvt -o model.rvt overwrites the input (rvt_ifc.rs:286-290, sink :348), with no check that the output is not the input.
  3. With --observation, rvt-ifc skips the atomic .partial + rename (rvt_ifc.rs:348 against :353-366), so a killed export leaves a truncated .ifc under the final name.
  4. rvt-dump prints stream names as they are (rvt_dump.rs:98-114), so control characters in a crafted name reach the terminal. (The second reader marked this unsure only for what a terminal does with them; the code path is as stated.) Fix: print names with escape_debug, as file_stem_for already sanitises them for file names.
  5. rvt-dump keeps every inflated partition in the reader's memo (rvt_dump.rs:80, reader.rs:965-968) though it needs one at a time, and one stream over the default 256 MiB limit aborts the whole dump with no --max-stream-bytes option (:59, :72).
  6. --extract-preview writes a file that starts with PNG magic but may lack IEND and calls it a PNG (rvt_info.rs:156-159).
  7. gen-fixture --name ../x writes outside tests/fixtures (gen_fixture.rs:161-164). Developer tool, the user's own argument; low.

No export moves.

Activity

  1. added
    area:cli
    area:writer
    priority:P2
    type:bug
    on Nov 13, 2026
  2. DrunkOnJava commented on Nov 13, 2026

    @DrunkOnJava
    OwnerAuthor

    All fourteen items are on main: items 8 to 11 as #1891 (the CLIs refuse to write over their input under any name, CSV cells, control characters in stream names, the atomic observation write), items 1 to 7 as #1893 (rvt-write --dry-run checks what the write would refuse, the framing check, the empty base64 and empty patch cases, the file onto itself and the temporary file), and items 12 to 14 as #1906 (rvt-dump takes the limit options, goes on past a stream over the limit and releases each partition once written; rvt-info --extract-preview refuses a preview with no IEND chunk; gen-fixture refuses a name with a path separator). The memory rvt-dump saves by releasing partitions is by construction and was not measured; that is stated in #1906 and its changelog entry.

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

    area:cliarea:writerpriority:P2type:bug

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions