Skip to content

8315506: C99 compatibility issue in LinuxNativeDispatcher #362

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 2 commits into from

Conversation

fweimer-rh
Copy link
Contributor

@fweimer-rh fweimer-rh commented Sep 1, 2023

The Java_sun_nio_fs_LinuxNativeDispatcher_getlinelen function calls the free function without including <stdlib.h>. This results in an implicit function declarations, and some compilers no longer support that by default, leading to a build failure.

Per the comment in the file, this function was introduced in the backport from jdk11, so this bug is specific to jdk8u.

Patch originally submitted by @djdelorie as openjdk/jdk8u#42.

Related to:


Progress

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

Issue

  • JDK-8315506: C99 compatibility issue in LinuxNativeDispatcher (Bug - P4)

Reviewers

Contributors

  • DJ Delorie <dj@redhat.com>

Reviewing

Using git

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

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

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 362

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

Using diff file

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

Webrev

Link to Webrev Comment

@bridgekeeper
Copy link

bridgekeeper bot commented Sep 1, 2023

👋 Welcome back fweimer! 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 added the rfr Pull request is ready for review label Sep 1, 2023
@openjdk
Copy link

openjdk bot commented Sep 1, 2023

@fweimer-rh Syntax: /contributor (add|remove) [@user | openjdk-user | Full Name <email@address>]. For example:

  • /contributor add @openjdk-bot
  • /contributor add duke
  • /contributor add J. Duke <duke@openjdk.org>

User names can only be used for users in the census associated with this repository. For other contributors you need to supply the full name and email address.

@mlbridge
Copy link

mlbridge bot commented Sep 1, 2023

Webrevs

@jerboaa
Copy link
Contributor

jerboaa commented Sep 1, 2023

/contributor add DJ Delorie <dj@redhat.com>

@openjdk
Copy link

openjdk bot commented Sep 1, 2023

@jerboaa Only the author (@fweimer-rh) is allowed to issue the contributor command.

@fweimer-rh
Copy link
Contributor Author

/contributor add DJ Delorie dj@redhat.com

@openjdk
Copy link

openjdk bot commented Sep 1, 2023

@fweimer-rh
Contributor DJ Delorie <dj@redhat.com> successfully added.

Copy link
Contributor

@jerboaa jerboaa left a comment

Choose a reason for hiding this comment

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

LGTM.

@jerboaa
Copy link
Contributor

jerboaa commented Sep 1, 2023

For the future please enable GHA on your fork! Thanks.

@openjdk
Copy link

openjdk bot commented Sep 1, 2023

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

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

8315506: C99 compatibility issue in LinuxNativeDispatcher

Co-authored-by: DJ Delorie <dj@redhat.com>
Reviewed-by: sgehwolf, 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 1 new commit pushed to the master branch:

  • 6632d0a: 8315135: Memory leak in the native implementation of Pack200.Unpacker.unpack()

