Skip to content

Commit

Permalink
fs: utils: copyfile: 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 1f7bcbe commit d7236e2
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/dvc_objects/fs/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@

logger = logging.getLogger(__name__)

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

LOCAL_CHUNK_SIZE = 2**20 # 1 MB
COPY_PBAR_MIN_SIZE = 2**30 # 1 GB
Expand Down Expand Up @@ -189,6 +191,9 @@ def copyfile(

try:
system.reflink(src, dest)
if sys.platform == "darwin":
# NOTE: reflink on macos also clones src permissions
os.chmod(dest, 0o666 & ~umask)
return
except OSError:
pass
Expand Down

0 comments on commit d7236e2

Please sign in to comment.