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
JDK-8260966 (fs) Consolidate Linux and macOS implementations of UserDefinedFileAttributeView #2604
Conversation
cleanup UnixNativeDispatcher
👋 Welcome back overheadhunter! A progress list of the required criteria for merging this PR into |
/issue add JDK-8260691 |
@overheadhunter The following label will be automatically applied to this pull request:
When this pull request is ready to be reviewed, an "RFR" email will be sent to the corresponding mailing list. If you would like to change these labels, use the /label pull request command. |
@overheadhunter |
Webrevs
|
Thanks for spitting up the steps in the refactoring as it makes it easier to review. One other thing that is still creating noise in the patch is that I think your IDE or editor has changed the formatting to 8 space indent in several places where the original code in LinuxUserDefinedFileAttributeView.java was 4 space indent. We've typically used 4 space indent in this code. If you revert those indentations then I think it will reduce the size of the patch and make it easy for us to see where the real changes are. |
Mailing list message from Sebastian Stenzel on nio-dev: Can you show me an example, where you see an 8 space indentation? |
UnixUserDefinedFileAttributeView L41, L58, L73, L125-126, L151-152, L207, ... so looks like changes from the original code in LinuxUserDefinedFileAttributeView, might be the IDE did it. It's not a big deal, just noise in the patch. |
…d LinuxNativeDispatcher
@bplb @AlanBateman Now that there is a webrev just for the deduplication, can I already amend further changes or wait for each set of changes to be reviewed individually? Sorry, I'm still new to the processes. |
It might be better to split the changes across two or three PRs, as appropriate. |
Thanks for the update patch, this is much easier to read now. Overall I think this looks good with only a few minor discussion points that I'll add to the PR. I agree with @bplb that it's best to integrate this once we've finished the review. Another issue/PR can be used for the other refactoring/modernization that you want to do. |
I originally intended to also add one further commit that avoids unnecessary I/O in Also, I deduplicated code inside of Just let me know, if you think there is anything more to be done in this PR. |
Anything I need to do to request a review? |
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.
Overall I think this looks good, just a few minor nits with the method descriptions on protected methods (they don't actually need to be protected of course).
private static final String USER_NAMESPACE = "user."; | ||
|
||
// returns the maximum supported length of xattr names (in bytes, including namespace) | ||
protected abstract int maxNameLength(); |
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.
I think we should move this declaration to after the constructor to avoid having an abstract method declared in the middle of private API elements. I'd probably use /** .. */ style for the method description as it's not private.
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.
Will change the comment style.
Regarding method order: I agree. However, this class needs refactoring due to code duplication and complex branching anyway, as I have proposed in my original PR. I can sure move this single method, but then it will still be "field, field, method, method, field, field, constructor, method, ..."
Having this in mind, can you confirm this should be done in this PR or don't you think it'd fit into the follow-up cleanup better?
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.
If it's okay with you, then I'd prefer to do it in this PR. So let's get this PR out of the way and then discuss the refactoring in a follow-on PR.
@@ -172,6 +172,27 @@ public Object getAttribute(String attribute) throws IOException { | |||
throw new UnsupportedOperationException("'" + attribute + "' not recognized"); | |||
} | |||
|
|||
// returns true if extended attributes enabled on file system where given | |||
// file resides, returns false if disabled or unable to determine. | |||
protected boolean isExtendedAttributesEnabled(UnixPath path) { |
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 used to be private method in LinuxFileStore, now it's a protected method so might be cleaner to change the method description to use /** .. */ comment as it's used from sub-classes.
Applied discussed changes. @AlanBateman can you sponsor this? |
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.
Thanks for the update.
A minor nit is that the new javadoc for isExtendedAttributesEnabled means there is 100+ line in the source file, mildly annoying when reviewing diffs in side-by-side view.
@overheadhunter 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 169 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. As you do not have Committer status in this project an existing Committer must agree to sponsor your change. Possible candidates are the reviewers of this PR (@AlanBateman) but any other Committer may sponsor as well. ➡️ To flag this PR as ready for integration with the above commit message, type |
/integrate |
@overheadhunter |
Just out of curiosity, since I only see the diff in GitHub or via my local git client: Are these webrev things somehow related to the review process and mess this up? In an earlier comment, brian suggested that individual commits in git are somehow "squashed" by webrev, causing all the review pain in the original PR in the first place. I know this is off-topic, but I just want to understand what things I need to be aware of, if I contribute further patches. I have the feeling that Skara wasn't so much about transitioning to git and GitHub but rather added a bridge between those and some internal tooling. |
Some people look at the diffs in on github where it's possible to customize the view. Some people look use the generated webrev. There's a bot that generates the webrev and adds a link to the PR, look for the comment from "mlbridge" ("mailing list bridge"). |
/integrate |
@AlanBateman Only the author (@overheadhunter) is allowed to issue the |
/sponsor |
@AlanBateman @overheadhunter Since your change was applied there have been 169 commits pushed to the
Your commit was automatically rebased without conflicts. Pushed as commit 0de6abd. 💡 You may see a message that your pull request was closed with unmerged commits. This can be safely ignored. |
Unfortunately this broke AIX and I don't know if this would work on BSD (not sure if anyone still maintains those). |
Mailing list message from Sebastian Stenzel on nio-dev:
Oh sh... Well, since this is merely an access modifier, it is easy to fix. While I could easily do this, I'd be flying blind here, since I can't test on AIX. |
If you do a PR, I can test it for you. |
(you could leave it as draft PR to avoid spamming the mailing lists) |
Mailing list message from Alan Bateman on nio-dev: On 03/03/2021 06:53, Thomas Stuefe wrote:
The BSD port is in maintained downstream rather than in OpenJDK and no We aren't required to do any building or testing on AIX prior to -Alan |
Mailing list message from Sebastian Stenzel on nio-dev:
Here you go: https://github.com//pull/2805 <https://github.com//pull/2805> |
Mailing list message from Thomas St��fe on nio-dev: Hi Alan, On Wed, Mar 3, 2021 at 8:31 AM Alan Bateman <Alan.Bateman at oracle.com> wrote:
No problem, we are aware of that and usually fix without much noise. Also, In this case I was afraid, due to the PR title, that this fix would involve As for BSD, the hotspot os sources in particular contain code which seems Thanks, Thomas
-------------- next part -------------- |
@ArnoZeller will take care of the AIX build issue. Thanks, Sebastian, for the quick response. |
Mailing list message from Sebastian Stenzel on nio-dev:
Maybe you didn't see my previous mail, but I created a PR already: https://github.com//pull/2805 <https://github.com//pull/2805> |
Mailing list message from Zeller, Arno on nio-dev: Hi Sebastian, your PR looks good and fixes the issue. I had a similar change open but not created a pull request till now. I tested it in our build environment and it works. Best regards, From: nio-dev <nio-dev-retn at openjdk.java.net> On Behalf Of Sebastian Stenzel On 3. Mar 2021, at 10:51, Thomas Stuefe <stuefe at openjdk.java.net<mailto:stuefe at openjdk.java.net>> wrote: On Wed, 3 Mar 2021 07:26:51 GMT, Thomas Stuefe <stuefe at openjdk.org<mailto:stuefe at openjdk.org>> wrote: If you do a PR, I can test it for you. (you could leave it as draft PR to avoid spamming the mailing lists) @ArnoZeller will take care of the AIX build issue. Thanks, Sebastian, for the quick response. Maybe you didn't see my previous mail, but I created a PR already: https://github.com//pull/2805 |
Deduplicated code in these classes:
LinuxUserDefinedAttributeView
+BsdUserDefinedAttributeView
→UnixUserDefinedAttributeView
. Due to different supported length of attribute names, I added an abstract methodUnixUserDefinedAttributeView.maxNameLength()
.LinuxNativeDispatcher
+BsdNativeDispatcher
→UnixNativeDispatcher
. I basically just moved the Linux implementation up to Unix and added preprocessor directives to distinguish Linux/BSD/Other. Others will throw ENOTSUP UnixExceptions.LinuxFileStore.isExtendedAttributesEnabled()
+BsdFileStore.isExtendedAttributesEnabled()
→UnixFileStore.isExtendedAttributesEnabled()
For the latter I introduced
UnixConstants.XATTR_NOT_FOUND
, which isENODATA
on Linux andENOATTR
on BSD. Note thatUnixConstants.ENODATA
is still present, as @AlanBateman "would prefer if we left ENODATA so that it can be used in Linux specific code" (Quote from #2363 (comment))This also fixes
Files.copy(src, dst, StandardCopyOption.COPY_ATTRIBUTES)
on macOS/BSD. Previosly an invocation was missing.I plan to add further commits to clean up this code, once the deduplication is reviewed.
Progress
Issues
Reviewers
Download
$ git fetch https://git.openjdk.java.net/jdk pull/2604/head:pull/2604
$ git checkout pull/2604