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

Add test to reproduce issue in impl Stream for Entries causing filename truncation #41

Merged
merged 1 commit into from
Feb 9, 2025

Conversation

charliermarsh
Copy link
Member

Re-merging #1

…name truncation (#1)

This is from edera-dev/tokio-tar#3

---

I tracked down this issue in
astral-sh/uv#5450 (comment)

>
https://github.com/edera-dev/tokio-tar/blob/4ee357285b5053e6bfada7f117e530b4da94b74a/src/archive.rs#L317
> 
> ```rust
> if is_recognized_header &&
entry.header().entry_type().is_pax_local_extensions() {
>                 if self.pax_extensions.is_some() {
>                     return Poll::Ready(Some(Err(other(
>                         "two pax extensions entries describing \
>                          the same member",
>                     ))));
>                 }
>                 let mut ef = EntryFields::from(entry);
> let val = ready_err!(Pin::new(&mut ef).poll_read_all(cx));
>                 self.pax_extensions = Some(val);
>                 continue;
>             }
> ```
> 
> if `Pin::new(&mut ef).poll_read_all(cx)` is `Poll::Pending` then
`ready_err!` returns it, so the Pax extension is lost. The same would
apply to a pending poll that occurs while a > longlink or longname is
being prepared. When `poll_next` is called again the next entry header
is parsed.

This PR demonstrates the issue by creating an AsyncRead impl which pends
every second time it is polled.

Commenting out [this
line](https://github.com/RazerM/tokio-tar/blob/15466052f63c47cf47decd4409a9b0e936302773/tests/all.rs#L816)
makes the test pass, because the reader doesn't enter a pending state in
the "wrong" place.

It is probably also the cause of
dignifiedquire/async-tar#39
@charliermarsh charliermarsh changed the title Add test to reproduce issue in impl Stream for Entries causing file… Add test to reproduce issue in impl Stream for Entries causing filename truncation Feb 9, 2025
@charliermarsh charliermarsh enabled auto-merge (squash) February 9, 2025 18:31
@charliermarsh charliermarsh merged commit a393710 into main Feb 9, 2025
0 of 3 checks passed
@charliermarsh charliermarsh deleted the charlie/test branch February 9, 2025 18:31
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.

2 participants