Skip to content

Commit

Permalink
fs: reflink: don't try to reset permissions
Browse files Browse the repository at this point in the history
We should set desired permissions explicitly in layers above this one.

For now just getting rid of this and proper permissions will be set up
in the followups in `dvc_data.index.checkout`.

Related iterative/dvc-data#274
  • Loading branch information
efiop committed Dec 6, 2023
1 parent 5e37397 commit 4e1efe1
Showing 1 changed file with 3 additions and 8 deletions.
11 changes: 3 additions & 8 deletions src/dvc_objects/fs/system.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,6 @@
logger = logging.getLogger(__name__)


umask = os.umask(0)
os.umask(umask)


def hardlink(source: "AnyFSPath", link_name: "AnyFSPath") -> None:
# NOTE: we should really be using `os.link()` here with
# `follow_symlinks=True`, but unfortunately the implementation is
Expand Down Expand Up @@ -107,6 +103,9 @@ def _reflink_linux(src: "AnyFSPath", dst: "AnyFSPath") -> None:
def reflink(source: "AnyFSPath", link_name: "AnyFSPath") -> None:
source, link_name = os.fspath(source), os.fspath(link_name)

# NOTE: reflink may (macos) or may not (linux) clone permissions,
# so the user needs to handle those himself.

system = platform.system()
if system == "Darwin":
_reflink_darwin(source, link_name)
Expand All @@ -118,10 +117,6 @@ def reflink(source: "AnyFSPath", link_name: "AnyFSPath") -> None:
f"reflink is not supported on '{system}'",
)

# NOTE: reflink has a new inode, but has the same mode as the src,
# so we need to chmod it to look like a normal copy.
os.chmod(link_name, 0o666 & ~umask)


def inode(path: "AnyFSPath") -> int:
return os.lstat(path).st_ino
Expand Down

0 comments on commit 4e1efe1

Please sign in to comment.