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

Do not raise if chmod fails #2429

Merged
merged 5 commits into from
Jul 31, 2024
Merged

Do not raise if chmod fails #2429

merged 5 commits into from
Jul 31, 2024

Conversation

Wauplin
Copy link
Contributor

@Wauplin Wauplin commented Jul 30, 2024

Fix implementation from #1220.

When downloading a file, we set the correct permissions on it when applicable. However if it's not possible, we shouldn't raise an exception. This PR fixes this by ignoring any OSError in the process and convert them to a warning log.

Moreover, if copying a file with shutils.copy2 cannot be done (copy file + metadata), we default to shutils.copyfile (copy file content). What's important is to have the file content on the destination path rather than the metadata.

cc @XciD who got this while working on an S3 mount

EDIT: failing test is unrelated

@Wauplin Wauplin requested a review from XciD July 30, 2024 13:46
@HuggingFaceDocBuilderDev

The docs for this PR live here. All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update.

@Wauplin Wauplin marked this pull request as draft July 30, 2024 16:38
@Wauplin Wauplin marked this pull request as ready for review July 31, 2024 07:12
@Wauplin Wauplin requested a review from LysandreJik July 31, 2024 07:14
@Wauplin Wauplin merged commit c33a429 into main Jul 31, 2024
15 of 17 checks passed
@Wauplin Wauplin deleted the do-not-raise-on-chmod branch July 31, 2024 07:17
Wauplin added a commit that referenced this pull request Jul 31, 2024
* Do not raise if chmod fails

* just to test

* test

* comments
@Wauplin
Copy link
Contributor Author

Wauplin commented Jul 31, 2024

@Wauplin Wauplin mentioned this pull request Jul 31, 2024
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