Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Downgrade Jansi library to prevent kcadm exception on Windows#21926

Merged
vmuzikar merged 1 commit intokeycloak:mainfrom
Pepo48:issue-21851
Jul 26, 2023
Merged

Downgrade Jansi library to prevent kcadm exception on Windows#21926
vmuzikar merged 1 commit intokeycloak:mainfrom
Pepo48:issue-21851

Conversation

@Pepo48
Copy link
Contributor

@Pepo48 Pepo48 commented Jul 24, 2023

Closes #21851

The Quarkus Platform BOM that we introduced in #21426 contains jansi version 2.4.0. WindowsAnsiOutputStream isn't though present in the later versions of the library. org.jboss.aesh seems to use the older WindowsAnsiOutputStream, which is replaced by WindowsAnsiPrintStream in the more recent versions. Therefore, the easiest way to overcome the exception is to override back to the compatible version 1.18.

@Pepo48 Pepo48 requested a review from a team as a code owner July 24, 2023 18:47
Copy link
Contributor

@vmuzikar vmuzikar left a comment

Choose a reason for hiding this comment

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

@Pepo48 Thanks for the fix!

I'm not sure if downgrading is the long-term solution for us. The missing WindowsAnsiOutputStream is not considered a bug from Jansi side and migrating to WindowsAnsiPrintStream is probably not something we can easily do. Sticking to old version doesn't seem like an option even from the potential CVEs perspective. Maybe we could use some alternative solution for now?

@Pepo48
Copy link
Contributor Author

Pepo48 commented Jul 25, 2023

Maybe we could use some alternative solution for now?

Discussed offline. Since this is not a downgrade per se, but rather a revert to the state before introducing the Quarkus Platform BOM, we can live with it for now.

In the future we plan to get rid of the org.jboss.aesh dependency, which is actually the core of the issue here.

Copy link
Contributor

@vmuzikar vmuzikar left a comment

Choose a reason for hiding this comment

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

LGTM, thank you @Pepo48!

I'd like to wait for an additional review from someone with access to a Win machine. Maybe @ssilvert?

@mabartos
Copy link
Contributor

@vmuzikar @Pepo48 I can check it.

Copy link
Contributor

@mabartos mabartos left a comment

Choose a reason for hiding this comment

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

Unfortunately, I wasn't able to reproduce the issue with the latest upstream main, but as it's pretty difficult to reproduce it and the others have encountered the problem, the issue is valid for sure.

I tried this approach on the Win machine, and everything seems to be working as expected. I executed the command multiple times, made some experiments, and I've never faced the exception.

@Pepo48 @vmuzikar Thus, LGTM!

@Pepo48
Copy link
Contributor Author

Pepo48 commented Jul 26, 2023

no worries @mabartos, I couldn't reproduce it on an OpenStack VM as well - #21851 (comment). I've got "luck" only with my personal W11 machine.

Thanks for the review anyway!

@vmuzikar vmuzikar merged commit db49430 into keycloak:main Jul 26, 2023
@ahus1 ahus1 self-requested a review July 26, 2023 17:15
Copy link
Member

@ahus1 ahus1 left a comment

Choose a reason for hiding this comment

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

Better late than never: I tested 22.0.1 and reproduced the problem on a Windows machine, and also reproduced that this PR fixes it. Thanks!

@Pepo48
Copy link
Contributor Author

Pepo48 commented Jul 26, 2023

Better late than never: I tested 22.0.1 and reproduced the problem on a Windows machine, and also reproduced that this PR fixes it. Thanks!

Thanks for the review, @ahus1 🙂

@Pepo48 Pepo48 deleted the issue-21851 branch August 1, 2023 21:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

v22.0.1 - Windows: kcadm.bat gives Java Exception

4 participants