Skip to content

Commit

Permalink
fs: generic: link: reset permissions on macos reflinks
Browse files Browse the repository at this point in the history
  • Loading branch information
efiop committed Dec 6, 2023
1 parent d7236e2 commit 3a2fd37
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/dvc_objects/fs/generic.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
import errno
import logging
import os
import sys
from contextlib import suppress
from functools import wraps
from typing import TYPE_CHECKING, Any, Callable, List, Optional, Union
Expand All @@ -11,7 +12,7 @@
from ..executors import ThreadPoolExecutor, batch_coros
from .callbacks import DEFAULT_CALLBACK
from .local import LocalFileSystem, localfs
from .utils import as_atomic
from .utils import as_atomic, umask

if TYPE_CHECKING:
from .base import AnyFSPath, FileSystem
Expand Down Expand Up @@ -60,6 +61,13 @@ def _link(

func = getattr(to_fs, link)
func(from_path, to_path)
if (
link == "reflink"
and sys.platform == "darwin"
and isinstance(from_fs, LocalFileSystem)
):
# NOTE: reflink on macos also clones src permissions
os.chmod(to_path, 0o666 & ~umask)


def copy(
Expand Down

0 comments on commit 3a2fd37

Please sign in to comment.