Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 327208 - [Import/Export] Windows Explorer can't read zip when 'create only selected directories' selected
Summary: [Import/Export] Windows Explorer can't read zip when 'create only selected di...
Status: RESOLVED FIXED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 3.5.2   Edit
Hardware: PC Windows 7
: P3 normal (vote)
Target Milestone: 4.5 M4   Edit
Assignee: Markus Keller CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on: 451335
Blocks:
  Show dependency tree
 
Reported: 2010-10-07 07:04 EDT by Matthew Dickie CLA
Modified: 2014-11-13 08:57 EST (History)
3 users (show)

See Also:


Attachments
exported project - correct zip (2.40 KB, application/x-zip-compressed)
2014-08-01 03:55 EDT, kurt CLA
no flags Details
exported project - incorrect zip (2.41 KB, application/x-zip-compressed)
2014-08-01 03:56 EDT, kurt CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Matthew Dickie CLA 2010-10-07 07:04:26 EDT
Build Identifier: I20100608-0911

When a project is exported, with all files and folders selected, and the radio button 'create only selected directories' selected, the exported zip file cannot be read by Windows Explorer - it is shown as empty. WinZip can read the file (it appears the same as the archive created when the option 'create directory structure for files' is selected. WinRAR shows the file the same except that the project name has a leading backslash, e.g. '\project'. When exporting the 

This may be a Windows bug, as WinZip and WinRAR (and apparently 7Zip) are able to read the file with the contents show correctly, and can export the file. However, the leading backslash in WinRAR may indicate the problem. Perhaps this is invalid? Whether valid or not, perhaps this is what Windows Explorer cannot handle. I don't know.

But, if only a subfolder within the file is selected and the option 'create directory structure for files' is selected, then the resulting zip file can be read by Windows Explorer and WinRAR does not show a leading backslash on the name of the root folder (which will of course be different in this case).

I do not see why the resulting zip file should be different based on which radio button is selected 'create directory structure for files'/'create only selected directories' if ALL files within the project are selected

Reproducible: Always

Steps to Reproduce:
1. Create a project with a folder and a file, e.g. /project/folder/file.txt
2. Export the project as an archive file, with the option 'create only selected directories' selected.
3. Try to open the exporting archive file with Windows Explorer. It will be shown as empty.
4. Export the project as an archive file again, to a different file name, this time with 'create directory structure for files' selected.
5. Open this file in Windows Explorer, the contents will be shown correctly.
6. Open both archive files in WinRAR. Note the leading backslash in the archive file created where 'create only selected directories' was selected.
Comment 1 Markus Keller CLA 2010-11-04 06:07:01 EDT
That's bad. Broken since at least 3.5.2.
Comment 2 kurt CLA 2014-08-01 03:54:08 EDT
The problem still exists in Eclipse 4.4!
I just fell into the trap reporting another eclipse-problem.
It looks like "Create only selected directories" has a problem if the top level folder is a (java-)project.

The the resulting zip looks like that (x.zip is the exported project):

x.zip:
  + - ""
    + project-filder
      + rest of the project files and folders


That is, there is a top-level-folder named "" (empty name, not quotes) and _under_ that empty-named-folder the project is in the archive.

I could not extract the contents with Windows means.
7-zip is able to handle that. With that you also see that there is a empty-named top-level-folder.


I'll attach to zip's:
  XECERR_DEL_SRCFLDR.zip
  XECERR_DEL_SRCFLDR_2.zip

The first is ok (selected "Create directory structure for files"),
the second is the problematic one (selected "Create only selected directories").
For both "Save in zip format" and "Compress the..." were selected.

The selection for export to archive was the project itself.
Comment 3 kurt CLA 2014-08-01 03:55:26 EDT
Created attachment 245633 [details]
exported project - correct zip

see my last comment
Comment 4 kurt CLA 2014-08-01 03:56:23 EDT
Created attachment 245634 [details]
exported project - incorrect zip

see my last comment
Comment 5 Markus Keller CLA 2014-11-13 08:57:01 EST
The Zip file format spec is clear:

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.

org.eclipse.ui.internal.wizards.datatransfer.ArchiveFileExportOperation#createDestinationName(int, IResource) fell into the trap of bug 451335 and created Zips with invalid path names that start with a '/'.

Fixed with http://git.eclipse.org/c/platform/eclipse.platform.ui.git/commit/?id=b3156d784a5bb5aee8131a604f2324168b7da8b7