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

NumberFormatException because of tput No such device or address #15797

Closed
francisdb opened this issue Aug 1, 2022 · 1 comment
Closed

NumberFormatException because of tput No such device or address #15797

francisdb opened this issue Aug 1, 2022 · 1 comment

Comments

@francisdb
Copy link

francisdb commented Aug 1, 2022

Compiler version

3.1.3

Minimized code

echo "@main def main = println(util.Properties.versionMsg)" > test.scala
scala -nocompdaemon test.scala

This code is part of a docker build on a amazon amazoncorretto:17.0.4 base image
see sbt/docker-sbt#207

Output

tput: terminal attributes: No such device or address

Exception in thread "main" java.lang.NumberFormatException: For input string: ""
	at java.base/java.lang.NumberFormatException.forInputString(NumberFormatException.java:67)
	at java.base/java.lang.Integer.parseInt(Integer.java:678)
	at java.base/java.lang.Integer.parseInt(Integer.java:786)
	at scala.collection.StringOps$.toInt$extension(StringOps.scala:915)
	at dotty.tools.dotc.config.ScalaSettings$.defaultPageWidth(ScalaSettings.scala:39)
	at dotty.tools.dotc.config.CommonScalaSettings.$init$(ScalaSettings.scala:105)
	at dotty.tools.dotc.config.ScalaSettings.<init>(ScalaSettings.scala:14)
	at dotty.tools.dotc.core.Contexts$ContextBase.<init>(Contexts.scala:850)
	at dotty.tools.dotc.Driver.initCtx(Driver.scala:59)
	at dotty.tools.scripting.ScriptingDriver.compileAndRun(ScriptingDriver.scala:17)
	at dotty.tools.scripting.Main$.main(Main.scala:45)
	at dotty.tools.MainGenericRunner$.run$1(MainGenericRunner.scala:249)
	at dotty.tools.MainGenericRunner$.main(MainGenericRunner.scala:268)
	at dotty.tools.MainGenericRunner.main(MainGenericRunner.scala)

Expectation

This runs fine and prints the scala version

More info

introduced in #10304

https://github.com/lampepfl/dotty/blob/1130c52a6476d473b41a598e23f0415e0f8d76dc/dist/bin/common#L31-L34

docker run --rm amazoncorretto:17.0.4 tput
tput: No value for $TERM and no -T specified
docker run --rm amazoncorretto:17.0.4 tput -Tdumb cols
tput: terminal attributes: No such device or address

for reference eclipse temurin

docker run --rm eclipse-temurin:17.0.3_7-jdk tput -Tdumb cols
80

Fix

Probably this should default to 80 or not set COLUMNS in case tput fails?
see https://docs.scala-lang.org/scala3/guides/migration/options-new.html

Workaround

looks like -pagewidth 80 4f803eb was applied to tests to fix a similar issue

@francisdb francisdb added itype:bug stat:needs triage Every issue needs to have an "area" and "itype" label labels Aug 1, 2022
@WojciechMazur
Copy link
Contributor

Duplicate of #15796

@WojciechMazur WojciechMazur marked this as a duplicate of #15796 Aug 2, 2022
@WojciechMazur WojciechMazur closed this as not planned Won't fix, can't repro, duplicate, stale Aug 2, 2022
@WojciechMazur WojciechMazur removed itype:bug stat:needs triage Every issue needs to have an "area" and "itype" label labels Aug 2, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants