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

ZIP file names do not extract correctly if ZIP is created on Windows and unzipped on Linux #55

Closed
doswell opened this issue Oct 29, 2013 · 5 comments

Comments

@doswell
Copy link
Contributor

doswell commented Oct 29, 2013

When a ZIP is created on a Windows platform which passes in file names created from File.getPath, the directory separators used are Windows backslash. The ZIP entry then creates the filename with these backslashes. Unzipping on a Linux based system unzips these files with the filename including the directory name, ie;
share\doc\api\views\html\commands\index$.html
Is the filename.

Similar to IO.scala in sbt, the file names need to be normalized such that if the separatorChar is '' then they need to be replaced with '/'

@jsuereth
Copy link
Member

Good catch. Perhaps you should also open a ticket on sbt/sbt about the sbt.IO issue as well....

@doswell
Copy link
Contributor Author

doswell commented Oct 29, 2013

It looks ok on sbt.IO, came across it from Play Framework packaging, is the intent to keep zipping separate from sbt.IO ZIP handling? there is a sbt.IO.zip method as well.

@jsuereth
Copy link
Member

No, our zipping is a bit of a historical accident how it came to be the way it is.

  1. sbt.IO zip is fine for simple zip files. However, it doesn't, by default, fill in the Info-Zip permissions
  2. We had commons-compress in there at one point which DID fill in the Info-Zip permissions. This only worked for permisisons on Linux, not Mac.
  3. We added "useNativeZip" feature so that you could just use native zip Process forks and get all the Info-ZIp and other magic bits you need for MacOSX users. Never cleaned up after this.

I'd like to try to add commons-compress with Info-Zip back in, as it's slightly better than sbt.IO. However, if the default mappings we pass to the zip-creator are bombing, then that needs to be fixed. Thanks for the report. Pull requests welcome, I'll add this to my TODOs before the next release.

@doswell
Copy link
Contributor Author

doswell commented Oct 29, 2013

Ok, yeah saw a lot of similar zip handling out in sbt.IO - was rather confused trying to track this one down. As soem of the packaging for the jar used sbt.IO but the distro zip used sbt-native-packager. Might just be how the tasks are being setup in play framework.
PR #56 sent

jsuereth added a commit that referenced this issue Oct 29, 2013
Issue #55 - Correct ZIP entry names when created on a Windows system
@jsuereth
Copy link
Member

jsuereth commented Nov 1, 2013

Cool, pr was accepted, so closing.

@jsuereth jsuereth closed this as completed Nov 1, 2013
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

2 participants