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

Only preserve the executable bit #1743

Merged
merged 1 commit into from
Feb 20, 2024
Merged

Conversation

konstin
Copy link
Member

@konstin konstin commented Feb 20, 2024

A file in a zip can set arbitrary unix permissions, but we, like pip, want to preserve only the executable bit and otherwise use the OS defaults.

This should be faster for wheels with many files since we now avoid the blocking fs call to set the permissions in most cases.

Fixes #1740.

@konstin konstin added the bug Something isn't working label Feb 20, 2024
fs_err::set_permissions(&path, Permissions::from_mode(mode))?;
// Create a file with read and write permissions.
// Otherwise, databricks-0.2.dist-info/RECORD in databricks-0.2-py2.py3-none-any.whl has 000 permissions.
let permissions = Permissions::from_mode(mode | 0o660);
Copy link
Member Author

Choose a reason for hiding this comment

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

Permission seems to lack an api to set read and write without manual bitflags math.

Copy link

Choose a reason for hiding this comment

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

Copy link
Member Author

Choose a reason for hiding this comment

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

Thanks for the pip reference!

I rewrote it so that we're now never setting the permissions explicitly ourselves, but instead first create the file with the default options and then attach the executable bit if required.

@konstin konstin changed the title Set read and write permissions for extracted files Only preserve the executable bit Feb 20, 2024
@konstin konstin force-pushed the konsti/set-extract-permissions branch from 8820655 to 9bddac7 Compare February 20, 2024 15:22
@konstin konstin merged commit 9a720a8 into main Feb 20, 2024
7 checks passed
@konstin konstin deleted the konsti/set-extract-permissions branch February 20, 2024 15:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Failed to copy databricks-0.2.dist-info/RECORD
3 participants