Closed lukeis closed 8 years ago
Reported by barancev
on 2014-12-04 18:20:10
Summarizing experiments:
- test runner: Win 7, node: Ubuntu -> FAIL
- test runner: Ubuntu, node: Ubuntu -> OK
- test runner: Ubuntu, node: Win 7 -> OK
Reported by tporeba
on 2014-12-04 22:17:05
I have made some further review and I think the problem is in method org.openqa.selenium.io.Zip.addToZip:
private void addToZip(String basePath, ZipOutputStream zos, File toAdd) throws
IOException {
[...]
String name = toAdd.getAbsolutePath().substring(basePath.length() + 1);
ZipEntry entry = new ZipEntry(name);
[...]
We use here File.getAbsolutePath() in ZipEntry name and on Windows there will be system-dependent
'\' separators inside that path. It should be enough to replace it with os-independent
'/' separator. Actually this is even how the zip file spec says it should be done (http://www.pkware.com/documents/casestudies/APPNOTE.TXT):
4.4.17 file name: (Variable)
4.4.17.1 The name of the file, with optional relative path.
The path stored MUST not contain a drive or
device letter, or a leading slash. All slashes
MUST be forward slashes '/' as opposed to
backwards slashes '\' for compatibility with Amiga
and UNIX file systems etc. If input came from standard
input, there is no file name field.
See also:
https://community.oracle.com/message/8607134
http://stackoverflow.com/questions/2549766/create-zip-file-in-windows-and-extract-zip-file-in-linux
http://tdruryjavanotes.blogspot.com/2011/10/zipentry-names-are-not-paths.html
http://cephas.net/blog/2007/11/18/java-zipentry-bug-on-windows/
Reported by tporeba
on 2014-12-13 21:48:24
Back to the point, I believe this should work:
private void addToZip(String basePath, ZipOutputStream zos, File toAdd) throws IOException
{
[...]
String name = toAdd.getAbsolutePath().substring(basePath.length() + 1);
ZipEntry entry = new ZipEntry(name.replace('\\', '/'));
[...]
I will submit a patch as soon as I learn to build & test Selenium ;)
Reported by tporeba
on 2014-12-13 21:50:30
I checked the fix and it is working for me in Windows->Linux configuration. ZipTest
tests are passing.
Created pull request: https://github.com/SeleniumHQ/selenium/pull/299
Reported by tporeba
on 2014-12-14 21:38:44
Merged in 07c2118308959463bb860c03605e03452689bd14
Reported by kristian.rosenvold
on 2014-12-15 19:16:06
Fixed
Ahem. Seems I need to commit more. Now fixed in 967286a7dc4acae58e95d53435c272a69b115d87
and pushed on proper repo.
Reported by kristian.rosenvold
on 2014-12-16 05:21:35
Reported by luke.semerau
on 2015-09-17 18:24:56
Originally reported on Google Code with ID 8254
Reported by
tporeba
on 2014-12-04 13:17:43