-
Notifications
You must be signed in to change notification settings - Fork 6.2k
8346059: [ASAN] awt_LoadLibrary.c reported compile warning ignoring return value of function by clang17 #22701
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
Conversation
…eturn value of function by clang17
|
👋 Welcome back syan! A progress list of the required criteria for merging this PR into |
|
@sendaoYan 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: 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 16 new commits pushed to the
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 |
|
@sendaoYan 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. |
| dladdr((void *)AWT_OnLoad, &dlinfo); | ||
| realpath((char *)dlinfo.dli_fname, buf); | ||
| if (realpath((char *)dlinfo.dli_fname, buf) == NULL) { | ||
| perror((char *)dlinfo.dli_fname); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Having error handling is better than no error handling, but is perror the best we can do?
OTOH, maybe it doesn't matter as much. Something would be very, very broken if this were to fail.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I saw this in another bug report too from the same submitter.
I don't know that I want to encourage this as a pattern, except in debug builds. better might be to just copy dlinfo.dli_fname into buf ..
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
perror will print the given message accrording the previous errno info to stderr, so this change will not change the original behaviour.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @prrace,
I saw this in another bug report too from the same submitter.
I did create 3 clang17 compile waring issues, the compile warings occur in different files, and maybe use should different solutions to solve the issue, so I create the separate issues.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
better might be to just copy dlinfo.dli_fname into buf
"Something would be very, very broken if this were to fail.", So I think perror maybe better, it will print which file and the reason get realpath fail.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should I combine 3 similar issues(JDK-8346104/JDK-8346103/JDK-8346059) to 1 issue
I personally would probably have started out by making a single issue for these, since they all try to address the same new warning in clang, and are all in client code, and only split it up later if reviewers had requested it. But since you have created separate issues, I suggest you do not change things now. Also, the other two I believe need a more serious response; a write to a pipe has a somewhat more realistic chance at failure than this filename lookup.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry for the confuse. I mean this PR change nothing except it will print a message to stderr when realpath return NULL. Thanks magicus.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why did you integrate this ?
It did not yet have my approval even though I was clearly reviewing it.
Nor did it have the required 2nd reviewer, in fact did it not have ANY reviewer from the client team which is responsible for this code.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @prrace , sorry for the rash integrated. I can backout or redo this change quickly if it's necessary. If I should redo or backport this PR, please let me known.
I will pay more attention for the future PRs.
Apologize for the rash integrated again.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@prrace I don't think it is reasonable for you to blame @sendaoYan for integrating. He had a review from a Reviewer, and he waited 24 hours after that before integrating. The general JDK rule is that one review is enough; Hotspot as a special case requires two. Your comment did not say that you wanted to review it further, nor did you clearly request any changes, just a vague idea of replacing realpath with a strcpy (which seems like much more risky, and potentially incorrect, change!)
The responsibility for this PR is mine. I had reviewed and approved the PR. I did consider if I should increase the number of reviewers and state that a client team reviewer was also needed, but decided against it. That was my decision as a reviewer. The PR was clearly unproblematic. It added some extra logging in case something gets terribly wrong. Without this fix, AWT would just break without any indication whatsoever if something did go wrong with realpath. With this fix, this unlikely problem will at least get some indication. I did not think this needed confirmation from the client team as well.
magicus
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me.
That was entirely a waste of time and hasn't proved anything. If you examine the content of those tiers you will not find even a single test that loads AWT ! Try running the jdk_desktop group instead. |
Thanks your advice. Mine meaning was verify this change will not cause new failures, since it will not change behaviour in theory. I have run all the jtreg tests except test/hotspot/jtreg/vmTestbase/ and test/hotspot/jtreg/applications/, which has include jdk_desktop. |
|
Compile warning of JDK-8346059 was introduced recently, Compile warnings of JDK-8346104/JDK-8346103 has exists for several years. So I want to deal with JDK-8346059 separately make other issues can be backported to jdk21u-dev or jdk17u-dev cleanly. |
Well, yes, but to prove that you do need to run tests that actually exercise the code. |
|
Thanks all for the reviews. /integrate |
|
Going to push as commit 367c304.
Your commit was automatically rebased without conflicts. |
|
@sendaoYan Pushed as commit 367c304. 💡 You may see a message that your pull request was closed with unmerged commits. This can be safely ignored. |
|
Drive-By comment: I think we should avoid See https://pubs.opengroup.org/onlinepubs/007904875/functions/perror.html "The perror() function shall map the error number accessed through the symbol errno to a language-dependent error message" |
Hi all,
This PR fix file src/java.desktop/unix/native/libawt/awt/awt_LoadLibrary.c reported compile warning "ignoring return value of function" by clang17, which add check the return value of
realpathfunction. Risk is low.Progress
Issue
Reviewers
Reviewing
Using
gitCheckout this PR locally:
$ git fetch https://git.openjdk.org/jdk.git pull/22701/head:pull/22701$ git checkout pull/22701Update a local copy of the PR:
$ git checkout pull/22701$ git pull https://git.openjdk.org/jdk.git pull/22701/headUsing Skara CLI tools
Checkout this PR locally:
$ git pr checkout 22701View PR using the GUI difftool:
$ git pr show -t 22701Using diff file
Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/22701.diff
Using Webrev
Link to Webrev Comment