Repository navigation
fix: keep extended timestamp and NTFS extra fields in raw copies - #1293
Conversation
`ExtraField::size` and `ExtraField::write` had no arm for the extended timestamp (0x5455) and the NTFS file times (0x000a), so `raw_copy_options` serialized them to nothing and `raw_copy_file` silently dropped them. A copy then only keeps the DOS date-time from the local header, which is local time with two-second resolution. Write both fields again: the NTFS attribute is 32 bytes, and the extended timestamp advertises only the timestamps it stores, since the central header keeps the modification time alone.
There was a problem hiding this comment.
Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.
An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing.
Signed-off-by: Chris Hennick <4961925+Pr0methean@users.noreply.github.com>
There was a problem hiding this comment.
Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.
An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing.
There was a problem hiding this comment.
Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.
An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing.
There was a problem hiding this comment.
Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.
An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing.
Head branch was pushed to by a user without write access
There was a problem hiding this comment.
Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.
An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing.
|
Merged current |
Signed-off-by: n4n5 <git@n4n5.dev>
There was a problem hiding this comment.
Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.
An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing.
Signed-off-by: n4n5 <git@n4n5.dev>
There was a problem hiding this comment.
Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.
An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing.
There was a problem hiding this comment.
Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.
An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing.
Fixes #1285.
ExtraField::sizeandExtraField::writehad no arm for the extended timestamp (0x5455)and the NTFS file times (0x000a), so
raw_copy_optionsserialized them to nothing andraw_copy_filesilently dropped them. A tool that builds an archive by raw-copying entriesthen keeps only the DOS date-time from the local header, which is local time with
two-second resolution and shifts when the archive is restored in another time zone.
Both fields are written again:
Ntfsis serialized as the 32-byte file-times attribute it was parsed from: the reservedfield, the 0x0001 attribute tag, an attribute size of 24, and the modification, access and
creation times.
ExtendedTimestampwrites the flags byte and the timestamps it holds. The central headeronly stores the modification time, so the central form advertises only that bit and
carries only that value; the local form keeps the access and creation times when they are
known. Flags that do not match the stored data would make the field unreadable, so they
are derived from what is actually written.
Tests:
tests/raw_copy_extra_fields.rsbuilds an archive with both fields, raw-copies it,and checks that the copy still has the same 0x5455 modification time and the same 0x000a
file times, and that the copied entry is still readable. Two unit tests cover the local and
central serialization of the extended timestamp.
cargo test(default features and--no-default-features) andcargo clippy --all-targetspass;
--all-featuresneeds cmake forlibz-syshere, which this environment lacks.As the template asks: the branch is based on
masteratdee278bc240e, so it needs norebase right now, and I have invited you as a collaborator on
compiler-segfault/zip2soyou can push conflict fixes to the branch.
I used an AI assistant (Claude) to help write this patch.