Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: support handle very large uid/gid in PAX style tar #333

Merged
merged 3 commits into from Aug 7, 2023

Conversation

adamqqqplay
Copy link
Contributor

This commit add process to read large uid/gid from PAX extensions
to fix very large UIDs/GIDs (>=2097151, limit of USTAR tar) lost
in PAX style tar during unpack.

Fix: #332

Signed-off-by: Qinqi Qu <quqinqi@linux.alibaba.com>
src/archive.rs Outdated
@@ -275,7 +275,7 @@ impl<'a, R: Read> Iterator for Entries<'a, R> {
impl<'a> EntriesFields<'a> {
fn next_entry_raw(
&mut self,
pax_size: Option<u64>,
pax_extensions: &Option<Vec<u8>>,

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How about using pax_extensions: Option<&[u8]>>?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed, thanks.

src/archive.rs Outdated
let mut pax_gid: Option<u64> = None;
if let Some(pax_extensions_ref) = &pax_extensions {
pax_size = pax_extensions_value(pax_extensions_ref, PAX_SIZE);
pax_uid = pax_extensions_value(pax_extensions_ref, PAX_UID);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How about

if let Some(uid) = pax_extensions_value(pax_extensions_ref, PAX_UID) {
       header.set_uid(uid);
}

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed.

Signed-off-by: Qinqi Qu <quqinqi@linux.alibaba.com>
This commit add process to read large uid/gid from PAX extensions
to fix very large UIDs/GIDs (>=2097151, limit of USTAR tar) lost
in PAX style tar during unpack.

Fix: alexcrichton#332

Signed-off-by: Qinqi Qu <quqinqi@linux.alibaba.com>
@adamqqqplay
Copy link
Contributor Author

@alexcrichton Hi Alex, could you take a look when you have time? Thanks!

Copy link
Owner

@alexcrichton alexcrichton left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@alexcrichton alexcrichton merged commit 1d37489 into alexcrichton:master Aug 7, 2023
7 checks passed
@adamqqqplay
Copy link
Contributor Author

@alexcrichton Thanks for your review!

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.

Can not handle very large UID/GID in PAX style tar
3 participants