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
Original file line number Diff line number Diff line change
Expand Up @@ -1015,13 +1015,20 @@ private void createSymlinks(Iterable<SymlinkMetadata> symlinks) throws IOExcepti
"Failed creating directory and parents for %s",
symlink.path())
.createDirectoryAndParents();
// If a directory output is being materialized as a symlink, we must first delete the
// preexisting empty directory.
if (symlink.path().exists(Symlinks.NOFOLLOW)
&& symlink.path().isDirectory(Symlinks.NOFOLLOW)) {
// If a directory output is being materialized as a symlink, creating the symlink fails as we
// must first delete the preexisting empty directory. Since this is rare (and in the future
// BwoB may no longer eagerly create these directories), we don't delete the directory
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This refers to #25976. I can update the comment depending on which PR is merged first.

Copy link
Contributor

Choose a reason for hiding this comment

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

Let's get #25976 merged first (it needs a rebase).

Copy link
Contributor

Choose a reason for hiding this comment

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

Approving since #25976 can't yet be merged.

// beforehand.
try {
symlink.path().createSymbolicLink(symlink.target());
} catch (IOException e) {
if (!symlink.path().isDirectory(Symlinks.NOFOLLOW)) {
throw e;
}
// Retry after deleting the directory.
symlink.path().delete();
symlink.path().createSymbolicLink(symlink.target());
}
symlink.path().createSymbolicLink(symlink.target());
}
}

Expand Down
Loading