-
Notifications
You must be signed in to change notification settings - Fork 5.8k
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
8293122: (fs) Use file cloning in macOS version of Files::copy method #10188
Conversation
👋 Welcome back bpb! A progress list of the required criteria for merging this PR into |
Webrevs
|
// Attempt to clone the source unless cloning is not supported, | ||
// cancellation is not possible, or attributes are not to be copied | ||
if (!cloneFileNotSupported && addressToPollForCancel == 0 && | ||
flags.copyPosixAttributes) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This will need some thought as this means it will only be used when Files.copy is invoked with the COPY_ATTRIBUTES option.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
clonefile
appears to copy all attributes so if it is acceptable for that to occur if COPY_ATTRIBUTES
is not set, then the flags.copyPosixAttributes
check could be removed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My opinion is that the improved throughput outweighs any detriment from copying attributes when COPY_ATTRIBUTES is not specified and so the flags.copyPosixAttributes check should be removed.
…ure; remove getattrlist
@bplb This change now passes all automated pre-integration checks. ℹ️ This project also has non-automated pre-integration requirements. Please see the file CONTRIBUTING.md for details. After integration, the commit message for the final commit will be:
You can use pull request commands such as /summary, /contributor and /issue to adjust it as needed. At the time when this comment was updated there had been 25 new commits pushed to the
As there are no conflicts, your changes will automatically be rebased on top of these commits when integrating. If you prefer to avoid this automatic rebasing, please check the documentation for the /integrate command for further details. ➡️ To integrate this PR with the above commit message to the |
{ | ||
// Attempt to clone the source unless cancellation is not possible, | ||
// or attributes are not to be copied | ||
if (addressToPollForCancel == 0 && flags.copyPosixAttributes) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It wouldn't be wrong to drop the check for copyPosixAttributes here, in which case they would be copied by default (the spec allows for that). The only issue is that someone might become dependent on this and then be surprised when they code behaves differently when run on another platform.
I'm curious if there is a way to test how clone behaves when it fails. What you have is okay although the unlink might only be needed when chown fails.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The only issue is that someone might become dependent on this and then be surprised when they code behaves differently when run on another platform.
This is a good reason to leave it as-is.
I'm curious if there is a way to test how clone behaves when it fails. What you have is okay although the unlink might only be needed when chown fails.
All the described error numbers except EIO are things which one would expect the call to verify before actually starting to clone, so for those cases it would be unexpected to find that the destination exists after the failure. Provoking an EIO failure might be difficult.
/integrate |
Going to push as commit a75ddb8.
Your commit was automatically rebased without conflicts. |
Use BSD system call
clonefile
if possible when usingFiles::copy
on macOS.Progress
Issue
Reviewers
Reviewing
Using
git
Checkout this PR locally:
$ git fetch https://git.openjdk.org/jdk pull/10188/head:pull/10188
$ git checkout pull/10188
Update a local copy of the PR:
$ git checkout pull/10188
$ git pull https://git.openjdk.org/jdk pull/10188/head
Using Skara CLI tools
Checkout this PR locally:
$ git pr checkout 10188
View PR using the GUI difftool:
$ git pr show -t 10188
Using diff file
Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/10188.diff