Skip to content

[1.x] Bump Jansi to 3.27.1 #7872

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

Closed
wants to merge 2 commits into from
Closed

Conversation

Friendseeker
Copy link
Member

@Friendseeker Friendseeker commented Nov 5, 2024

Fixes #7865

Changes compared to Jansi 2.4.1 (summarized from https://github.com/jline/jline3/commits/master/jansi-core)

Tested locally on Windows via running sbt on a small test project. Tab completion & history are working.

@@ -93,7 +93,7 @@ object Dependencies {
val jline3Native = "org.jline" % "jline-native" % jline3Version
val jline3Reader = "org.jline" % "jline-reader" % jline3Version
val jline3Builtins = "org.jline" % "jline-builtins" % jline3Version
val jansi = "org.fusesource.jansi" % "jansi" % "2.4.1"
val jansi = "org.jline" % "jansi-core" % jline3Version
Copy link
Member

Choose a reason for hiding this comment

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

Changing a library dependency, which internally holds native code, might have potential to break a bunch of things downstream. For example console loads Scala REPL, which likely also uses similar JLine + JAnsi combo. We might try this out first on sbt 2.x side first?

Copy link
Member Author

Choose a reason for hiding this comment

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

Indeed good to be careful. Btw other than console (Scala 2.12, Scala 2.13, Scala 3), what are things to look for?

Copy link
Member

Choose a reason for hiding this comment

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

I think the main diamond problem we should watch out for is console. If I recall correctly sbt takes over the classloading of JLine (and JAnsi too maybe?), so if it works with a few on the operating system, it should be ok for most.

Another angle we might need to watch out for is sbtn building.

Copy link
Member Author

@Friendseeker Friendseeker Nov 6, 2024

Choose a reason for hiding this comment

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

This PR should be safe in terms of diamond dependency issue, since

  • None of scala2, scala3 relies on jansi-core
  • None of scala2, scala3 relies on org.fusesource.jansi
  • None of scala2, scala3 relies on jline-terminal-jansi
  • org.fusesource.jansi still exists in sbt classpath though https://github.com/sbt/jline2, so downstream & sbt's classloader would still have org.fusesource.jansi in their classpath. (So even if some downstream relies on org.fusesource.jansi, it is still available).

Furthermore jansi-core contains no native code (as can be seen in https://github.com/jline/jline3/tree/8852b39c788f8d3d9158aeb3aa8d067153a4eaae/jansi-core), paired with the fact that org.fusesource.jansi still exists in classpath, indicates that there's likely no native code specific issue.

However I definitely understand the concern (considering that we released broken Linux sbtn not so long ago). Since this PR is non-essential (as #7865 can be fixed alternatively via sbt/jline2#6), we can make this PR target 2.x if the risk is deemed too high.

Copy link
Member Author

@Friendseeker Friendseeker Nov 7, 2024

Choose a reason for hiding this comment

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

Tested sbt console on a Scala 2.12.20 project, a Scala 2.13.15 project and a Scala 3.3.4 project on Windows. On all 3 projects, console works properly.

Shall then test sbtn console on Windows/Mac and then sbt console on Mac.

Copy link
Member

Choose a reason for hiding this comment

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

If jansi doesn't have native code, then hopefully it won't break sbtn building. I think the next step would be to publish a new version of https://github.com/sbt/jline2.

Copy link
Member Author

Choose a reason for hiding this comment

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

I made a commit to test sbtn build here: Friendseeker/sbtn-dist@91efb1f

The build succeeded. I am currently testing whether sbtn console actually works using the built sbtn.

Copy link
Member Author

@Friendseeker Friendseeker Nov 8, 2024

Choose a reason for hiding this comment

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

If jansi doesn't have native code, then hopefully it won't break sbtn building. I think the next step would be to publish a new version of https://github.com/sbt/jline2.

Your concern about sbtn is spot on. Friendseeker/sbtn-dist@91efb1f succeeded but the resulting windows sbtn build is nonfunctional:

PS D:\Repos\21315> & 'C:\Users\Jerry Tan\AppData\Local\Coursier\cache\arc\https\github.com\sbt\sbt\releases\download\v1.10.4\sbt-1.10.4.zip\sbt\bin\sbtn-new.exe'
Nov 07, 2024 6:02:17 PM org.jline.utils.Log logr
WARNING: Unable to create a system terminal, creating a dumb terminal (enable debug logging for more information)
[info] entering *experimental* thin client - BEEP WHIRR
[info] terminate the server with `shutdown`
[info] disconnect from the server with `exit`

(The sbt shell freezes and does not respond to any input).

Copy link
Member Author

Choose a reason for hiding this comment

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

The issue is probably with usage of org.jline.jansi-core instead of org.jline.jansi. I am making the switch right now and shall retest the cartesian product of [Scala 2.12 project, Scala 2.13 project, Scala 3.3.4 project], [Windows, Mac], [sbt console, sbtn console].

But yeah I see how native image demonstrates Murphy's Law now... I shall keep this PR up here merely for testing purpose. Once all tests passes we shall cherry pick the PR commits to target develop branch and close this PR.

@Friendseeker Friendseeker reopened this Nov 6, 2024
@Friendseeker Friendseeker marked this pull request as draft November 8, 2024 02:10
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.

Windows ARM issue
2 participants