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

Binary broken when run in path with spaces #577

Closed
francisdb opened this issue May 7, 2015 · 18 comments
Closed

Binary broken when run in path with spaces #577

francisdb opened this issue May 7, 2015 · 18 comments

Comments

@francisdb
Copy link
Contributor

Built a zip built with universal:packageBin on a sbt project with

.enablePlugins(JavaAppPackaging)
.enablePlugins(LauncherJarPlugin)

I extracted the resulting zip into /Users/me/My Downloads/myapp.
When starting the binary in OS X I get the following error:

Error: Invalid or corrupt jarfile /Users/me/My

(other ways of packaging and other operating systems might also have this issue

@muuki88
Copy link
Contributor

muuki88 commented May 8, 2015

This is interesting. We have tests for this, so this could be a configuration or system issue. Can you share a sample project?

cc @jroper

@francisdb
Copy link
Contributor Author

@muuki88
Copy link
Contributor

muuki88 commented May 8, 2015

Is jar name wrong?

@francisdb
Copy link
Contributor Author

no but probably need quotes as $lib_dir might contain spaces

@muuki88
Copy link
Contributor

muuki88 commented May 8, 2015

Can you provide a pr with a regression test for this?

@francisdb
Copy link
Contributor Author

can you point me to the tests that already test this folder with spaces stuff?

@muuki88
Copy link
Contributor

muuki88 commented May 8, 2015

Sure :)

https://github.com/sbt/sbt-native-packager/tree/master/src/sbt-test/jar/launcher-jar

There's a wiki page explaining how to run the tests. Basically it's
sbt "scripted jar/*"

@francisdb
Copy link
Contributor Author

Ok, tried to reproduce this and force the test scripts to use a target/stage folder containing spaces but did not get there. Asserts were still expecting default target/stage folders.

The only solution I found to reproduce the issue is renaming
src/sbt-test/jar/launcher-jar/
to
src/sbt-test/jar/launcher jar/

but so far no luck on fixing the bash script, quotes don't help as then I get this:

error: Unable to access jarfile "/Users/me/My

@muuki88
Copy link
Contributor

muuki88 commented May 9, 2015

So there needs to be a more sophisticated way of dealing with whitespaces on
windows? For testing you can do the following steps

  • go to test-project-simple ( in the root folder of sbt-native-packager project)
  • add all the settings from sbt-test/jar/launcher-jar/ you need
  • make the build fail in this test project
  • change the windows plugin and test with the test-project-simple (if you keep the sbt console open you may have to type reload before testing)
  • if everything works, create a new test next to launcher-jar, e.g. launcher-jar-whitespaces and add the settings from the simple-test-project
  • see if the tests work
  • check in everything, but the simple-test-project

@francisdb
Copy link
Contributor Author

It's not on windows but macosx / linux I have this problem and I have a way to break the test by copying launcher-jar to launcher jar. I currently have not found a solution for providing a path with spaces to java -jar ... in the sh file.
I don't have a windows machine at hand to test this but might have similar problem.

@muuki88
Copy link
Contributor

muuki88 commented May 10, 2015

It's not on windows but macosx / linux

Ah sorry, confused it with another issue. However you can test it on windows as well (only if you have time).

I currently have not found a solution for providing a path with spaces

there are no solutions for this on the internet? If this is really not possible, then we should add docs for it.

@francisdb
Copy link
Contributor Author

Just give me some time :-p

@muuki88
Copy link
Contributor

muuki88 commented May 10, 2015

You have all in the world ;)

@francisdb
Copy link
Contributor Author

patch on it's way, just upped my bash skills and know how to fix this :-)

@francisdb
Copy link
Contributor Author

@muuki88 just to confirm that the bat file is also broken on windows, looking into it

muuki88 added a commit that referenced this issue May 27, 2015
re #577 fix for running the bash file in a path with spaces
@muuki88 muuki88 closed this as completed May 27, 2015
@metasim
Copy link
Member

metasim commented Apr 22, 2016

@muuki88 I see you closed it, but can't figure out how it was fixed. I'm having this problem on windows with a Play app.

@muuki88
Copy link
Contributor

muuki88 commented Apr 22, 2016

That's weird. There is a fix with passing test. Either it's a regression, a different bug or the tests where not exhaustive.

@metasim
Copy link
Member

metasim commented Apr 25, 2016

I ended up enabling LauncherJarPlugin and things worked. When I have a moment, do you want me to go back and log the error when that plugin isn't enabled?

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

No branches or pull requests

3 participants