Skip to content

Conversation

zelosleone
Copy link
Collaborator

@zelosleone zelosleone commented Jul 22, 2025

this will solve the zed stock problem @baszalmstra is facing the recipe i used with test is the same one https://github.com/baszalmstra/zed-feedstock/blob/be25438c26f8f44a70566f6ea992367c04c55580/recipe/recipe.yaml

the problem seems to be the zip crate's bug itself, which fails to extract certain zip files on windows and sometimes even fails to extract them correctly https://github.com/zip-rs/zip2/issues?q=is%3Aissue%20state%3Aopen%20windows (seems like a recent issue but no comments so far on any of the bugs, which i think pretty critical) so instead with the same logic we are extracting them manually and it works correctly now

@zelosleone zelosleone requested review from wolfv and baszalmstra July 22, 2025 15:59
let mut file = archive
.by_index(i)
.map_err(|e| SourceError::ZipExtractionError(e.to_string()))?;
let outpath = tmp_extraction_dir.path().join(file.mangled_name());
Copy link
Member

Choose a reason for hiding this comment

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

what is the mangled_name?

Copy link
Collaborator Author

@zelosleone zelosleone Jul 22, 2025

Choose a reason for hiding this comment

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

https://docs.rs/zip/latest/zip/read/struct.ZipFile.html#method.mangled_name basically what we are doing is using zip crate's mangled_name to manually extract correcly the paths into files + folders with sanitized file names

Copy link
Member

Choose a reason for hiding this comment

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

I don't think we should use that function as the docs recommend: enclosed_name.

This will read well-formed ZIP files correctly, and is resistant to path-based exploits. It is recommended over ZipFile::mangled_name.

Why does mangled name fix anything?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

enclosed_name causes windows file lock issues, which seems to give me problematic results on windows. I would love your input on that, retrying is an approach but i am not sure about it for zip extraction

@zelosleone zelosleone requested a review from wolfv July 30, 2025 12:54
@baszalmstra
Copy link
Contributor

It is still unclear to me what this solves? can you maybe explain the exact error this solves? You only link to an issue listing and the recipe you reference fails in a cargo invocation, not in rattler-build.

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.

3 participants