jdk icon indicating copy to clipboard operation
jdk copied to clipboard

8305072: Win32ShellFolder2.compareTo is inconsistent

Open aivanov-jdk opened this issue 1 year ago • 4 comments
trafficstars

The implementation of Win32ShellFolder2.compareTo is inconsistent: there are cases where
a < b & b < c but a == c
which violates its general contract.

In particular, it happens for the personal folder (Documents) if it is listed twice: as a special and as a regular folder.

The evaluation performed by the submitter of the bug provided enough details to create a test, reproduce the problem and finally resolve it.

Without the fix, the regression test always fails:

a < b & b < c but a >= c
where
  a = C:\Users\<user>\Documents(true)
  b = C:\Users\<user>(false)
  c = C:\Users\<user>\Documents(false)

as well as for the reverse case: a > b & b > c.

How it is possible to have the same folder in a list of files twice remains unknown. I believe it is another bug in JDK, however, no one has been able to reproduce it so far.


Progress

  • [ ] Change must be properly reviewed (1 review required, with at least 1 Reviewer)
  • [x] Change must not contain extraneous whitespace
  • [x] Commit message must refer to an issue

Issue

  • JDK-8305072: Win32ShellFolder2.compareTo is inconsistent (Bug - P4)

Reviewing

Using git

Checkout this PR locally:
$ git fetch https://git.openjdk.org/jdk.git pull/18126/head:pull/18126
$ git checkout pull/18126

Update a local copy of the PR:
$ git checkout pull/18126
$ git pull https://git.openjdk.org/jdk.git pull/18126/head

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 18126

View PR using the GUI difftool:
$ git pr show -t 18126

Using diff file

Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/18126.diff

Webrev

Link to Webrev Comment

aivanov-jdk avatar Mar 05 '24 17:03 aivanov-jdk

:wave: Welcome back aivanov! A progress list of the required criteria for merging this PR into master will be added to the body of your pull request. There are additional pull request commands available for use with this pull request.

bridgekeeper[bot] avatar Mar 05 '24 17:03 bridgekeeper[bot]

@aivanov-jdk The following label will be automatically applied to this pull request:

  • client

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.

openjdk[bot] avatar Mar 05 '24 17:03 openjdk[bot]

Webrevs

mlbridge[bot] avatar Mar 05 '24 17:03 mlbridge[bot]

@aivanov-jdk 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:

8305072: Win32ShellFolder2.compareTo is inconsistent

Reviewed-by: prr, serb

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 532 new commits pushed to the master branch:

  • dd930c573b2822e7f55e9d1b9a945a023c3fdee6: 8329787: Fix typo in CLDRConverter
  • 115f4193eb39d8469ac8127e38798a3f041c22e0: 8329659: Serial: Extract allowed_dead_ratio from ContiguousSpace
  • 9ac3b77d0d69227ded6ef3843ebf5c18ceee37b5: 8329775: Serial: Remove unused declarations in serialFullGC.hpp
  • 747582484ce89e16661ef917a89adb52f5adc2e6: 8329510: Update ProblemList for JFileChooser/8194044/FileSystemRootTest.java
  • 6439375bb96346f4b34ba57e8e61ffe1905563f1: 8329533: TestCDSVMCrash fails on libgraal
  • 3ebf8c9359da2f45e4cefb7be2276d33c30979aa: 8329663: hs_err file event log entry for thread adding/removing should print current thread
  • be45de1f93e918f928c6bb8bebc3697487adf602: 8328627: JShell documentation should be clearer about "remote runtime system"
  • 8648890f86fb3d869950614c97c2df648352168d: 8329749: Obsolete the unused UseNeon flag
  • fc18201bbdac7ac7d78767c780d3efe5352ee77a: 8327111: Replace remaining usage of create_bool_from_template_assertion_predicate() which requires additional OpaqueLoop*Nodes transformation strategies
  • 7c664657630a50ab83d218028cec114ea2d907ac: 8325088: Overloads that differ in type parameters may be lost
  • ... and 522 more: https://git.openjdk.org/jdk/compare/8f6edd8dc866bf970b7e7b8358f62832887e6e8b...master

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 master branch, type /integrate in a new comment.

openjdk[bot] avatar Mar 13 '24 20:03 openjdk[bot]

Any other reviewer?

aivanov-jdk avatar Apr 08 '24 17:04 aivanov-jdk

/integrate

aivanov-jdk avatar Apr 09 '24 13:04 aivanov-jdk

Going to push as commit 2fcb816858406f33cefef3164b2c85f9f996c7da. Since your change was applied there have been 552 commits pushed to the master branch:

  • 635cb3c9762aeaec6c8dd2c21b8323d187236b4f: 8329745: Update the documentation of ServerSocket and Socket to refer to StandardSocketOptions instead of legacy SocketOptions
  • 5c9f03686d77dd56c0441f9eb54b1cfcd3a49b3c: 8329858: G1: Make G1VerifyLiveAndRemSetClosure stateless
  • 492b954f81f75cedec50fabc4e6071cabb53acc0: 8329750: Change Universe functions to return more specific Klass* types
  • 87131fb2f77188a483fd0852da5f9228aafd5336: 8329629: GC interfaces should work directly against nmethod instead of CodeBlob
  • 5ea21c3a61a7a159d1b88885368741763f42bf04: 8329878: Reduce public interface of CardTableBarrierSet
  • a48289ac30a6a9ddc9941676726d105b11689ab3: 8329761: Remove unused KeyBuilder and unusedSets from StyleContext
  • 8907eda779f0c3f870bb31deb74c0a483251f1e2: 8325485: IncrementInstructions.of(int, int) is not storing the args
  • b9331cd25ca88b07ce079405f5e3031cf8c13ea6: 8329823: RISC-V: Need to sync CPU features with related JVM flags
  • 71c5bbcec7052a8394dd49c0a8c46801adbfcae4: 8329527: Opcode.IFNONNULL.primaryTypeKind() is not ReferenceType
  • 58e39c193211579316cfd09dc4117d510e317985: 8329884: Serial: Fix build failure due to ‘Copy’ has not been declared
  • ... and 542 more: https://git.openjdk.org/jdk/compare/8f6edd8dc866bf970b7e7b8358f62832887e6e8b...master

Your commit was automatically rebased without conflicts.

openjdk[bot] avatar Apr 09 '24 13:04 openjdk[bot]

@aivanov-jdk Pushed as commit 2fcb816858406f33cefef3164b2c85f9f996c7da.

:bulb: You may see a message that your pull request was closed with unmerged commits. This can be safely ignored.

openjdk[bot] avatar Apr 09 '24 13:04 openjdk[bot]

Will this be backported to Java 21 and 22? It would be very helpful if it could be.

uckelman avatar Apr 29 '24 12:04 uckelman

Will this be backported to Java 21 and 22? It would be very helpful if it could be.

It is already backported to 22. I'm working on backporting it to all supported Oracle releases of Java. It is up to the OpenJDK community to backport the changeset into OpenJDK-based releases.

aivanov-jdk avatar Apr 29 '24 13:04 aivanov-jdk