Skip to content

Commit

Permalink
Force realpaths for all os.link() calls
Browse files Browse the repository at this point in the history
  • Loading branch information
parejkoj committed Apr 10, 2020
1 parent 0908072 commit 3716cdf
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions python/lsst/daf/butler/datastores/posixDatastore.py
Original file line number Diff line number Diff line change
Expand Up @@ -304,13 +304,13 @@ def _extractIngestInfo(self, path: str, ref: DatasetRef, *, formatter: Type[Form
with self._transaction.undoWith("link", os.unlink, newFullPath):
# Try hard link and if that fails use a symlink
try:
os.link(fullPath, newFullPath)
os.link(os.path.realpath(fullPath), newFullPath)
except OSError:
# Read through existing symlinks
os.symlink(os.path.realpath(fullPath), newFullPath)
elif transfer == "hardlink":
with self._transaction.undoWith("hardlink", os.unlink, newFullPath):
os.link(fullPath, newFullPath)
os.link(os.path.realpath(fullPath), newFullPath)
elif transfer == "symlink":
with self._transaction.undoWith("symlink", os.unlink, newFullPath):
# Read through existing symlinks
Expand Down

0 comments on commit 3716cdf

Please sign in to comment.