Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
15 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 26 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,32 @@ project uses [semantic versioning][semver].
compared names with `normcase`, which folds case on Windows only, so a
copied `a001_Reports/` and a job named `A001` shared one folder on APFS. It
now uses the flatten collision check's casefolded, NFC-normalized key.
- **A filename could run as a formula in the CSV report.** A cell starting
with `=`, `+`, `-`, `@`, a tab, a carriage return, a line feed or a
full-width `=`, `+`, `-` or `@` (a file called
`=HYPERLINK(...)`, or media metadata) was evaluated when the CSV was opened
in a spreadsheet. Such text cells now carry a leading apostrophe; numbers and
the header are unchanged. The `resolve --csv` table gets the same treatment.
- **The ASC MHL chain file was rebuilt from scratch on every write.** It
rehashed whatever generations were on disk, so a generation that had been
edited or bit-rotted got a fresh, matching C4 and a deleted one silently left
the chain. The chain is now append-only: recorded entries are kept as they
were, and a generation that is missing or no longer matches, or a missing
chain (rebuilt), adds a job warning. The chain is replaced atomically through
a uniquely named, exclusively created temporary file (nothing that already
exists is opened or removed), so a failed write keeps the old one. The
temporary file is given an existing chain's access before any content: its
owner, group, access list and permission bits on POSIX, its access rules on
Windows. It is never wider than the chain (on macOS it is created refusing
the entries its folder hands down), and the chain is readable by the
same people afterwards; where that cannot be reproduced, or an access list
cannot be read, the old chain is kept. (On Windows, when the replace may not merge the rules, the update
still goes through with the copy of them made when it began, with a
warning), and a chain path
close to the Windows limit no longer fails on its longer temporary name. Sequence numbers never reuse a
number the chain records, compared by value (`0002` is 2). A chain that cannot be read (left untouched) or written
leaves the new generation unrecorded, which is a report failure: the job
reads `Verified, reports failed` and the CLI exits 5.
- **A timeline offload could call a partial cut complete.** With nothing to
copy it printed "every reference is already here" and exited 0 while
references were missing or ambiguous, and with gaps to copy it reported
Expand Down
6 changes: 5 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,11 @@ which is why it is opt-in. See
with per-file verdicts.
- **CSV**: one row per source/destination pair, with checksums, media
metadata, the slate from whichever department wrote it (camera or sound), and
status. For spreadsheets and ingest scripts.
status. For spreadsheets and ingest scripts. A text cell that begins with
`=`, `+`, `-`, `@`, a tab or a carriage return (a filename off a card can)
is written with a leading apostrophe so a spreadsheet shows it as text
instead of running it as a formula; a script reading the CSV will see that
apostrophe. Numbers and the header row are unchanged.
- **MHL** — Media Hash List 1.1, paths relative to the file's own directory so
it travels with the media. Written per destination.
- **ASC MHL** — the format the ASC publishes and ARRI recommends. A numbered
Expand Down
61 changes: 61 additions & 0 deletions docs/ascmhl.md
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,67 @@ The chain file identifies each manifest by its C4 ID (SMPTE ST 2114): a SHA-512
digest in base58, prefixed `c4`, always 90 characters. It is also available as a
file checksum in its own right — `--hash c4`.

The chain is **append-only**. Each generation's entry is written once, when the
generation is, and pins that manifest's C4 ID as it stood then. Writing the next
generation keeps every recorded entry exactly as it is and appends only the
generations that have none. It does not rehash what is on disk and rewrite the
record, which would hand a manifest that was edited or bit-rotted a fresh,
matching C4 and let a deleted one vanish from the chain.

The file is replaced atomically: the new chain is written to a uniquely named
temporary file in the `ascmhl/` folder, created exclusively so that nothing
already there is opened, followed or removed, and moved over the old one. A
failed write (a full disk) leaves the existing chain exactly as it was, and
only a temporary file this write created is cleaned up. Over an existing
chain the temporary file is given that chain's access before any content goes
into it: its owner, group, access list and permission bits on POSIX, its access
rules on Windows. Permission bits alone do not say who can read a file, so
copying only those would change the chain's readers whenever the new file's
group or its folder's defaults differ. The file is never more accessible than
the chain it replaces, and the chain is readable by the same people afterwards.
It is created open to its owner alone; on macOS, where an entry a folder hands
down is granted regardless of those bits, it is created refusing inheritance,
so it takes nothing from its folder even for a moment. A failure to read an
access list is an error, never taken to mean there is none.
When that access cannot be reproduced (on POSIX, a chain owned by another
user, whose ownership only that user or root can give a file) the update is
refused, the old chain is kept and the job reports the failure. A new
history's file gets the ordinary creation mode. On Windows the chain is then replaced with `ReplaceFileW`, which keeps
the access rules set on the file itself (when the user may write the chain but
not change its permissions, the update still goes through with the copy of
the rules made when it began, and a job warning says so). The replace is always given a backup name, so each failure it documents
leaves the old chain in place or puts it back. Long paths are handled:
the temporary name is longer than the chain's, and it is opened through the
extended-length form. A
new generation's sequence number is above both the highest manifest on disk
and the highest number the chain records, so a number is never reused, even
after a generation file is deleted. Numbers are compared by value, so a
recorded `0002` blocks a file numbered 2; the recorded text is written back
unchanged. A recorded number that is not an integer is kept as written and
reported in a warning.

