Skip to content

PdfCraft: An open-source PDF reader and editor written by scratch in pure Rust

M1: reject partial resource-fork copies and integrate current main

PerchAntonc378af9ea8d7
diff --cc ROADMAP.md
index 26aacb980,40a9d8c56..b043459a1
--- a/ROADMAP.md
+++ b/ROADMAP.md
@@@ -1,9 -1,8 +1,10 @@@
# PdfCraft roadmap
- > **Last reviewed:** 2026-10-18 · **Last updated:** 2026-10-18 · **Change:** minor (PR #3042: integrated upstream d8b27058 while retaining this fix and upstream progress; estimates unchanged)
++> **Last reviewed:** 2026-10-18 · **Last updated:** 2026-10-18 · **Change:** minor (M1, #2658: reject partial extended-attribute copies after a size change; estimates unchanged)
+
**Stage: alpha** · next: beta, ~25% (ready for real work 50% → 75%) and ~400–700 h away
+ > **Last reviewed:** 2026-10-18 · **Last updated:** 2026-10-18 · **Change:** minor (M3, #3149: discard render demand after page geometry changes and check the GPU texture limit before upload; estimates unchanged)
> **Last reviewed:** 2026-10-18 · **Last updated:** 2026-10-18 · **Change:** minor (M8, #1350: named replacement descriptions retired during Sanitize and across shared resources; estimates unchanged)
> **Last reviewed:** 2026-10-15 · **Last updated:** 2026-10-15 · **Change:** minor (M6: AcroForm XML text; estimates unchanged)
> **Last reviewed:** 2026-10-15 · **Last updated:** 2026-10-15 · **Change:** minor (M2/gap 12: the Annex D.2 alias codes read as the ink they draw in both tables; the text oracle scores reading order; estimates unchanged) · **Target:** Adobe Acrobat Pro (Acrobat DC, continuous track 26.002.21931, macOS)
@@@ -163,8 -162,7 +164,10 @@@ Ranked; detail and the full milestone t
| 8 | 1.0 polish: performance, right-to-left, missing languages, keyboard-only (M14) | 55–95 |
## Progress log
+
- - **2026-10-18 (PR #3042, upstream refresh):** Integrated main `d8b27058` while retaining this PR's fix, regression coverage and upstream progress. Estimates unchanged.
++- **2026-10-18 (M1, #2658):** Atomic macOS saves recheck attribute sizes after reading, so a partial resource-fork read cannot publish truncated metadata. A deterministic growth regression preserves the original PDF and grown fork. Estimates unchanged.
++- **2026-10-17 (M1, #2658):** macOS saves retain accessible destination extended attributes before atomic publication, including Finder tags and empty/binary values. Metadata errors keep the original and unsaved edit; source symlinks are not followed. Permissions/ACLs, hard links and creation dates remain separate work. Estimates unchanged.
+ - **2026-10-18 (M3, #3149):** Page replacement cancels render demand collected for the previous geometry; all viewer raster upload paths reject empty or oversized textures before cache eviction. Synthetic regressions reproduce the reported 1880×2350 upload at a 2048 limit, retain cached images and unsaved edits, and resume bounded backdrops and tiles. Estimates unchanged.
- **2026-10-18 (M8, #1350):** Integrated current main while preserving content-stream comment boundaries. Hidden-text cleanup retires unused named replacement descriptions on rewritten pages and forms, including inherited/shared resource holders, without removing descriptions still used by surviving content. Synthetic saved-byte and preservation regressions cover the cleanup. Estimates unchanged.
- **2026-10-15 (M6, AcroForm XML text):** Plain AcroForm XML imports retain all direct text around comments and processing instructions, including CDATA and character references. Synthetic regressions verify exact values and unknown catalog data after incremental and full save/reopen. Nested-element and XFA interpretation are unchanged. Estimates unchanged.
- **2026-10-15 (M6, #1917 refresh):** Integrated upstream `99941daa` while retaining the XML/XFDF attribute whitespace correction and all upstream progress. Only independent documentation conflicts required resolution; focused production and test files are unchanged from the previously green CI head. Estimates unchanged.
diff --cc crates/platform/README.md
index c3dcc076f,6b23752b5..5e5c44bc3
--- a/crates/platform/README.md
+++ b/crates/platform/README.md
@@@ -5,7 -5,3 +5,7 @@@ Layer L7 holds operating-system service
`staging` creates the temporary file an atomic save writes before renaming it over the target. The file is opened with `create_new`, so anything already at the name (a file, a hard link, a symbolic link even when dangling, a folder) is skipped and never written through. On Windows a folder at the name fails with "access denied" rather than "already exists", and is skipped only when something is actually there. Names carry an unpredictable 64-bit suffix from `staging_suffixes` (the standard library's keyed hash, currently SipHash-1-3, keyed from the operating system's random source), which stops a name being planted in advance but is not a CSPRNG; fixed suffixes are only for tests. At most 16 names are tried, and then the save is refused. The target's name is cut to 128 bytes on a character boundary so the staging name fits every system's limit. Each caller keeps its own name form (`.{name}.{suffix}.pdfcraft-tmp` for automation, `.{name}.pdfcraft-{suffix}.tmp` for the desktop save). Writing, closing the file before the rename, renaming and removing the staging file on failure stay with the caller.
Synthetic tests pin both name forms, the 128-byte cut, the attempt limit and refusal when no name is left. The planted-file, link, folder and failed-rename tests stay with each caller, where they exercise the whole save.
+
+On macOS, `write_atomically_with` copies the existing regular destination's accessible extended attributes to the open staging file after writing the data and before flushing and renaming. Finder tags, comments, binary values and empty attributes therefore survive both incremental and full saves (#2658). Save As retains attributes of an existing destination; a new destination does not inherit metadata from the source PDF. Missing files and filesystems without xattr support keep working. The metadata read does not follow the destination's symlink or block on a FIFO. macOS manages the new file's `com.apple.provenance`; it is not copied. Kernel-hidden compression attributes are not requested.
+
- Attribute copying is bounded: 64 KiB of names, 1024 attributes, 16 MiB per value and 64 MiB total. A read/copy error or exceeded bound returns an error suggesting Save As; the original bytes and metadata stay intact and the staging file is removed. Flush errors retain the same guarantee. Tests cover exact metadata before flush and after repeated saves, empty/binary values, oversized resource forks and symlink isolation. Automation covers incremental/full saves, Save As and retaining an unsaved edit after metadata refusal. This does not preserve permission bits, ACLs, hard-link identity or creation dates; other parts of #2658 need separate work.
++Attribute copying is bounded: 64 KiB of names, 1024 attributes, 16 MiB per value and 64 MiB total. Each value must fill the initially queried size and retain that size in a second query after reading: a resource fork may return a partial prefix on growth rather than an error. A read/copy error or exceeded bound returns an error suggesting Save As; the original bytes and metadata stay intact and the staging file is removed. Flush errors retain the same guarantee. Tests cover exact metadata before flush and after repeated saves, empty/binary values, oversized resource forks, a simulated partial read of a growing fork and symlink isolation. Automation covers incremental/full saves, Save As and retaining an unsaved edit after metadata refusal. This does not preserve permission bits, ACLs, hard-link identity or creation dates; other parts of #2658 need separate work.
diff --cc crates/platform/src/staging.rs
index 78ceead9c,f7200efb9..71bc19f59
--- a/crates/platform/src/staging.rs
+++ b/crates/platform/src/staging.rs
@@@ -109,63 -103,6 +109,73 @@@ pub fn write_atomically_with
result
}
+/// Copy accessible macOS attributes to the staging descriptor before publication. The kernel
+/// hides compression bookkeeping unless SHOWCOMPRESSION is requested; leave that option off.
+/// Provenance is managed by macOS for the new file, not writable document metadata.
+#[cfg(target_os = "macos")]
+fn preserve_target_xattrs(path: &Path, staged: &std::fs::File) -> std::io::Result<()> {
+ use rustix::fs::{Mode, OFlags, XattrFlags, fgetxattr, flistxattr, fsetxattr, open};
+ use rustix::io::Errno;
+
+ // A new destination has nothing to retain. Replacing a symlink has always replaced the
+ // link, not its referent: do not open it to read metadata from a different file. NONBLOCK
+ // also prevents a FIFO at the destination from hanging the metadata read.
+ let source = match open(path, OFlags::RDONLY | OFlags::CLOEXEC | OFlags::NOFOLLOW | OFlags::NONBLOCK, Mode::empty()) {
+ Ok(fd) => std::fs::File::from(fd),
+ Err(Errno::NOENT | Errno::LOOP) => return Ok(()),
+ Err(e) => return Err(e.into()),
+ };
+ if !source.metadata()?.is_file() {
+ return Ok(());
+ }
+
+ // Metadata is untrusted too: bound both allocations and total copying, including forks.
+ const MAX_NAMES_BYTES: usize = 64 * 1024;
+ const MAX_ATTRIBUTES: usize = 1024;
+ const MAX_VALUE_BYTES: usize = 16 * 1024 * 1024;
+ const MAX_TOTAL_BYTES: usize = 64 * 1024 * 1024;
+ let mut names = vec![0u8; MAX_NAMES_BYTES];
+ let len = match flistxattr(&source, names.as_mut_slice()) {
+ Ok(len) => len,
+ Err(Errno::NOTSUP) => return Ok(()), // No attributes exist on this filesystem.
+ Err(Errno::RANGE) => return Err(std::io::Error::other("extended attribute name list exceeds 64 KiB")),
+ Err(e) => return Err(e.into()),
+ };
+ let names = names.get(..len).ok_or_else(|| std::io::Error::other("extended attribute name list exceeds 64 KiB"))?;
+ let mut total = 0usize;
+ for (index, name) in names.split(|b| *b == 0).filter(|name| !name.is_empty()).enumerate() {
+ if index >= MAX_ATTRIBUTES {
+ return Err(std::io::Error::other("extended attribute count exceeds 1024"));
+ }
+ if name == b"com.apple.provenance" {
+ continue;
+ }
+ let name = std::ffi::CString::new(name).map_err(|_| std::io::Error::other("invalid extended attribute name"))?;
+ let size = fgetxattr(&source, &name, &mut [] as &mut [u8])?;
+ if size > MAX_VALUE_BYTES || size > MAX_TOTAL_BYTES.saturating_sub(total) {
+ return Err(std::io::Error::other("extended attributes exceed the 16 MiB per-value or 64 MiB total limit"));
+ }
- // A nonempty buffer distinguishes an empty value from a request for its size. If a
- // value grows between these reads, ERANGE refuses the save rather than truncating it.
- let mut value = vec![0u8; size.max(1)];
- let len = fgetxattr(&source, &name, value.as_mut_slice())?;
- let value = value.get(..len).ok_or_else(|| std::io::Error::other("extended attribute changed size while saving"))?;
- fsetxattr(staged, &name, value, XattrFlags::empty())?;
- total = total.saturating_add(len);
++ // Resource forks may return a prefix instead of ERANGE on growth; check the size again.
++ let value = read_xattr_value(size, |buffer| Ok(fgetxattr(&source, &name, buffer)?))?;
++ fsetxattr(staged, &name, &value, XattrFlags::empty())?;
++ total = total.saturating_add(value.len());
+ }
+ Ok(())
+}
+
++/// Read an already size-bounded attribute, refusing a partial result or a changed post-read size.
++#[cfg(target_os = "macos")]
++fn read_xattr_value(size: usize, mut read: impl FnMut(&mut [u8]) -> std::io::Result<usize>) -> std::io::Result<Vec<u8>> {
++ let mut value = vec![0u8; size.max(1)];
++ let len = read(value.as_mut_slice())?;
++ let after = read(&mut [])?;
++ if len != size || after != size {
++ return Err(std::io::Error::other("extended attribute changed size while saving"));
++ }
++ value.truncate(len);
++ Ok(value)
++}
++
/// Flush the staging file to the disk before it replaces the target. On macOS `sync_all` asks
/// for a full flush (`F_FULLFSYNC`), which SMB and FUSE volumes, such as a mounted Cryptomator
/// vault, refuse as unsupported: there a plain `fsync` is the strongest flush the volume offers.
@@@ -278,109 -215,4 +288,172 @@@ mod tests
assert_eq!(names(&dir), ["out.pdf"]);
let _ = std::fs::remove_dir_all(&dir);
}
+
+ #[cfg(target_os = "macos")]
+ #[test]
+ fn atomic_saves_keep_finder_tags_and_binary_extended_attributes() {
+ use rustix::fs::{XattrFlags, fgetxattr, setxattr};
+ let dir = test_dir("xattrs");
+ let target = dir.join("out.pdf");
+ let attributes: &[(&str, &[u8])] = &[
+ ("com.apple.metadata:_kMDItemUserTags", b"<plist version=\"1.0\"><array><string>PdfCraft\n6</string></array></plist>"),
+ ("com.pdfcraft.test.binary", b"\0\xff\x80original\0"),
+ ("com.pdfcraft.test.empty", b""),
+ ];
+ std::fs::write(&target, b"OLD").unwrap();
+ for (name, value) in attributes {
+ setxattr(&target, *name, value, XattrFlags::empty()).unwrap();
+ }
+ // Both desktop and automation name forms, including a second save of the replacement.
+ for form in [StagingName::TagThenSuffix, StagingName::SuffixThenTag] {
+ write_atomically_with(&target, b"NEW", form, [7], |staged| {
+ for (name, value) in attributes {
+ let mut bytes = [0u8; 256];
+ let len = fgetxattr(staged, *name, &mut bytes[..]).unwrap();
+ assert_eq!(&bytes[..len], *value, "metadata must be present before flush: {name}");
+ }
+ Ok(())
+ })
+ .unwrap();
+ let saved = std::fs::File::open(&target).unwrap();
+ for (name, value) in attributes {
+ let mut bytes = [0u8; 256];
+ let len = fgetxattr(&saved, *name, &mut bytes[..]).unwrap();
+ assert_eq!(&bytes[..len], *value);
+ }
+ assert_eq!(std::fs::read(&target).unwrap(), b"NEW");
+ assert_eq!(std::fs::read_dir(&dir).unwrap().count(), 1);
+ }
+ std::fs::remove_dir_all(dir).unwrap();
+ }
+
+ #[cfg(target_os = "macos")]
+ #[test]
+ fn a_failed_flush_keeps_the_original_extended_attributes() {
+ use rustix::fs::{XattrFlags, getxattr, setxattr};
+ let dir = test_dir("xattrs-flush");
+ let target = dir.join("out.pdf");
+ std::fs::write(&target, b"OLD").unwrap();
+ setxattr(&target, "com.pdfcraft.test", b"original", XattrFlags::empty()).unwrap();
+ let e = write_atomically_with(&target, b"NEW", StagingName::TagThenSuffix, [9], |_| Err(std::io::Error::other("flush refused"))).unwrap_err();
+ assert!(e.to_string().contains("flush refused"));
+ assert_eq!(std::fs::read(&target).unwrap(), b"OLD");
+ let mut value = [0u8; 64];
+ let len = getxattr(&target, "com.pdfcraft.test", &mut value[..]).unwrap();
+ assert_eq!(&value[..len], b"original");
+ assert_eq!(std::fs::read_dir(&dir).unwrap().count(), 1);
+ std::fs::remove_dir_all(dir).unwrap();
+ }
+
++ /// Model an HFS-style partial read while using real macOS metadata and the atomic writer.
++ /// The shared read validator must reject growth before the staging file can be published.
++ #[cfg(target_os = "macos")]
++ #[test]
++ fn a_growing_resource_fork_refuses_publication_and_keeps_original() {
++ use rustix::fs::{XattrFlags, fgetxattr, fsetxattr, getxattr, setxattr};
++ let dir = test_dir("xattrs-growing-fork");
++ let target = dir.join("out.pdf");
++ let name = "com.apple.ResourceFork";
++ for form in [StagingName::TagThenSuffix, StagingName::SuffixThenTag] {
++ std::fs::write(&target, b"ORIGINAL PDF").unwrap();
++ setxattr(&target, name, b"ABC", XattrFlags::empty()).unwrap();
++ let source = std::fs::File::open(&target).unwrap();
++ let result = write_atomically_with(&target, b"REPLACEMENT PDF", form, [23], |staged| {
++ let size = fgetxattr(&source, name, &mut [] as &mut [u8])?;
++ let value = read_xattr_value(size, |buffer| {
++ if buffer.is_empty() {
++ return Ok(fgetxattr(&source, name, buffer)?);
++ }
++ // HFS can return the prefix that fits instead of ERANGE. APFS need not
++ // have that behaviour: model the kernel response, not a timing race.
++ setxattr(&target, name, b"ABCD", XattrFlags::empty())?;
++ buffer.get_mut(..3).unwrap().copy_from_slice(b"ABC");
++ Ok(3)
++ })?;
++ fsetxattr(staged, name, &value, XattrFlags::empty())?;
++ Ok(())
++ });
++ let error = result.expect_err("a short prefix of the grown fork must not be published");
++ assert!(error.to_string().contains("changed size"), "{error}");
++ assert_eq!(std::fs::read(&target).unwrap(), b"ORIGINAL PDF");
++ let mut bytes = [0u8; 8];
++ let len = getxattr(&target, name, &mut bytes[..]).unwrap();
++ assert_eq!(&bytes[..len], b"ABCD", "the original's grown fork must remain intact");
++ assert_eq!(std::fs::read_dir(&dir).unwrap().count(), 1, "staging files are removed on refusal");
++ }
++ std::fs::remove_dir_all(dir).unwrap();
++ }
++
++ /// Stable empty/binary values are accepted; short reads, growth and failed rechecks are refused.
++ #[cfg(target_os = "macos")]
++ #[test]
++ fn attribute_reads_require_a_complete_value_and_stable_size() {
++ for bytes in [&b""[..], &b"\0\xffB"[..]] {
++ let value = read_xattr_value(bytes.len(), |buffer| {
++ if !buffer.is_empty() {
++ buffer.get_mut(..bytes.len()).unwrap().copy_from_slice(bytes);
++ }
++ Ok(bytes.len())
++ })
++ .unwrap();
++ assert_eq!(value, bytes);
++ }
++ for (before, read_len, after) in [(3, 2, 3), (3, 3, 4), (0, 1, 1), (3, 2, 2)] {
++ let result = read_xattr_value(before, |buffer| Ok(if buffer.is_empty() { after } else { read_len }));
++ assert!(result.unwrap_err().to_string().contains("changed size"));
++ }
++ let result = read_xattr_value(3, |buffer| {
++ if buffer.is_empty() { Err(std::io::Error::new(std::io::ErrorKind::PermissionDenied, "size recheck refused")) } else { Ok(3) }
++ });
++ assert_eq!(result.unwrap_err().kind(), std::io::ErrorKind::PermissionDenied);
++ }
++
+ #[cfg(target_os = "macos")]
+ #[test]
+ fn oversized_extended_attributes_refuse_the_save_without_replacing_the_target() {
+ use rustix::fs::{XattrFlags, getxattr, setxattr};
+ let dir = test_dir("xattrs-limit");
+ let target = dir.join("out.pdf");
+ std::fs::write(&target, b"OLD").unwrap();
+ // A resource fork can exceed the ordinary attribute limit on macOS. No fixture file
+ // is committed; only the OS metadata of this temporary synthetic file holds the bytes.
+ let fork = vec![42u8; 16 * 1024 * 1024 + 1];
+ setxattr(&target, "com.apple.ResourceFork", &fork, XattrFlags::empty()).unwrap();
+ let mut flushed = false;
+ let e = write_atomically_with(&target, b"NEW", StagingName::TagThenSuffix, [10], |_| {
+ flushed = true;
+ Ok(())
+ })
+ .unwrap_err();
+ assert!(e.to_string().contains("extended attributes"), "{e}");
+ assert!(e.to_string().contains("Save As"), "{e}");
+ assert!(!flushed, "metadata failure must stop before flush and rename");
+ assert_eq!(std::fs::read(&target).unwrap(), b"OLD");
+ let size = getxattr(&target, "com.apple.ResourceFork", &mut [] as &mut [u8]).unwrap();
+ assert_eq!(size, fork.len());
+ assert_eq!(std::fs::read_dir(&dir).unwrap().count(), 1);
+ std::fs::remove_dir_all(dir).unwrap();
+ }
+
+ #[cfg(target_os = "macos")]
+ #[test]
+ fn replacing_a_symlink_does_not_copy_attributes_from_its_referent() {
+ use rustix::fs::{XattrFlags, getxattr, setxattr};
+ let dir = test_dir("xattrs-symlink");
+ let outside = test_dir("xattrs-outside").join("private.pdf");
+ std::fs::write(&outside, b"PRIVATE").unwrap();
+ setxattr(&outside, "com.pdfcraft.test", b"private metadata", XattrFlags::empty()).unwrap();
+ let target = dir.join("out.pdf");
+ std::os::unix::fs::symlink(&outside, &target).unwrap();
+ write_atomically(&target, b"NEW", StagingName::TagThenSuffix).unwrap();
+ assert_eq!(std::fs::read(&outside).unwrap(), b"PRIVATE");
+ assert_eq!(std::fs::read(&target).unwrap(), b"NEW");
+ assert!(!target.symlink_metadata().unwrap().file_type().is_symlink());
+ let mut bytes = [0u8; 64];
+ assert_eq!(getxattr(&target, "com.pdfcraft.test", &mut bytes[..]).unwrap_err(), rustix::io::Errno::NOATTR);
+ let len = getxattr(&outside, "com.pdfcraft.test", &mut bytes[..]).unwrap();
+ assert_eq!(&bytes[..len], b"private metadata");
+ std::fs::remove_dir_all(dir).unwrap();
+ std::fs::remove_dir_all(outside.parent().unwrap()).unwrap();
+ }
}
diff --cc docs/roadmap.md
index daa40416f,3e772e32e..54bf9906b
--- a/docs/roadmap.md
+++ b/docs/roadmap.md
@@@ -1,7 -1,6 +1,9 @@@
# PdfCraft roadmap: milestones and what's next
- > **Last reviewed:** 2026-10-18 · **Last updated:** 2026-10-18 · **Change:** minor (PR #3042: integrated upstream d8b27058 while retaining this fix and upstream progress; estimates unchanged)
++> **Last reviewed:** 2026-10-18 · **Last updated:** 2026-10-18 · **Change:** minor (M1, #2658: reject partial extended-attribute copies after a size change; estimates unchanged)
++> **Last reviewed:** 2026-10-17 - **Last updated:** 2026-10-17 - **Change:** minor (M1: macOS atomic save retains destination xattrs; estimates unchanged)
+
+ > **Last reviewed:** 2026-10-18 · **Last updated:** 2026-10-18 · **Change:** minor (M3, #3149: discard render demand after page geometry changes and check the GPU texture limit before upload; estimates unchanged)
> **Last reviewed:** 2026-10-18 · **Last updated:** 2026-10-18 · **Change:** minor (M8, #1350: named replacement descriptions retired during Sanitize and across shared resources; estimates unchanged)
> **Last reviewed:** 2026-10-15 · **Last updated:** 2026-10-15 · **Change:** minor (M6: AcroForm XML text; estimates unchanged)
> **Last reviewed:** 2026-10-15 · **Last updated:** 2026-10-15 · **Change:** minor (M6: preserve XML/XFDF attribute whitespace; refreshed upstream; estimates unchanged) · **Target:** Adobe Acrobat Pro (Acrobat DC, continuous track 26.002.21931, macOS)
@@@ -104,7 -102,7 +105,7 @@@ total matches the parity estimate
| M | Milestone | Plan size (h) | Done | Remaining (h, 2026-10-10) | Notes |
|---|---|---|---|---|---|
| M0 | Skeleton: workspace, xtask gates, CI | 15–30 | 98% | 1–2 | GitHub workflow, `deny.toml` (licence audit of every dependency), parity checklist (826 features, `xtask parity`) done. Missing: remaining crate stubs, testkit/oracle crates |
- | M1 | COS: filters, crypt, parser, xref, writer | 120–200 | 80% | 20–40 | Done:<br>- filters and crypt: every standard-security revision R2–R6 (RC4, AES-128/256), SASLprep, permissions, creating encryption;<br>- cos: parse and repair (including invalid xref object-number ranges), decoded-stream limits including unfiltered data, decrypt on load, re-encrypt on save, incremental and full writing.<br>Corpus: open/edit/save passes on 958 files, and all 7 password-protected files open.<br>Full saves now pack objects into compressed object streams. An unchanged incremental save of a classic table writes a zero-length cross-reference subsection instead of a section with no subsections (#1339). A full rewrite keeps unknown trailer entries, including objects reachable only from them (#1338). Fuzzing runs nightly (`xtask fuzz`). Raw-deflate fallback preserves decoding-limit errors, including through tolerant COS stream decoding. Refreshed against upstream `99941daa` (2026-10-15). macOS atomic saves retain accessible destination xattrs, including Finder tags; a metadata failure keeps the original and the unsaved edit (#2658, metadata only). Missing: ≥ 250 tests, own image codecs |
-| M1 | COS: filters, crypt, parser, xref, writer | 120–200 | 80% | 20–40 | Done:<br>- filters and crypt: every standard-security revision R2–R6 (RC4, AES-128/256), SASLprep, permissions, creating encryption;<br>- cos: parse and repair (including invalid xref object-number ranges), decoded-stream limits including unfiltered data, decrypt on load, re-encrypt on save, incremental and full writing.<br>Corpus: open/edit/save passes on 958 files, and all 7 password-protected files open.<br>Full saves now pack objects into compressed object streams. An unchanged incremental save of a classic table writes a zero-length cross-reference subsection instead of a section with no subsections (#1339). A full rewrite keeps unknown trailer entries, including objects reachable only from them (#1338). Fuzzing runs nightly (`xtask fuzz`). Raw-deflate fallback preserves decoding-limit errors, including through tolerant COS stream decoding. Refreshed against upstream `99941daa` (2026-10-15). Missing: ≥ 250 tests, own image codecs |
++| M1 | COS: filters, crypt, parser, xref, writer | 120–200 | 80% | 20–40 | Done:<br>- filters and crypt: every standard-security revision R2–R6 (RC4, AES-128/256), SASLprep, permissions, creating encryption;<br>- cos: parse and repair (including invalid xref object-number ranges), decoded-stream limits including unfiltered data, decrypt on load, re-encrypt on save, incremental and full writing.<br>Corpus: open/edit/save passes on 958 files, and all 7 password-protected files open.<br>Full saves now pack objects into compressed object streams. An unchanged incremental save of a classic table writes a zero-length cross-reference subsection instead of a section with no subsections (#1339). A full rewrite keeps unknown trailer entries, including objects reachable only from them (#1338). Fuzzing runs nightly (`xtask fuzz`). Raw-deflate fallback preserves decoding-limit errors, including through tolerant COS stream decoding. Refreshed against upstream `99941daa` (2026-10-15). Done since: macOS atomic saves retain accessible destination xattrs, including Finder tags; a metadata failure keeps the original and the unsaved edit (#2658, metadata only). Done since: Post-read size checks refuse partial resource-fork copies when metadata changes during a save. Missing: ≥ 250 tests, own image codecs |
| M2 | Model, render, text | 200–350 | 15% | 130–230 | hayro bootstrap renderer (vendored patches); inspector predictor scratch is bounded by available input, and JPX sample rescaling handles 1–32 bits safely. Text extraction reaches word-F1 0.98 against pdftotext. Short same-line redraws split before placement rather than interleaving. Missing: model crate, fonts, DisplayList, renderer independent of hayro. Inspector page-label traversal and output are resource-bounded, with physical-number fallback warnings. Packed TIFF-predictor RGB rows retain later rows in decoding and rendering. Page marks, added content and print output retain small page-unit transform coefficients when serialized. |
| M2 | Model, render, text | 200–350 | 15% | 130–230 | hayro bootstrap renderer (vendored patches); inspector predictor scratch is bounded by available input, and JPX sample rescaling handles 1–32 bits safely. Text extraction reaches word-F1 0.98 against pdftotext. Short same-line redraws split before placement rather than interleaving. Missing: model crate, fonts, DisplayList, renderer independent of hayro. Inspector page-label traversal and output are resource-bounded, with physical-number fallback warnings. Packed TIFF-predictor RGB rows retain later rows in decoding and rendering. The renderer keeps its one-point crop-size floor in physical points after UserUnit scaling, with regression coverage for crop origins, rotations and f32 reciprocal rounding. Existing unit policy and nearly-zero fallback are retained. |
| M2 | Model, render, text | 200–350 | 15% | 130–230 | hayro bootstrap renderer (vendored patches); inspector predictor scratch is bounded by available input, and JPX sample rescaling handles 1–32 bits safely. Text extraction reaches word-F1 0.98 against pdftotext. Short same-line redraws split before placement rather than interleaving. Missing: model crate, fonts, DisplayList, renderer independent of hayro. Inspector page-label traversal and output are resource-bounded, with physical-number fallback warnings |
diff --cc parity/acrobat-features.toml
index de02529e8,f05387aa2..3cdabad91
--- a/parity/acrobat-features.toml
+++ b/parity/acrobat-features.toml
@@@ -286,8 -286,8 +286,8 @@@ milestone = "M1
status = "shipped"
commands = ["file.save"]
tools = ["doc_save"]
- evidence = ["crates/platform/src/staging.rs::atomic_saves_keep_finder_tags_and_binary_extended_attributes", "crates/automation/tests/automation.rs::saving_a_pdf_keeps_the_destinations_extended_attributes", "crates/automation/tests/automation.rs::a_metadata_preservation_error_keeps_the_pdf_and_unsaved_edit", "crates/ui-egui/tests/editing.rs::save_writes_an_incremental_update_and_clears_dirty", "crates/engine/src/tests.rs::save_is_incremental_stamps_mod_date_and_rebases", "crates/organize/src/tests.rs::successive_incremental_saves_stack_revisions", "crates/automation/src/lib.rs::staging_never_writes_through_a_file_planted_at_its_name", "crates/ui-egui/src/editing.rs::saving_never_writes_through_a_file_planted_at_the_staging_name"]
- notes = "The atomic write stages to a new, randomly named file created with create_new, so a file or link planted at the staging path is never written through (desktop app, automation and CLI). On macOS, accessible destination xattrs (including Finder tags) are copied before flush/rename; errors or metadata limits refuse the save without replacing the file. System-managed provenance is excluded. Permissions, ACLs, hard-link identity and creation dates are not preserved by this change (#2658)."
-evidence = ["crates/ui-egui/tests/editing.rs::save_writes_an_incremental_update_and_clears_dirty", "crates/engine/src/tests.rs::save_is_incremental_stamps_mod_date_and_rebases", "crates/organize/src/tests.rs::successive_incremental_saves_stack_revisions", "crates/automation/src/lib.rs::staging_never_writes_through_a_file_planted_at_its_name", "crates/ui-egui/src/editing.rs::saving_never_writes_through_a_file_planted_at_the_staging_name"]
-notes = "The atomic write stages to a new, randomly named file created with create_new, so a file or link planted at the staging path is never written through (desktop app, automation and CLI)."
++evidence = ["crates/platform/src/staging.rs::atomic_saves_keep_finder_tags_and_binary_extended_attributes", "crates/platform/src/staging.rs::a_growing_resource_fork_refuses_publication_and_keeps_original", "crates/automation/tests/automation.rs::saving_a_pdf_keeps_the_destinations_extended_attributes", "crates/automation/tests/automation.rs::a_metadata_preservation_error_keeps_the_pdf_and_unsaved_edit", "crates/ui-egui/tests/editing.rs::save_writes_an_incremental_update_and_clears_dirty", "crates/engine/src/tests.rs::save_is_incremental_stamps_mod_date_and_rebases", "crates/organize/src/tests.rs::successive_incremental_saves_stack_revisions", "crates/automation/src/lib.rs::staging_never_writes_through_a_file_planted_at_its_name", "crates/ui-egui/src/editing.rs::saving_never_writes_through_a_file_planted_at_the_staging_name"]
++notes = "The atomic write stages to a new, randomly named file created with create_new, so a file or link planted at the staging path is never written through (desktop app, automation and CLI). On macOS, accessible destination xattrs (including Finder tags) are copied before flush/rename; errors, metadata limits or a changed post-read size refuse the save without replacing the file. System-managed provenance is excluded. Permissions, ACLs, hard-link identity and creation dates are not preserved by this change (#2658)."
[[feature]]
id = "core.save-as-full-rewrite"