Skip to content

Fix createParents in vminitd copy handler#590

Open
simone-panico wants to merge 1 commit intoapple:mainfrom
simone-panico:fix-create-parents
Open

Fix createParents in vminitd copy handler#590
simone-panico wants to merge 1 commit intoapple:mainfrom
simone-panico:fix-create-parents

Conversation

@simone-panico
Copy link

Respect createParents flag when creating the destination directory for archive extraction.

}
let destURL = URL(fileURLWithPath: path)
try FileManager.default.createDirectory(at: destURL, withIntermediateDirectories: true)
try FileManager.default.createDirectory(at: destURL, withIntermediateDirectories: request.createParents)
Copy link
Contributor

Choose a reason for hiding this comment

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

I feel like this should remain withIntermediateDirectories: true. We already make parent directories in L414. Directory here is to unpack the tar archive.

Copy link
Author

Choose a reason for hiding this comment

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

I can't do the retry-based approach in container#1190 without this because the CLI needs the first copyIn(src, dst/basename, createParents=false) to fail if dst doesn't exist.
If withIntermediateDirectories is always true, the createDirectory creates dst as a side effect, the copy lands at the wrong path and the error-based retry never triggers

Copy link
Contributor

Choose a reason for hiding this comment

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

Yes. We are stuck :(
Sorry for taking up your time. We'll think it over a bit more and let you know once we've decided on a direction.

Copy link
Author

Choose a reason for hiding this comment

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

No worries, take your time. Just let me know once you've settled on a direction :)

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.

2 participants