Where the chain and the disk disagree, the entry is kept and the job gets a
warning, which the terminal prints and the app shows when the job ends (the
PDF, HTML and CSV reports do not print job warnings):

- a recorded generation's file is missing, or hashes to something other than
its recorded C4: the chain no longer matches it;
- a manifest on disk is not in the chain by name, but its number is already
recorded for a different file: the chain is kept as recorded and the file is
not added;
- the chain file is missing while earlier generations exist: a new chain is
written for the generations present, and those earlier ones are attested only
from now.

When the new generation cannot be recorded at all, because the chain file
exists but cannot be read (it is left byte for byte as it was) or the
replacement could not be written, that is a report failure, not a warning: the
generation file is still listed as written, the job reads
`Verified, reports failed` and the CLI exits `5`.

`offloader verify` does not read the chain file yet, so a tampered or missing
generation is reported at write time only; verification does not check it.

## Verification

`offloader verify` reads ASC MHL histories as well as classic MHL:
Expand Down
2 changes: 2 additions & 0 deletions docs/data-safety.md
Original file line number Diff line number Diff line change
Expand Up @@ -484,6 +484,8 @@ and a job named `A001` are one folder on APFS.
| Metadata that will not parse | The file still copies and verifies; only its metadata is lost, and the job carries a warning. |
| A directory symlink or junction in the source | Never entered, and each one skipped is named in a warning. Nothing under it was copied, so it fails the job like a folder that could not be listed: the CLI exits `1` and each manifest gets an unhashed entry for it. A junction pointing at its own parent cannot loop, and an alias listed before its target (`A_alias -> Z_real`) can no longer claim the real folder: the real folder is always scanned under its real name. Cloud-storage placeholder folders are reparse points too but are real folders, so only links (name-surrogate reparse points) are skipped. |
| A manifest whose digests are uppercase | Compared case-insensitively for hex formats, exactly for C4. Another tool's casing is not corruption. |
| A filename or metadata value that a spreadsheet would run as a formula | A CSV cell (job name, name, path, error, any media metadata) starting with `=`, `+`, `-`, `@`, a tab, a carriage return, a line feed, or the full-width forms of `=`, `+`, `-` and `@` (U+FF1D, U+FF0B, U+FF0D, U+FF20) is written with a leading apostrophe, so opening the report cannot execute it. A script reading the CSV sees the apostrophe. |
| An ASC MHL chain that cannot be read or written | The chain is replaced atomically through a unique, exclusively created temporary file (an existing file or symlink is never opened or removed; before any content goes into it the temporary file is given the existing chain's access: its owner, group, access list and permission bits on POSIX, its access rules on Windows; it is never open to anyone the chain is not, and the chain is readable by the same people afterwards. Where that access cannot be reproduced (on POSIX, a chain owned by someone else) the update is refused and the old chain kept. On Windows, when the replace is denied the right to merge the rules, the update still goes through carrying the copy of them made when it began, and adds a job warning; long paths are handled), so a failed write keeps the old chain, and an unreadable chain is left untouched. The new generation then has no chain entry, which is a report failure: the job reads `Verified, reports failed` and the CLI exits `5`. Sequence numbers never reuse one the chain records, compared by value. |
| A filename XML or UTF-8 cannot carry | Filtered to U+FFFD in manifests and CSV, so one bad name cannot strand a delivery's paperwork. |
| A malformed chunk in a broadcast WAV | The walk advances on every step and is bounded, so a truncated file cannot hang it; the payload is capped, so a corrupt size field is not an allocation. The file still copies and verifies. |
| An `iXML` chunk carrying a doctype | Refused outright, closing billion-laughs entity expansion and XXE. No recorder writes one. See [`ixml.md`](ixml.md). |
Expand Down
Loading
Loading