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

Sed command error in ash-template file #1154

Closed
glammers1 opened this issue Sep 5, 2018 · 4 comments
Closed

Sed command error in ash-template file #1154

glammers1 opened this issue Sep 5, 2018 · 4 comments
Labels

Comments

@glammers1
Copy link
Contributor

glammers1 commented Sep 5, 2018

Expected behaviour

Running a container with ash/dash session should work without sed command error.

Actual behaviour

Running a container in which the entrypoint is a dash session I'm getting the following error:

sed: -e expression #1, char 2: unknown command: `/'

Reproducible

Steps to reproduce it using a github repo

I've created a repo to reproduce the issue (master with 1.3.4):

  1. Clone the repo
  2. Execute sbt docker:publishLocal
  3. Execute docker run [IMAGE ID]
  4. Output (OK!):
-XX:CompressedClassSpaceSize=96468992 -XX:InitialHeapSize=261521920 -XX:MaxHeapSize=8368701440 -XX:MaxMetaspaceSize=104857600 -XX:MaxRAMFraction=2 -XX:+PrintCommandLineFlags -XX:+UnlockExperimentalVMOptions -XX:+UseCGroupMemoryLimitForHeap -XX:+UseCompressedClassPointers -XX:+UseCompressedOops -XX:+UseParallelGC 
Hello, world!

Update the native-packager version to 1.3.5+:

  1. Execute sbt docker:publishLocal
  2. Execute docker run [IMAGE ID]
  3. Output (ERROR!):
sed: -e expression #1, char 2: unknown command: `/'
Hello, world!

Another way to reproduce it using different shell sessions in the container

With dash:

  • First sed command is from 1.3.4

  • The second one is from 1.3.5+

docker exec -it [IMAGE ID] sh
# echo server | sed '/^\#/d;s/\r$//'
server
# echo server | sed $'/^\#/d;s/\r$//'
sed: -e expression #1, char 2: unknown command: `/'

However, with bash works fine both 1.3.4 and 1.3.5 (I think that file changed bash-template #1122 solves the OSX problem and does not affect anything else):

docker exec -it [IMAGE ID] /bin/bash
echo server | sed '/^\#/d;s/\r$//'
server
echo server | sed $'/^\#/d;s/\r$//'
server

Should be removed the change in the ash-template introduced in 1.3.5?

Information

  • What sbt-native-packager are you using: 1.3.4 / 1.3.5+
  • What sbt version: 1.1.6
  • What is your build system (e.g. Ubuntu, MacOS, Windows, Debian ): Ubuntu 14.04.5 LTS
  • What package are you building (e.g. docker, rpm, ...): docker
  • What version has your build tool (find out with e.g. rpm --version): Docker version 18.06.0-ce, build 0ffa825
  • What is your target system (e.g. Ubuntu 16.04, CentOS 7): openjdk:8u171-jre-slim
@muuki88 muuki88 added the docker label Sep 6, 2018
@muuki88
Copy link
Contributor

muuki88 commented Sep 6, 2018

Thanks for the very detailed and well written issue ❤️

Reverting the change from #1122 for the ash-script sounds like a reasonable way to go.
AFAIK ash should only be relevant for docker images, which don't have the \r issue
described in #1121 (which affects only OSX/BSD systems).

Would you like to open a pull request to fix this?

glammers1 added a commit to glammers1/sbt-native-packager that referenced this issue Sep 6, 2018
@glammers1
Copy link
Contributor Author

Of course, PR #1155

@aisven
Copy link

aisven commented Oct 9, 2020

@muuki88 Hi, I am running into this in a maintenance scenario where I cannot currently upgrade away from sbt-native-packager 1.3.6

Therefore I would kindly like to ask you if you can remember if this Issue had any actual negative effects?

I read in the code that the sed command is for loading "a configuration file full of default command line options for this script".

@muuki88
Copy link
Contributor

muuki88 commented Oct 9, 2020

Hi @IOSven

Thanks for your kind question. Unfortunately I have no clue of the impacts as I haven't used any of those features 😬😟

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants