-
Notifications
You must be signed in to change notification settings - Fork 5.8k
JDK-8260966 (fs) Consolidate Linux and macOS implementations of UserDefinedFileAttributeView #2363
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 #2363
Conversation
👋 Welcome back overheadhunter! A progress list of the required criteria for merging this PR into |
@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. |
Ok I managed to get jtreg running in a Linux container now. Looks good:
|
/issue add JDK-8260691 |
@overheadhunter |
Mailing list message from Alan Bateman on nio-dev: On 02/02/2021 21:27, Sebastian Stenzel wrote:
Okay, one general remark here the overall patch is harder to review now
I would prefer if we left ENODATA so that it can be used in Linux
At a high-level then I think most of these suggestion changes are okay -Alan. |
Mailing list message from Sebastian Stenzel on nio-dev:
Just to save you some time: the PR has three separate commits, the first of them purely focused on moving stuff between files, actual code changes are in the two later commits. I forgot to mention that. |
Mailing list message from Alan Bateman on nio-dev: On 03/02/2021 15:49, Sebastian Stenzel wrote:
Ack! I will try to look at it more closely in the next few days. -Alan |
From what I can tell these changes look all right, but I think it would be easier to understand them if they were broken up into separate PRs. One problem here is that apparently this PR was created from a branch which already had the three commits on it. This causes there to be only one webrev encompassing all the changes in the three commits at once. Had the PR been created from a branch containing only the first commit and the other commits added one by one, then at least there would be an incremental webrev showing the changes made from one commit to the next. |
Mailing list message from Sebastian Stenzel on nio-dev: Ok, then I would propose to close and recreate the PR. I see two options: Push the first commit, wait for a review, push further commits. Or: Have only the first commit in this new PR, create a second PR. This requires you to create another ticket for cleanup tasks. |
Closing this in favour of #2604 |
I want to discuss the changes of this PR in three sections:
Deduplications
The main focus was to deduplicate code:
LinuxUserDefinedAttributeView
+BsdUserDefinedAttributeView
→UnixUserDefinedAttributeView
. Due to different supported length of attribute names, I made added an abstract methodUnixUserDefinedAttributeView. maxNameLength()
and kept the other two.LinuxNativeDispatcher
+BsdNativeDispatcher
→UnixNativeDispatcher
. I basically just moved the Linux implementation up to Unix. BSD-specific adjustments are now done in C.LinuxFileStore.isExtendedAttributesEnabled()
+BsdFileStore.isExtendedAttributesEnabled()
→UnixFileStore.isExtendedAttributesEnabled()
UnixConstants.ENODATA
andUnixConstants.ENOATTR
to a platform-agnosticUnixConstants.XATTR_NOT_FOUND
ENODATA
is no longer used JDK-internally, it might have been used via reflection in downstream projects, thus causing regressions. Maintainers should decide, if we might want to keepENODATA
additionally to the newXATTR_NOT_FOUND
.copyExtendedAttributes(int ofd, int nfd)
andlist()
Cleanup / Improvements
ENOTSUP
NativeBuffer implements AutoCloseable
and used try-with-resource statements where applicableflistxattr
fails due toERANGE
error (max recursion depth is 5, I don't expect performance benefits from loop unrolling, therefore chose reduced cyclomatic complexity over performance)UnixNativeDispatcher.SUPPORTS_XATTR
capability and added a shortcut toUnixFileStore. isExtendedAttributesEnabled(...)
to skip I/O that is known to faildlsym
for xattr-related Linux system calls (fixes JDK-8260691)Fixes
Files.copy(src, dst, StandardCopyOption.COPY_ATTRIBUTES)
now correctly copies xattr on macOS/BSD (invocation was missing before)dst.arrayOffset()
without checking ifdst.hasArray()
duringread()
. Code is now symmetric withwrite()
nb
duringwrite()
, iffile.openForAttributeAccess(...)
failsPlease note, that while the tests succeed on macOS,
so far I didn't manage to runEdit: Tests succeed on Linux, too.jtreg:test/jdk/java/nio/file/attribute/
on a Linux CI system due to lack of knowledge or will power 🙈Progress
Issues
Download
$ git fetch https://git.openjdk.java.net/jdk pull/2363/head:pull/2363
$ git checkout pull/2363