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

Fix commonpath in read-only filesystem #2073

Merged
merged 1 commit into from
Mar 1, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions src/huggingface_hub/file_download.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import copy
import errno
import fnmatch
import inspect
import io
Expand Down Expand Up @@ -913,6 +914,12 @@ def _create_symlink(src: str, dst: str, new_blob: bool = False) -> None:
# Permission error means src and dst are not in the same volume (e.g. destination path has been provided
# by the user via `local_dir`. Let's test symlink support there)
_support_symlinks = are_symlinks_supported(abs_dst_folder)
except OSError as e:
# OS error (errno=30) means that the commonpath is readonly on Linux/MacOS.
if e.errno == errno.EROFS:
_support_symlinks = are_symlinks_supported(abs_dst_folder)
else:
raise

# Symlinks are supported => let's create a symlink.
if _support_symlinks:
Expand Down
Loading