Skip to content

Add ZipEntryMetadata: list a zip archive without reading its entries - #192

Merged
copybara-service[bot] merged 1 commit into
mainfrom
test_1003764259
Nov 12, 2026
Merged

copybara-service[bot] merged 1 commit into
mainfrom
test_1003764259

Conversation

@copybara-service

@copybara-service copybara-service Bot commented Oct 21, 2026 •

Copy link
Copy Markdown

Add ZipEntryMetadata: list a zip archive without reading its entries

ZipArchive::GetEntryMetadata(index) returns an owned snapshot of one central
directory record (name, comment, file/directory flags, sizes, method, CRC-32,
timestamps, Unix mode, header offset, encryption flag) without opening the
entry, so listing an archive no longer costs one read per entry. It does not
borrow the archive, so it also works while an entry is open. The header offset
is documented as an untrusted header value. ZipFile::GetHeaderStart() /
GetDataStart() expose an opened entry's offsets.

The Rust archives now keep their own handle on the parsed central directory
(CentralDirectory: the zip crate's Arc<ZipArchiveMetadata> plus the
comment) and serve get_length / get_comment / get_entry_metadata from it
instead of through the boxed ZipArchive, so that C++ calling them while an
entry holds a &mut into that box no longer aliases the borrow.

@google-cla

google-cla Bot commented Oct 21, 2026

Copy link
Copy Markdown

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

@copybara-service
copybara-service Bot force-pushed the test_1003764259 branch 2 times, most recently from e9c42ad to 6d75a45 Compare October 28, 2026 09:09
@copybara-service
copybara-service Bot force-pushed the test_1003764259 branch 14 times, most recently from 84e366c to b946266 Compare November 3, 2026 09:41
@copybara-service copybara-service Bot changed the title Add ZipEntryMetadata: list a zip archive without reading its entries. Add ZipEntryMetadata: list a zip archive without reading its entries Nov 10, 2026
`ZipArchive::GetEntryMetadata(index)` returns an owned snapshot of one central
directory record (name, comment, file/directory flags, sizes, method, CRC-32,
timestamps, Unix mode, header offset, encryption flag) without opening the
entry, so listing an archive no longer costs one read per entry. It does not
borrow the archive, so it also works while an entry is open. The header offset
is documented as an untrusted header value. `ZipFile::GetHeaderStart()` /
`GetDataStart()` expose an opened entry's offsets.

The Rust archives now keep their own handle on the parsed central directory
(`CentralDirectory`: the zip crate's `Arc<ZipArchiveMetadata>` plus the
comment) and serve `get_length` / `get_comment` / `get_entry_metadata` from it
instead of through the boxed `ZipArchive`, so that C++ calling them while an
entry holds a `&mut` into that box no longer aliases the borrow.

PiperOrigin-RevId: 1019685384
@copybara-service
copybara-service Bot merged commit efb1966 into main Nov 12, 2026
1 of 2 checks passed
@copybara-service
copybara-service Bot deleted the test_1003764259 branch November 12, 2026 03:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

0 participants