-
Notifications
You must be signed in to change notification settings - Fork 5.8k
JDK-8310265: (process) jspawnhelper should not use argv[0] #14531
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
👋 Welcome back stuefe! A progress list of the required criteria for merging this PR into |
Webrevs
|
Paging @simonis :) |
and @RogerRiggs of course. I think this is simple though, and the process tests succeeded in GHAs. |
(also ran test/jdk/java/lang/Process* locally on linux x64) |
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. While doing my recent jspawnhelper
fixes I wondered why we're passing our arguments in argv[0]
but I didn't wanted to change it because it is not really required by any standard.
I agree however, that it still makes sense to adhere to conventions :) especially because this will probably simplify the handling of the next jspawnhelper
issue because it will be easier to discover the process with system tools if something should go wrong :)
hlpargs[1] = 0; | ||
/* NULL-terminated argv array. | ||
* argv[0] contains path to jspawnhelper, to follow conventions. | ||
* argv[1] contains the fd string as argument to the helper cmd |
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.
May want to use "jspawnhelper" instead of "the helper app" and terminate the sentence with a period to be consistent with the previous comment.
@tstuefe 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 28 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 |
@@ -136,7 +136,7 @@ void initChildStuff (int fdin, int fdout, ChildStuff *c) { | |||
int main(int argc, char *argv[]) { | |||
ChildStuff c; | |||
struct stat buf; | |||
/* argv[0] contains the fd number to read all the child info */ | |||
/* argv[1] contains the fd number to read all the child info */ |
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 would prefer to also fix the use of argc-1
below to match. Its a pretty odd form and might trip someone later.
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 wondered about this, it looked so deliberate. So I wondered whether jspawnhelper is used outside of the posix_spawn context, but cannot find anything. Maybe historic?
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'm not aware of any other uses either; its not intended to be used outside of ProcessImpl especially since the addition of the new protocol to communicate parameters and confirm launching of the child.
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.
This curiosity has been present since Rob's first version:
https://mail.openjdk.org/pipermail/core-libs-dev/2012-November/012417.html
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 assumed that at some point in its life, maybe just in the first unpublished versions, the jspawnhelper had a variable number of arguments, possibly from different callers. But the fd-string was always supposed to be the last one. Then this would have made perfect sense.
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.
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.
Still good :)
Thanks @simonis and @RogerRiggs ! /integrate |
Going to push as commit 47d00a4.
Your commit was automatically rebased without conflicts. |
/backport jdk21u |
@luhenry Could not apply backport |
/backport jdk17u |
/backport jdk11u |
@luhenry Could not automatically backport
Please fetch the appropriate branch/commit and manually resolve these conflicts by using the following commands in your personal fork of openjdk/jdk17u. Note: these commands are just some suggestions and you can use other equivalent commands you know.
Once you have resolved the conflicts as explained above continue with creating a pull request towards the openjdk/jdk17u with the title |
@luhenry Could not automatically backport
Please fetch the appropriate branch/commit and manually resolve these conflicts by using the following commands in your personal fork of openjdk/jdk11u. Note: these commands are just some suggestions and you can use other equivalent commands you know.
Once you have resolved the conflicts as explained above continue with creating a pull request towards the openjdk/jdk11u with the title |
Reported by jarabekit@gmail.com [1]
jspawnhelper uses argv[0] to receive the fd string from the parent. That breaks with conventions and trips over certain tools like binfmt_misc.
For details, see linked ML discussion.
[1] https://mail.openjdk.org/pipermail/core-libs-dev/2023-June/107738.html
Progress
Issue
Reviewers
Reviewing
Using
git
Checkout this PR locally:
$ git fetch https://git.openjdk.org/jdk.git pull/14531/head:pull/14531
$ git checkout pull/14531
Update a local copy of the PR:
$ git checkout pull/14531
$ git pull https://git.openjdk.org/jdk.git pull/14531/head
Using Skara CLI tools
Checkout this PR locally:
$ git pr checkout 14531
View PR using the GUI difftool:
$ git pr show -t 14531
Using diff file
Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/14531.diff
Webrev
Link to Webrev Comment