Skip to content
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

8336375: Crash on paste to JShell #20182

Closed
wants to merge 1 commit into from
Closed

Conversation

lahodaj
Copy link
Contributor

@lahodaj lahodaj commented Jul 15, 2024

On Windows, the ScrollConsoleScreenBufferW function is being looked like this:

static final MethodHandle ScrollConsoleScreenBufferW$MH = downcallHandle(

I.e. the parameters are MemorySegments/pointers. But, it is being invoked like this:
mh$.invokeExact(hConsoleOutput, lpScrollRectangle, lpClipRectangle, dwDestinationOrigin, lpFill);

I.e. with values rather than with pointers. This then fails at runtime when the function is called with an exception like:

Caused by: java.lang.invoke.WrongMethodTypeException: handle's method type (MemorySegment,MemorySegment,MemorySegment,MemorySegment,MemorySegment)int but found (MemorySegment,SMALL_RECT,SMALL_RECT,COORD,CHAR_INFO)int
        at java.base/java.lang.invoke.Invokers.newWrongMethodTypeException(Invokers.java:521)
        at java.base/java.lang.invoke.Invokers.checkExactType(Invokers.java:530)
        at jdk.internal.le/jdk.internal.org.jline.terminal.impl.ffm.Kernel32.ScrollConsoleScreenBuffer(Kernel32.java:239)

The proposal here is to use MemorySegments embedded in the provided parameters. This is consistent with the rest of the file, see for example here:

return (int) mh$.invokeExact(hConsoleOutput, wAttribute, nLength, dwWriteCoord.seg, lpNumberOfAttrsWritten);


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

Reviewers

Reviewing

Using git

Checkout this PR locally:
$ git fetch https://git.openjdk.org/jdk.git pull/20182/head:pull/20182
$ git checkout pull/20182

Update a local copy of the PR:
$ git checkout pull/20182
$ git pull https://git.openjdk.org/jdk.git pull/20182/head

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 20182

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

Using diff file

Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/20182.diff

Webrev

Link to Webrev Comment

@bridgekeeper
Copy link

bridgekeeper bot commented Jul 15, 2024

👋 Welcome back jlahoda! 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
Copy link

openjdk bot commented Jul 15, 2024

@lahodaj 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:

8336375: Crash on paste to JShell

Reviewed-by: jvernee

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 no new commits pushed to the master branch. If another commit should be pushed before you perform the /integrate command, your PR will be automatically rebased. If you prefer to avoid any potential automatic rebasing, please check the documentation for the /integrate command for further details.

➡️ To integrate this PR with the above commit message to the master branch, type /integrate in a new comment.

@openjdk openjdk bot added the rfr Pull request is ready for review label Jul 15, 2024
@openjdk
Copy link

openjdk bot commented Jul 15, 2024

@lahodaj The following label will be automatically applied to this pull request:

  • kulla

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.

@mlbridge
Copy link

mlbridge bot commented Jul 15, 2024

Webrevs

Copy link
Member

@JornVernee JornVernee left a comment

Choose a reason for hiding this comment

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

Looks good from the FFM perspective

@openjdk openjdk bot added the ready Pull request is ready to be integrated label Jul 15, 2024
@liach
Copy link
Member

liach commented Jul 16, 2024

Is this a bug in the shipped library? If yes, is it already fixed there, or do we plan to report or fix in the upstream?

@lahodaj
Copy link
Contributor Author

lahodaj commented Jul 16, 2024

Is this a bug in the shipped library? If yes, is it already fixed there, or do we plan to report or fix in the upstream?

It was definitely an intent to send to JLine as well, done here:
jline/jline3#1038

@lahodaj
Copy link
Contributor Author

lahodaj commented Jul 17, 2024

/integrate

@lahodaj
Copy link
Contributor Author

lahodaj commented Jul 17, 2024

/backport jdk jdk23

@openjdk
Copy link

openjdk bot commented Jul 17, 2024

Going to push as commit b9b0b85.
Since your change was applied there have been 27 commits pushed to the master branch:

Your commit was automatically rebased without conflicts.

@openjdk openjdk bot added the integrated Pull request has been integrated label Jul 17, 2024
@openjdk openjdk bot closed this Jul 17, 2024
@openjdk openjdk bot removed ready Pull request is ready to be integrated rfr Pull request is ready for review labels Jul 17, 2024
@openjdk
Copy link

openjdk bot commented Jul 17, 2024

@lahodaj Pushed as commit b9b0b85.

💡 You may see a message that your pull request was closed with unmerged commits. This can be safely ignored.

@openjdk
Copy link

openjdk bot commented Jul 17, 2024

@lahodaj the backport was successfully created on the branch backport-lahodaj-b9b0b850-jdk23 in my personal fork of openjdk/jdk. To create a pull request with this backport targeting openjdk/jdk:jdk23, just click the following link:

➡️ Create pull request

The title of the pull request is automatically filled in correctly and below you find a suggestion for the pull request body:

Hi all,

This pull request contains a backport of commit b9b0b850 from the openjdk/jdk repository.

The commit being backported was authored by Jan Lahoda on 17 Jul 2024 and was reviewed by Jorn Vernee.

Thanks!

If you need to update the source branch of the pull then run the following commands in a local clone of your personal fork of openjdk/jdk:

$ git fetch https://github.com/openjdk-bots/jdk.git backport-lahodaj-b9b0b850-jdk23:backport-lahodaj-b9b0b850-jdk23
$ git checkout backport-lahodaj-b9b0b850-jdk23
# make changes
$ git add paths/to/changed/files
$ git commit --message 'Describe additional changes made'
$ git push https://github.com/openjdk-bots/jdk.git backport-lahodaj-b9b0b850-jdk23

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 kulla [email protected]
Development

Successfully merging this pull request may close these issues.

3 participants