sbt / sbt-native-packager

sbt Native Packager
https://sbt-native-packager.readthedocs.io/en/stable/
BSD 2-Clause "Simplified" License
1.59k stars 439 forks source link

Use only Unix file separators when generating Unix scripts #1440

Closed ghik closed 3 years ago

ghik commented 3 years ago

When generating Unix startup scripts, scriptClasspath always uses Unix file separators (/). Therefore, File.separator cannot be used because the build environment may be on another system (Windows). We must always use Unix file separator when working with Unix paths.

This problem was discovered by me when I tried to build a Linux docker image on Windows. Bash startup script had wrong classpath generated.

lightbend-cla-validator commented 3 years ago

Hi @ghik,

Thank you for your contribution! We really value the time you've taken to put this together.

Before we proceed with reviewing this pull request, please sign the Lightbend Contributors License Agreement:

https://www.lightbend.com/contribute/cla

muuki88 commented 3 years ago

Thanks for your patience :hugs:

I wonder if this has any other impacts :thinking:

ghik commented 3 years ago

Sorry for the late response, I was on vacation.

My changes only affect Bash & Ash start script generation. As far as I understand, these start scripts are used only on Linux and are shared by zip and docker distributions. Therefore, this PR should fix the issue for both zip and docker while not breaking anything.