RFR: JDK-8310265: (process) jspawnhelper should not use argv[0] [v2]

Volker Simonis simonis at openjdk.org
Mon Jun 19 12:57:12 UTC 2023


On Mon, 19 Jun 2023 06:07:26 GMT, Thomas Stuefe <stuefe at openjdk.org> wrote:

>> Reported by [jarabekit at gmail.com](mailto:jarabekit at 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
>
> Thomas Stuefe has updated the pull request incrementally with one additional commit since the last revision:
> 
>   correct comment

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](https://stackoverflow.com/questions/2050961/is-argv0-name-of-executable-an-accepted-standard-or-just-a-common-conventi).

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 :)

src/java.base/unix/native/libjava/ProcessImpl_md.c line 500:

> 498:     /* NULL-terminated argv array.
> 499:      * argv[0] contains path to jspawnhelper, to follow conventions.
> 500:      * argv[1] contains the fd string as argument to the helper cmd

May want to use "jspawnhelper" instead of "the helper app" and terminate the sentence with a period to be consistent with the previous comment.

-------------

Marked as reviewed by simonis (Reviewer).

PR Review: https://git.openjdk.org/jdk/pull/14531#pullrequestreview-1486159389
PR Review Comment: https://git.openjdk.org/jdk/pull/14531#discussion_r1234016774


More information about the core-libs-dev mailing list