Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow copying across mounts on workload install #18482

Merged
merged 2 commits into from
Jun 25, 2021

Conversation

sfoslund
Copy link
Member

@sfoslund sfoslund commented Jun 23, 2021

Fixes #18450

@dotnet-issue-labeler
Copy link

I couldn't figure out the best area label to add to this PR. If you have write-permissions please help me learn by adding exactly one area label.

@sfoslund sfoslund requested review from joeloff, dsplaisted and wli3 June 23, 2021 19:37
@@ -271,5 +271,24 @@ private ManifestVersion GetInstalledManifestVersion(ManifestId manifestId)

internal static PackageId GetManifestPackageId(SdkFeatureBand featureBand, ManifestId manifestId) =>
new PackageId($"{manifestId}.Manifest-{featureBand}");

// Note: cannot use Directory.Move because it errors when copying across mounts
internal static void CopyDirectory(string sourcePath, string destPath)
Copy link
Member

Choose a reason for hiding this comment

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

It looks like this changes behavior from moving to copying. It's also no longer atomic, which I think was the reason for extracting to a temp folder and then moving in the first place.

So I think we should use Directory.Move when it's possible. When it's not possible, we probably want to do something more resilient / atomic, such as copying it to the metadata folder (which we can probably assume is on the same volume) and then moving it from there.

I'm not sure if there's a way to detect up-front whether Directory.Move will work or whether we have to catch the failure.

cc @wli3

Copy link
Member Author

Choose a reason for hiding this comment

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

I agree on using Directory.Move when possible, I'll make that change. However I don't think we can always depend on the metadata dir being in the same mount- for example, when we're copying advertising manifests into the user home I believe that's on a different mount on linux by default.

Copy link
Member

Choose a reason for hiding this comment

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

Is it possible that one of the target folders can be a symlink that crosses mount points?

Copy link

Choose a reason for hiding this comment

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

we kind of giving up the atomic move when we decided on using OS temp dir. So this is expected.

Although I am surprised Directory.Move will just fail

@radical
Copy link
Member

radical commented Jun 23, 2021

Should there be a new test to ensure that this doesn't regress?

@sfoslund
Copy link
Member Author

Should there be a new test to ensure that this doesn't regress?

This line causes existing tests to use different mounts/ drives, which repros the issue: https://github.com/dotnet/sdk/pull/18482/files#diff-81861764e6652051f255fa90e0aba2c3bc22f8bb020931fb7de60a5c5650174cR433

@sfoslund sfoslund merged commit f2b190a into dotnet:main Jun 25, 2021
@sfoslund sfoslund deleted the FileCopyMnts branch June 25, 2021 21:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Workload install copying across mounts error
5 participants