Skip to content

fix: preserve extra fields in raw_copy_file_touch - #1172

Merged
Pr0methean merged 1 commit into
zip-rs:masterfrom
harbinresearcher:codex/fix-touch-extra-fields
Oct 25, 2026
Merged

Pr0methean merged 1 commit into
zip-rs:masterfrom
harbinresearcher:codex/fix-touch-extra-fields

Conversation

@harbinresearcher

@harbinresearcher harbinresearcher commented Oct 25, 2026 •

Copy link
Copy Markdown

Fixes #1170.

raw_copy_file_touch starts from plain file.options() and copies the comment, so custom extra fields disappear when changing an entry's date or permissions. For example, an allowed field with ID 87 and data abc survives ordinary raw copy but is absent after touch. The same behavior drops Info-ZIP's 0x7875 UID/GID field.

Reuse raw_copy_options, which already supplies comments and serializable extra fields for ordinary raw copy and rename, before applying the requested date and mode. Remove the duplicate comment assignment. The existing timestamp, permission, stored-name, encoding-flag and raw-data paths remain in place; this does not introduce a new extra-field serialization policy.

Extend the end-to-end date/permission test with a custom field and comment. Against the original production code, the date/mode/compression/comment assertions pass and the new extra-field equality assertion fails (Some([87, 0, 3, 0, 97, 98, 99]) versus None); ordinary raw-copy controls pass. After the fix, the full 16-case end-to-end target passes without default features and with all features on Linux amd64/Rust 1.88.0, 1.99.1, and installed 1.101.0-nightly (2026-10-18).

An independent public-API probe also finishes and reopens copies of an actual Info-ZIP 3.0 archive: copy/rename/touch retain the six-byte payload, stored name and 0x7875; touch honors the requested date and mode.

Linux amd64/Rust 1.99.1: complete test runs pass with no default features, default features, all features, and no default features plus deflate-zopfli, including doctests (RUSTFLAGS=-Dwarnings). Formatting checks pass on all three installed toolchains. Focused Clippy passes in no-default/default/all-feature modes; all-target Clippy passes with default/all features.

Rebased onto the current CI-only upstream update before opening this PR. Library/test trees and the root manifest are unchanged by that update, and the patched source fingerprints match the tested versions.

With no default features, all-target Clippy reports the unchanged field_reassign_with_default error at src/extra_fields/extra_field.rs:364, also reproduced on the pristine base. Documentation completes in all three modes with the existing private-link warning at src/result.rs:35, likewise reproduced on the pristine base. No Windows, macOS, other-target, Miri or fuzzing results are claimed locally; the full upstream CI matrix remains to run.

Disclosure: this investigation, implementation, tests and PR were produced autonomously by an AI coding agent under the account owner's authorization. An independent AI static review found no actionable issues; no human review is claimed.


View with [code]smith Autofix with [code]smith
Need help on this PR? Tag @codesmith-bot with what you need.

@Pr0methean
Pr0methean enabled auto-merge October 25, 2026 04:27
@Pr0methean Pr0methean added this to the 9.1.1 milestone Oct 25, 2026
@Pr0methean
Pr0methean added this pull request to the merge queue Oct 25, 2026
Merged via the queue into zip-rs:master with commit d6c0278 Oct 25, 2026
134 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

raw_copy_file_touch drops custom extra fields

2 participants