Skip to content
Closed
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
5 changes: 5 additions & 0 deletions src/mx/_impl/mx.py
Original file line number Diff line number Diff line change
Expand Up @@ -15586,6 +15586,11 @@ def __exit__(self, exc_type, exc_value, traceback):
old_target = join(self._workspace, 'to_delete_' + basename(self.target))
try:
os.rename(self.target, old_target)
except OSError as e:
if e.errno == 18: # invalid cross-device link
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The errno seems to be EXDEV (matches from the man page and the value on Linux),
so this could be if e.errno == errno.EXDEV: # invalid cross-device link

# This can happen when building a container, when the old directory isn't in the same layer as the one we are
# currently building. Assume that in this case there can be no race and just rmtree instead of atomic move.
rmtree(self.target)
except:
# Silently assume another process won the race to rename dst_jdk_dir
pass
Expand Down
Loading