Skip to content

8276123: ZipFile::getEntry will not return a file entry when there is a directory entry of the same name within a Zip File #6342

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

Closed
wants to merge 3 commits into from

Conversation

LanceAndersen
Copy link
Contributor

@LanceAndersen LanceAndersen commented Nov 10, 2021

Hi all,

This patch addresses a regression introduced in JDK 15 via JDK-8242959 where you can no longer access a file entry contained within a Zip file when there is also a directory entry with the same name via ZipFile:getEntry().

Once fixed, the behavior will be consistent with earlier JDK releases.

Mach5 tiers 1-3 have been run without failure

Best
Lance


Progress

  • Change must not contain extraneous whitespace
  • Commit message must refer to an issue
  • Change must be properly reviewed

Issue

  • JDK-8276123: ZipFile::getEntry will not return a file entry when there is a directory entry of the same name within a Zip File

Reviewers

Reviewing

Using git

Checkout this PR locally:
$ git fetch https://git.openjdk.java.net/jdk pull/6342/head:pull/6342
$ git checkout pull/6342

Update a local copy of the PR:
$ git checkout pull/6342
$ git pull https://git.openjdk.java.net/jdk pull/6342/head

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 6342

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

Using diff file

Download this PR as a diff file:
https://git.openjdk.java.net/jdk/pull/6342.diff

@LanceAndersen LanceAndersen marked this pull request as ready for review November 10, 2021 20:51
@bridgekeeper
Copy link

bridgekeeper bot commented Nov 10, 2021

👋 Welcome back lancea! 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.

@openjdk openjdk bot changed the title 8276123: ZipFile::getEntry will not return a file entry when there is a directory entry of the same name within a Zip File 8276123: ZipFile::getEntry will not return a file entry when there is a directory entry of the same name within a Zip File Nov 10, 2021
@openjdk openjdk bot added the rfr Pull request is ready for review label Nov 10, 2021
@openjdk
Copy link

openjdk bot commented Nov 10, 2021

@LanceAndersen The following label will be automatically applied to this pull request:

  • core-libs

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 openjdk bot added the core-libs core-libs-dev@openjdk.org label Nov 10, 2021
@mlbridge
Copy link

mlbridge bot commented Nov 10, 2021

Webrevs

Copy link
Member

@cl4es cl4es left a comment

Choose a reason for hiding this comment

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

LGTM!

return buffer.toByteArray();
}

/**
Copy link
Member

Choose a reason for hiding this comment

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

Left-over?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thank you for the quick review Claes!

I was going to remove this method but chose to leave it in to make it a bit more straight forward to port to JDK 8 (which I have run the test on as well). No strong preferences, just figured leaving it there might make it slightly easier for a back port.

@openjdk
Copy link

openjdk bot commented Nov 10, 2021

@LanceAndersen 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:

8276123: ZipFile::getEntry will not return a file entry when there is a directory entry of the same name within a Zip File

Reviewed-by: redestad, alanb

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

  • 13deb38: 8276848: sun.net.httpserver.simpleserver.CommandLinePositiveTest: test does not specify port
  • 710f496: 8273277: C2: Move conditional negation into rc_predicate
  • 6b833db: 8275329: ZGC: vmTestbase/gc/gctests/SoftReference/soft004/soft004.java fails with assert(_phases->length() <= 1000) failed: Too many recored phases?
  • 1e941de: 8275197: Remove unused fields in ThaiBuddhistChronology
  • 6954b98: 8186670: Implement _onSpinWait() intrinsic for AArch64
  • 3445e50: 8276265: jcmd man page is outdated
  • 0ca0acf: 8276947: Clarify how DateTimeFormatterBuilder.appendFraction handles value ranges
  • b0d7a9d: 8276994: java/nio/channels/Channels/TransferTo.java leaves multi-GB files in /tmp
  • 8aae88b: 8276763: java/nio/channels/SocketChannel/AdaptorStreams.java fails with "SocketTimeoutException: Read timed out"
  • 6f35eed: 8079267: [TEST_BUG] Test java/awt/Frame/MiscUndecorated/RepaintTest.java fails
  • ... and 190 more: https://git.openjdk.java.net/jdk/compare/63b9f8c0da2ed3634002f0f67b18555826aeddc4...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 openjdk bot added the ready Pull request is ready to be integrated label Nov 10, 2021
@LanceAndersen
Copy link
Contributor Author

/integrate

@openjdk
Copy link

openjdk bot commented Nov 12, 2021

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

  • 0d2980c: 8258192: Obsolete the CriticalJNINatives flag
  • 5a2452c: 8274835: Remove unnecessary castings in java.base
  • 3b2585c: 8276658: Clean up JNI local handles code
  • aeba653: 8276743: Make openjdk build Zip Archive generation "reproducible"
  • 51a5731: 8277016: Use blessed modifier order in jdk.httpserver
  • c4b4432: 8277012: Use blessed modifier order in src/utils
  • 13deb38: 8276848: sun.net.httpserver.simpleserver.CommandLinePositiveTest: test does not specify port
  • 710f496: 8273277: C2: Move conditional negation into rc_predicate
  • 6b833db: 8275329: ZGC: vmTestbase/gc/gctests/SoftReference/soft004/soft004.java fails with assert(_phases->length() <= 1000) failed: Too many recored phases?
  • 1e941de: 8275197: Remove unused fields in ThaiBuddhistChronology
  • ... and 196 more: https://git.openjdk.java.net/jdk/compare/63b9f8c0da2ed3634002f0f67b18555826aeddc4...master

Your commit was automatically rebased without conflicts.

@openjdk openjdk bot closed this Nov 12, 2021
@openjdk openjdk bot added integrated Pull request has been integrated and removed ready Pull request is ready to be integrated rfr Pull request is ready for review labels Nov 12, 2021
@openjdk
Copy link

openjdk bot commented Nov 12, 2021

@LanceAndersen Pushed as commit b85500e.

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
core-libs core-libs-dev@openjdk.org integrated Pull request has been integrated
Development

Successfully merging this pull request may close these issues.

4 participants