Skip to content

Conversation

@wkia
Copy link

@wkia wkia commented Mar 10, 2025

This is backport of "8309841: Jarsigner should print a warning if an entry is removed"

Original patch does not apply cleanly to jdk8:

  • some minor conflicts in JDK code
  • files moved to appropriate locations
  • added the check in jdk/src/share/classes/sun/security/tools/jarsigner/Main.java at line 1196

in tests:

  • ed25519 algorithm was replaced with RSA in RemovedFiles.java
  • JarEntry copyEntry() procedure was manually added to JarUtils.java to make JarUtilsTest working.
  • the tests were adapted to Java 8, including replaced Path.of, Files.writeString, package names, and arrays processing as well.

We need this fix in jdk8, as all versions have this issue with jarsigner.

New tests successfully ran locally on Linux, x86_64.


Progress

  • Change must be properly reviewed (1 review required, with at least 1 Reviewer)
  • Change requires CSR request JDK-8334261 to be approved
  • Change must not contain extraneous whitespace
  • Commit message must refer to an issue
  • JDK-8309841 needs maintainer approval

Issues

  • JDK-8309841: Jarsigner should print a warning if an entry is removed (Enhancement - P3 - Approved)
  • JDK-8334261: Jarsigner should print a warning if an entry is removed (CSR)

Reviewers

Reviewing

Using git

Checkout this PR locally:
$ git fetch https://git.openjdk.org/jdk8u-dev.git pull/635/head:pull/635
$ git checkout pull/635

Update a local copy of the PR:
$ git checkout pull/635
$ git pull https://git.openjdk.org/jdk8u-dev.git pull/635/head

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 635

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

Using diff file

Download this PR as a diff file:
https://git.openjdk.org/jdk8u-dev/pull/635.diff

Using Webrev

Link to Webrev Comment

@bridgekeeper
Copy link

bridgekeeper bot commented Mar 10, 2025

👋 Welcome back rmarchenko! 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
Copy link

openjdk bot commented Mar 10, 2025

@wkia This change now passes all automated pre-integration checks.

After integration, the commit message for the final commit will be:

8309841: Jarsigner should print a warning if an entry is removed

Reviewed-by: andrew

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 no new commits pushed to the master branch. If another commit should be pushed before you perform the /integrate command, your PR will be automatically rebased. If you prefer to avoid any potential 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 (@gnu-andrew) but any other Committer may sponsor as well.

➡️ To flag this PR as ready for integration with the above commit message, type /integrate in a new comment. (Afterwards, your sponsor types /sponsor in a new comment to perform the integration).

@openjdk openjdk bot changed the title Backport bdfb41f977258831e4b0ceaef5d016d095ab6e7f 8309841: Jarsigner should print a warning if an entry is removed Mar 10, 2025
@openjdk
Copy link

openjdk bot commented Mar 10, 2025

This backport pull request has now been updated with issue from the original commit.

@openjdk openjdk bot added backport Port of a pull request already in a different code base rfr Pull request is ready for review labels Mar 10, 2025
@mlbridge
Copy link

mlbridge bot commented Mar 10, 2025

Webrevs

Copy link
Member

@gnu-andrew gnu-andrew left a comment

Choose a reason for hiding this comment

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

Patch mostly looks good, but I think we should backport JDK-8240235 first in its own PR. It is little more than the copyEntry method you've imported here, but also fixes other cases in JarUtils.java where it should also be used.

Also, should java.nio.file.StandardCopyOption be imported in JarUtils.java? I see the import being added but no reference to it added in the code.

@wkia
Copy link
Author

wkia commented Mar 21, 2025

@gnu-andrew

Patch mostly looks good, but I think we should backport JDK-8240235 first in its own PR.

Ok, if it's needed. I will do this.

Also, should java.nio.file.StandardCopyOption be imported in JarUtils.java? I see the import being added but no reference to it added in the code.

There is the line 297:

Files.move(tmpfile, jarfile, StandardCopyOption.REPLACE_EXISTING);

@wkia
Copy link
Author

wkia commented Mar 21, 2025

@gnu-andrew BTW JDK-8240235 modifies a line in updateJarFile procedure which was added by JDK-8211171. Do you think JDK-8211171 should be backported also?

@gnu-andrew
Copy link
Member

@gnu-andrew

Patch mostly looks good, but I think we should backport JDK-8240235 first in its own PR.

Ok, if it's needed. I will do this.

I think it would be good to fix the existing bug in updateJar if we are bringing in the method that provides the fix anyway. Otherwise, we have different behaviour in updateJar and the new deleteEntries.

Also, should java.nio.file.StandardCopyOption be imported in JarUtils.java? I see the import being added but no reference to it added in the code.

There is the line 297:

Files.move(tmpfile, jarfile, StandardCopyOption.REPLACE_EXISTING);

Ah, thanks. I now see why I was confused here. The import is unique to 8u because 11u already has it via JDK-8211171 but the code that uses it is new to both, so the former showed up as a difference between the 8u & 11u patches, but not the latter. I should have checked the actual patch.

@gnu-andrew
Copy link
Member

@gnu-andrew BTW JDK-8240235 modifies a line in updateJarFile procedure which was added by JDK-8211171. Do you think JDK-8211171 should be backported also?

I was just looking at the same bug with respect to where the import statement came from in 11u. I think 8211171 might be useful for 8u, but it's a bit involved to require for this change, as it updates numerous tests which use JarUtils. I'm happy for a JDK-8240235 to just update the existing method, updateJar. I'll take a look at 8211171 and include the updated line in that backport if I decide to go ahead.

@gnu-andrew
Copy link
Member

@gnu-andrew BTW JDK-8240235 modifies a line in updateJarFile procedure which was added by JDK-8211171. Do you think JDK-8211171 should be backported also?

I was just looking at the same bug with respect to where the import statement came from in 11u. I think 8211171 might be useful for 8u, but it's a bit involved to require for this change, as it updates numerous tests which use JarUtils. I'm happy for a JDK-8240235 to just update the existing method, updateJar. I'll take a look at 8211171 and include the updated line in that backport if I decide to go ahead.

Incidentally, the main reason for 8211171 was that there were two JarUtils in 11u under jdk and jaxp. The jaxp one is not present in 8u so there's no duplication issue.

@wkia wkia changed the base branch from master to pr/640 March 24, 2025 15:59
@openjdk
Copy link

openjdk bot commented Mar 24, 2025

@wkia this pull request can not be integrated into pr/640 due to one or more merge conflicts. To resolve these merge conflicts and update this pull request you can run the following commands in the local repository for your personal fork:

git checkout b8309841
git fetch https://git.openjdk.org/jdk8u-dev.git pr/640
git merge FETCH_HEAD
# resolve conflicts and follow the instructions given by git merge
git commit -m "Merge pr/640"
git push

@openjdk openjdk bot added the merge-conflict Pull request has merge conflict with target branch label Mar 24, 2025
@openjdk
Copy link

openjdk bot commented Mar 24, 2025

@wkia Please do not rebase or force-push to an active PR as it invalidates existing review comments. Note for future reference, the bots always squash all changes into a single commit automatically as part of the integration. See OpenJDK Developers’ Guide for more information.

@openjdk openjdk bot removed the merge-conflict Pull request has merge conflict with target branch label Mar 24, 2025
@wkia wkia changed the base branch from pr/640 to master March 26, 2025 14:49
@wkia wkia requested a review from gnu-andrew March 26, 2025 15:11
Copy link
Member

@gnu-andrew gnu-andrew left a comment

Choose a reason for hiding this comment

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

Thanks for backporting JDK-8240235 and updating this patch on top of it. The merged version looks good to go.

@openjdk
Copy link

openjdk bot commented Mar 26, 2025

⚠️ @wkia This change is now ready for you to apply for maintainer approval. This can be done directly in each associated issue or by using the /approval command.

@wkia
Copy link
Author

wkia commented Mar 27, 2025

/approval request I'd like to backport this to 8u-dev. We need this fix in jdk8, as it has this issue with jarsigner. Original patch does not apply cleanly to jdk8, some minor conflicts resolved, files moved to appropriate locations, tests adapted. New tests successfully ran locally on Linux, x86_64.

@openjdk
Copy link

openjdk bot commented Mar 27, 2025

@wkia
8309841: The approval request has been created successfully.

@openjdk openjdk bot added the approval Requires approval; will be removed when approval is received label Mar 27, 2025
@gnu-andrew
Copy link
Member

/approve yes

@openjdk
Copy link

openjdk bot commented Mar 27, 2025

@gnu-andrew
8309841: The approval request has been approved.

@openjdk openjdk bot added ready Pull request is ready to be integrated and removed approval Requires approval; will be removed when approval is received labels Mar 27, 2025
@wkia
Copy link
Author

wkia commented Mar 27, 2025

/integrate

@openjdk openjdk bot added the sponsor Pull request is ready to be sponsored label Mar 27, 2025
@openjdk
Copy link

openjdk bot commented Mar 27, 2025

@wkia
Your change (at version 75504f7) is now ready to be sponsored by a Committer.

@gnu-andrew
Copy link
Member

/sponsor

@openjdk
Copy link

openjdk bot commented Mar 27, 2025

Going to push as commit b256b1a.

@openjdk openjdk bot added the integrated Pull request has been integrated label Mar 27, 2025
@openjdk openjdk bot closed this Mar 27, 2025
@openjdk openjdk bot removed ready Pull request is ready to be integrated rfr Pull request is ready for review sponsor Pull request is ready to be sponsored labels Mar 27, 2025
@openjdk
Copy link

openjdk bot commented Mar 27, 2025

@gnu-andrew @wkia Pushed as commit b256b1a.

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

@wkia wkia deleted the b8309841 branch March 27, 2025 17:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport Port of a pull request already in a different code base integrated Pull request has been integrated

Development

Successfully merging this pull request may close these issues.

2 participants