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

AshScriptPlugin uses bash syntax to process args #1302

Closed
gregsymons opened this issue Feb 3, 2020 · 2 comments · Fixed by #1303
Closed

AshScriptPlugin uses bash syntax to process args #1302

gregsymons opened this issue Feb 3, 2020 · 2 comments · Fixed by #1303
Labels
bug docker universal Zip, tar.gz, tgz and bash issues

Comments

@gregsymons
Copy link
Contributor

Expected behaviour

sbt docker:stage should generate an ash/dash compatible script in target/docker/stage/opt/docker/bin

Actual behaviour

The generated script contains syntax specific to bash (and other less posixy shells). Specifically, the generated process_args () function uses the [[ syntax for test, which is not available in strictly compliant shells like as ash and dash.

Information

  • What sbt-native-packager are you using: 1.6.0
  • What sbt version: 1.2.8
  • What is your build system (e.g. Ubuntu, MacOS, Windows, Debian ): OS X and Ubuntu
  • What package are you building: docker
  • What version has your build tool:
    (this is my local version, but I've also seen it in our CI builds, which are Ubuntu-based, but run the same docker version)
Client: Docker Engine - Community
 Version:           19.03.5
 API version:       1.40
 Go version:        go1.12.12
 Git commit:        633a0ea
 Built:             Wed Nov 13 07:22:34 2019
 OS/Arch:           darwin/amd64
 Experimental:      false

Server: Docker Engine - Community
 Engine:
  Version:          19.03.5
  API version:      1.40 (minimum version 1.12)
  Go version:       go1.12.12
  Git commit:       633a0ea
  Built:            Wed Nov 13 07:29:19 2019
  OS/Arch:          linux/amd64
  Experimental:     false
 containerd:
  Version:          v1.2.10
  GitCommit:        b34a5c8af56e510852c35414db4c1f4fa6172339
 runc:
  Version:          1.0.0-rc8+dev
  GitCommit:        3e425f80a8c931f88e6d94a8c831b9d5aa481657
 docker-init:
  Version:          0.18.0
  GitCommit:        fec3683
  • What is your target system: For the docker image, our base image is based off adoptopenjdk-13-bionic (though we execute the build with with the system openjdk 8 due to incompatibilities between our internal build plugin and sbt 1.3.x)

This is actually pretty easy to fix; it was brought in on #1255, and you can see it on line 61 and lines 83 and 84. Fortunately, if you don't have args to parse, or are running on a base image where /bin/sh really is bash, the script works fine, but if you need to parse args on ash/dash, I expect you will not get the desired behavior.

If I get the chance to later this week I'll try to open a PR for it, but thought I'd give ya'll a heads up.

@gregsymons
Copy link
Contributor Author

This is probably related to #1264, since both issues look like they stem from the same commit.

@muuki88 muuki88 added docker universal Zip, tar.gz, tgz and bash issues bug labels Feb 10, 2020
@muuki88
Copy link
Contributor

muuki88 commented Feb 10, 2020

Thanks @gregsymons for your detailed issue 👍 Feel free to ask for any help on the PR 😄

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug docker universal Zip, tar.gz, tgz and bash issues
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants