scala-cli icon indicating copy to clipboard operation
scala-cli copied to clipboard

`scala-cli compile . -w` in directory with non-ASCII characters results in `malloc: non-aligned pointer`

Open Poiku opened this issue 2 years ago • 1 comments

OS: macOS 12.6 Monterey

scala --version: Scala code runner version 3.3.0 -- Copyright 2002-2023, LAMP/EPFL

scala-cli --version: Scala CLI version: 1.0.4 Scala version (default): 3.3.0

java -version:openjdk version "17.0.8" 2023-07-18

OpenJDK Runtime Environment Temurin-17.0.8+7 (build 17.0.8+7)

OpenJDK 64-Bit Server VM Temurin-17.0.8+7 (build 17.0.8+7, mixed mode)

(Above installed with brew)

When running the command scala-cli compile . -w in a directory using non-ASCII characters (tested with "å", "ä", "ö", "ñ"), the compiler aborts with the following message (in this case in a directory named ñ) :

scala-cli(11470,0x10a418580) malloc: Non-aligned pointer 0x10f9c7648 being freed

scala-cli(11470,0x10a418580) malloc: *** set a breakpoint in malloc_error_break to debug

Abort trap: 6

This bug has occurred every time I've ran scala-cli compile . -w command in a directory containing non-ASCII characters.

Poiku avatar Oct 04 '23 13:10 Poiku

The bug seems to only be replicable on Mac machines with the native launcher. As a workaround, you can try to temporarily use the JVM launcher.

Example how to use the JVM launcher via coursier, for simplicity:

cd scala-cli-tests/weird-paths/åäö                                                                                                                       
cs launch org.virtuslab.scala-cli:cliBootstrapped:latest.release -M scala.cli.ScalaCli -- Hello.scala -w
# Hello, World
# Program exited with return code 0.
# Watching sources, press Ctrl+C to exit, or press Enter to re-run.

...or you can achieve the same by launching it with coursier from the standalone scala-cli launcher, really.

scala-cli -e 'println()' --dep org.virtuslab.scala-cli:cliBootstrapped:latest.release --main-class scala.cli.ScalaCli -- Hello.scala -w
# Hello, World
# Program exited with return code 0.
# Watching sources, press Ctrl+C to exit, or press Enter to re-run.

Gedochao avatar Oct 12 '23 05:10 Gedochao