Skip to content

Incorrect spacing in build.properties causes sbt bash script to incorrectly choose to use native client #7587

@invadergir

Description

@invadergir

steps

  1. Use a computer that has sbt on it and bash (linux for sure, maybe macs?).
    • SBT version should be 1.10.0. (I've seen it on 1.9.7 as well.)
  2. Take an sbt project with an existing project/build.properties file, and modify the sbt.version line like so:
    • Remove all spaces to the left of the equal sign, and add one after the equal sign so it looks like this (for example): sbt.version= 1.9.4
  3. Run any sbt command.

problem

$ sbt clean
/opt/sbt/bin/sbt: line 741: ((: 1.9.4 >= 2 : syntax error: invalid arithmetic operator (error token is ".9.4 >= 2 ")
/opt/sbt/bin/sbt: line 741: ((: 1.9.4 >= 1 : syntax error: invalid arithmetic operator (error token is ".9.4 >= 1 ")
[info] welcome to sbt 1.9.4 (Eclipse Adoptium Java 17.0.9)

The current parsing of the sbt version in build.properties causes issues in the isRunNativeClient function because it can't compare the parsed values numerically. This in turn causes problems running the sbt server.

expectation

I would have expected the spaces in build.properties to not cause any issues.
The following two examples work:

sbt.version =1.9.4
sbt.version = 1.9.4

but the this one does not:

sbt.version= 1.9.4

notes

I have a PR already that trims the whitespace around the keys & values when they are read from build.properties, which fixes the issue: #7585

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions