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

sbt docker:publishLocal fails on Windows #760

Closed
mkotsbak opened this issue Mar 29, 2016 · 17 comments
Closed

sbt docker:publishLocal fails on Windows #760

mkotsbak opened this issue Mar 29, 2016 · 17 comments
Labels

Comments

@mkotsbak
Copy link

Running "sbt docker:publishLocal" fails with this stack trace on Windows (works fine on Linux):

java.util.regex.PatternSyntaxException: Unexpected internal error near index 1
\
 ^
        at java.util.regex.Pattern.error(Unknown Source)
        at java.util.regex.Pattern.compile(Unknown Source)
        at java.util.regex.Pattern.<init>(Unknown Source)
        at java.util.regex.Pattern.compile(Unknown Source)
        at java.lang.String.split(Unknown Source)
        at java.lang.String.split(Unknown Source)
        at com.typesafe.sbt.packager.docker.DockerPlugin$.com$typesafe$sbt$packager$docker$DockerPlugin$$makeAdd(DockerPlugin.scala:152)
        at com.typesafe.sbt.packager.docker.DockerPlugin$$anonfun$projectSettings$8.apply(DockerPlugin.scala:79)
        at com.typesafe.sbt.packager.docker.DockerPlugin$$anonfun$projectSettings$8.apply(DockerPlugin.scala:70)
        at scala.Function1$$anonfun$compose$1.apply(Function1.scala:47)
        at sbt.$tilde$greater$$anonfun$$u2219$1.apply(TypeFunctions.scala:40)
        at sbt.std.Transform$$anon$4.work(System.scala:63)
        at sbt.Execute$$anonfun$submit$1$$anonfun$apply$1.apply(Execute.scala:226)
        at sbt.Execute$$anonfun$submit$1$$anonfun$apply$1.apply(Execute.scala:226)
        at sbt.ErrorHandling$.wideConvert(ErrorHandling.scala:17)
        at sbt.Execute.work(Execute.scala:235)
        at sbt.Execute$$anonfun$submit$1.apply(Execute.scala:226)
        at sbt.Execute$$anonfun$submit$1.apply(Execute.scala:226)
        at sbt.ConcurrentRestrictions$$anon$4$$anonfun$1.apply(ConcurrentRestrictions.scala:159)
        at sbt.CompletionService$$anon$2.call(CompletionService.scala:28)
        at java.util.concurrent.FutureTask.run(Unknown Source)
        at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
        at java.util.concurrent.FutureTask.run(Unknown Source)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
        at java.lang.Thread.run(Unknown Source)
[error] (*:dockerCommands) java.util.regex.PatternSyntaxException: Unexpected internal error near index 1

I guess it is related to the Windows directory separator "".

@muuki88 muuki88 added the docker label Mar 30, 2016
@muuki88
Copy link
Contributor

muuki88 commented Mar 30, 2016

Probably. Are you using the spotify docker client?

@mkotsbak
Copy link
Author

This seems unrelated to Docker client, it happens during build, probably while calculating a cmd path.

@mkotsbak
Copy link
Author

But Docker toolbox, not spotify.

@mkotsbak
Copy link
Author

I think we have it here:

  /**
   * The separator for makeAdd force UNIX separator.
   * The separator doesn't depend to OS where i build Dockerfile.
   */
  val UnixSeparatorChar = '/'

at https://github.com/sbt/sbt-native-packager/blob/master/src/main/scala/com/typesafe/sbt/packager/docker/DockerPlugin.scala#L64

mkotsbak pushed a commit to mkotsbak/sbt-native-packager that referenced this issue Apr 2, 2016
mkotsbak pushed a commit to mkotsbak/sbt-native-packager that referenced this issue Apr 3, 2016
mkotsbak pushed a commit to mkotsbak/sbt-native-packager that referenced this issue Apr 5, 2016
@raam86
Copy link

raam86 commented Jun 20, 2016

Hi I am on 1.2.0-M2 and this issue still isn't fixed. Looks like the code was changed but I am getting array index out of bound error on line 88 (makeAdd). Any help would be greatly appreciated

@muuki88
Copy link
Contributor

muuki88 commented Jun 20, 2016

Damn. Windows is real unforgiving :(
Seems that dockerBaseDirectory cannot be split up correctly. Do you have time and patience to debug this further with the test-project-docker? If yes, I can give you some hints (my windows machine doesn't work anymore :/ )

@raam86
Copy link

raam86 commented Jun 21, 2016

Yes I would love to do it.
Please provide as many hints as possible so we can fix it for my windows wielding colleagues :)

@muuki88
Copy link
Contributor

muuki88 commented Jun 21, 2016

Awesome 👍

So, first of all println debugging is for sbt the technique I currently use to debug (I feel ashamed and should be).

Fixing this bug should only require touching the DockerPlugin.scala. Nothing else. You can start the test-project-docker by firing up sbt in the test-project-directory.

The workflow from there on is

  1. Change something in your DockerPlugin.scala
  2. ; r ; docker:publishLocal in the test-project-docker
  3. see if it worked or not. Start with step 1

You can change the test-project-docker until you are able to reproduce the error. However don't stage these changes for the real fix then.

@oporkka
Copy link
Contributor

oporkka commented Jun 22, 2016

I'm also getting errors from running sbt docker:stage.

What seems to have happened is that f521679 has been reverted by 101311e in 1.1.1

@mkotsbak
Copy link
Author

Yes, but the last commit was supposed to fix this issue.

@oporkka
Copy link
Contributor

oporkka commented Jun 23, 2016

It brought the issue of #573 back. Maybe there's something else wrong in the logic.

@oporkka
Copy link
Contributor

oporkka commented Jun 23, 2016

@mkotsbak I'm wondering that if anyway Unix separator / was used for splitting before your commit, how could there actually be a problem with \ at all? Might there have been actually an old version of sbt-native-packager in use? Note that f521679 for #573 that you kind of reverted, fixed the exactly same stack trace (supposedly).

@mkotsbak
Copy link
Author

@oporkka Yes, I think you might be right, that this issue was really a duplicate of #573, which was not released.

@mkotsbak
Copy link
Author

Then my commit should be reverted.

@oporkka
Copy link
Contributor

oporkka commented Jun 23, 2016

I already provided revert (#823 issue, #824 pull request)

@raam86
Copy link

raam86 commented Jun 29, 2016

So whats the decision? Should I do it or is it already fixed?

@oporkka
Copy link
Contributor

oporkka commented Jul 12, 2016

It has been fixed to master. There's now #842 open for 1.1.x too

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

4 participants