Please see this link for an up-to-date comparison between the source branch of this pull request and the master branch.
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 (@jerboaa, @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 added the ready Pull request is ready to be integrated label Sep 1, 2023
@fweimer-rh
Copy link
Contributor Author

/integrate

For the future please enable GHA on your fork! Thanks.

Already done.

@openjdk openjdk bot added the sponsor Pull request is ready to be sponsored label Sep 1, 2023
@openjdk
Copy link

openjdk bot commented Sep 1, 2023

@fweimer-rh
Your change (at version f5eaefe) is now ready to be sponsored by a Committer.

@jerboaa
Copy link
Contributor

jerboaa commented Sep 1, 2023

For the future please enable GHA on your fork! Thanks.

Already done.

Could you please trigger test runs for this? I don't see them. Also, please don't integrate without approval on the bug.

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.

The function that introduces the free was added in UnixNativeDispatcher.c on 11u, which had a stdlib.h import since creation. As mentioned on the bug report, it was moved to LinuxNativeDispatcher.c in the backport of JDK-8229872 to 8u, so this is 8u-specific.

Patch looks ok for 8u. Please run the GHA tests and then add jdk8u-fix-request to the bug, with a note on why this should be included.

@gnu-andrew
Copy link
Member

Out of interest, what flags are you building with to make this a build failure? I've not seen that when building 8u. I don't believe this code is built with -Werror by default.

@fweimer-rh
Copy link
Contributor Author

Out of interest, what flags are you building with to make this a build failure? I've not seen that when building 8u. I don't believe this code is built with -Werror by default.

@gnu-andrew This was originally detected with an instrumented compilers that treats such issues errors, and logs them so that build scripts have a hard time suppressing errors (relevant to configure scripts).

Current Clang defaults -Werror=implict-function-declaration, so no special build flags are necessary there to trigger this issue (but I haven't tried building OpenJDK with Clang). For quite some time, expected GCC 14 to something like this as well, but I'm not sure if things will work out.

Speaking of flags, I plan to add -Werror=implict-function-declaration -Werror=implicit-int to the default flags in Fedora. Should I backport this change proactively to the java-1.8.0-openjdk-portable?

@openjdk openjdk bot removed the sponsor Pull request is ready to be sponsored label Sep 1, 2023
@gnu-andrew
Copy link
Member

Out of interest, what flags are you building with to make this a build failure? I've not seen that when building 8u. I don't believe this code is built with -Werror by default.

@gnu-andrew This was originally detected with an instrumented compilers that treats such issues errors, and logs them so that build scripts have a hard time suppressing errors (relevant to configure scripts).

Ah, that explains why I haven't seen it. I have built with some newer GCCs and even have a PR in flight to get GCC 11 working (#357 - still need to work out why that is failing on cross-compile)

Current Clang defaults -Werror=implict-function-declaration, so no special build flags are necessary there to trigger this issue (but I haven't tried building OpenJDK with Clang). For quite some time, expected GCC 14 to something like this as well, but I'm not sure if things will work out.

I think later JDK versions should support Clang, but probably not 8u. I did have backporting support on a long TODO list at one point, but it's probably not worth it at this stage. That said, the situation might be better due to the MacOS support that's been added since, making Linux Clang support less problematic.

If we did support it, we'd probably need to add a build-only run with Clang to GHA.

Speaking of flags, I plan to add -Werror=implict-function-declaration -Werror=implicit-int to the default flags in Fedora. Should I backport this change proactively to the java-1.8.0-openjdk-portable?

Do you mean this change or the additional flags? I thought this change was already in there.

There is a -Wno-error added in the Fedora build which I expect may cancel this out even if the flags you suggest are added. -Werror=implicit-function-declaration is certainly a useful one to have and one I ran with myself locally for a while. But fixing stuff like that in a JDK as old as 8u might be problematic and I'd certainly start with java-21-openjdk first.

@jerboaa
Copy link
Contributor

jerboaa commented Sep 4, 2023

Thanks for the test run trigger. I'll sponsor.

@jerboaa
Copy link
Contributor

jerboaa commented Sep 4, 2023

/sponsor

@openjdk
Copy link

openjdk bot commented Sep 4, 2023

@jerboaa The PR has been updated since the change author (@fweimer-rh) issued the integrate command - the author must perform this command again.

@fweimer-rh
Copy link
Contributor Author

/integrate

@openjdk openjdk bot added the sponsor Pull request is ready to be sponsored label Sep 4, 2023
@openjdk
Copy link

openjdk bot commented Sep 4, 2023

@fweimer-rh
Your change (at version d089e82) is now ready to be sponsored by a Committer.

@fweimer-rh
Copy link
Contributor Author

Speaking of flags, I plan to add -Werror=implict-function-declaration -Werror=implicit-int to the default flags in Fedora. Should I backport this change proactively to the java-1.8.0-openjdk-portable?

Do you mean this change or the additional flags? I thought this change was already in there.

No, it's not yet integrated into Fedora rawhide. Hopefully this week.

There is a -Wno-error added in the Fedora build which I expect may cancel this out even if the flags you suggest are added. -Werror=implicit-function-declaration is certainly a useful one to have and one I ran with myself locally for a while. But fixing stuff like that in a JDK as old as 8u might be problematic and I'd certainly start with java-21-openjdk first.

It was the only issue in our tests. That was a couple of months ago, but presumably the change rate in 8u is not that high.

@jerboaa
Copy link
Contributor

jerboaa commented Sep 4, 2023

/sponsor

@openjdk
Copy link

openjdk bot commented Sep 4, 2023

Going to push as commit 89a08b3.
Since your change was applied there has been 1 commit pushed to the master branch:

  • 6632d0a: 8315135: Memory leak in the native implementation of Pack200.Unpacker.unpack()

Your commit was automatically rebased without conflicts.

@openjdk openjdk bot added the integrated Pull request has been integrated label Sep 4, 2023
@openjdk openjdk bot closed this Sep 4, 2023
@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 Sep 4, 2023
@openjdk
Copy link

openjdk bot commented Sep 4, 2023

@jerboaa @fweimer-rh Pushed as commit 89a08b3.

💡 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
integrated Pull request has been integrated
Development

Successfully merging this pull request may close these issues.

4 participants