-
Notifications
You must be signed in to change notification settings - Fork 150
8334433: jshell.exe runs an executable test.exe on startup #2362
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
base: master
Are you sure you want to change the base?
Conversation
This reverts commit 263c196.
|
👋 Welcome back tkurashige! A progress list of the required criteria for merging this PR into |
|
❗ This change is not yet ready to be integrated. |
|
This backport pull request has now been updated with issue from the original commit. |
|
Could anyoen revew this PR? |
1 similar comment
|
Could anyoen revew this PR? |
phohensee
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.
I'm not an expert in this area, and the patch amounts to new code, but it looks reasonable. You mention that FfmTerminalProvider doesn't exist in 21u, and that seems to motivate much of the new code. Perhaps backporting that first would make this backport straightforward.
|
Thank you for your comment! |
phohensee
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.
Thanks for the explanation. Lgtm.
|
|
|
/approval request Backporting this patch resolves the problem that unintended executable 'test' is executed. |
|
@kurashige23 |
|
Sorry for sudden mention, if you have time, could you check this PR? Thanks. |
|
Hi @kurashige23 |
|
/reviewers 2 Please get a second review from a jshell expert on this. |
|
Hi @lahodaj Sorry for sudden mention, could you check this PR? |
This is a backport of JDK-8334433 : jshell.exe runs an executable test.exe on startup
This bug began occurring in jdk21 due to the backport of JDK-8327476 (it likely also occurs in 17 and 11).
Original patch does not apply cleanly, there are the following differences:
・ExecTerminalProvider.java
Because of the presence of
FfmTerminalProviderin the original patch,isPosixSystemStreamis not executed on Windows, so test.exe is not executed. However, in jdk21, there is noFfmTerminalProvider, soisPosixSystemStreamis executed and if thePATHcontains the path of the directory containing unintended test.exe, this test.exe will be executed. To avoid this, I fixed to execute justisWindowsSystemStreamon Windows (not including Cygwin and MSYS).・OSUtils.java
The original patch hardcoded the paths where test command is located in the Posix environment, but these paths are virtual, so if you are using Cygwin or MSYS, you must specify a Windows path (Usually C:\cygwin64\bin or C:\msys64\usr\bin), otherwise
isExecutablewill not be true, and eventuallyisPosixSystemStreamwill not be able to execute the intended test.exe. To solve this problem, Cygwin or MSYS usescygpathto specify the actual path on Windows. (In the original fix,isPosixSystemStreamis not executed on Cygwin or MSYS, so this does not matter.)・ConsoleIOContext.java
Since there is no
FfmTerminalProviderin jdk21, the original fix is not applicable. Therefore, no fix was made for ConsoleIOContext.java.・TerminalNoExecTest.java
The original fix confirms that no processes are created, but since there is no
FfmTerminalProviderin jdk21, the test command is executed.In jdk21, this fix causes the intended test command to run. Therefore, I created a test
TerminalExecTest.shandTerminalExecTest.javato verify that the intended executable `test` was executed. (The reason for creating TerminalExecTest.sh is commented within it. To put it simply, I created it due to environmental variable considerations.)Testing:
・test/jdk/jdk/internal/jline, :langtools_jshell and test/jdk/sun/tools/jhsdb/JShellHeapDumpTest.java on RHEL9.4 and Windows Server 2022(Cygwin and MSYS), GHA testing
・I manually verified that the problem described in JDK-8334433's Description does not reproduce in Windows Command Prompt.
Thanks.
Progress
Issue
Reviewers
Reviewing
Using
gitCheckout this PR locally:
$ git fetch https://git.openjdk.org/jdk21u-dev.git pull/2362/head:pull/2362$ git checkout pull/2362Update a local copy of the PR:
$ git checkout pull/2362$ git pull https://git.openjdk.org/jdk21u-dev.git pull/2362/headUsing Skara CLI tools
Checkout this PR locally:
$ git pr checkout 2362View PR using the GUI difftool:
$ git pr show -t 2362Using diff file
Download this PR as a diff file:
https://git.openjdk.org/jdk21u-dev/pull/2362.diff
Using Webrev
Link to Webrev Comment