| Summary: | [Import/Export] Export project does not export empty folders | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Product: | [Eclipse Project] Platform | Reporter: | Andrew Mak <makandre> | ||||||||||
| Component: | IDE | Assignee: | Oleg Besedin <ob1.eclipse> | ||||||||||
| Status: | VERIFIED FIXED | QA Contact: | Prakash Rangaraj <prakash> | ||||||||||
| Severity: | normal | ||||||||||||
| Priority: | P3 | CC: | achapiro, alicec, bjustin, bokowski, cbridgha, ccc, daniel_megert, devel, edwinc, gdtaylor, give.a.damus, hsoliwal, ob1.eclipse, pkashyap, pwebster, remy.suen, rtaniwa, tdramsey, zalapa | ||||||||||
| Version: | 3.5 | Keywords: | helpwanted | ||||||||||
| Target Milestone: | 3.7 M7 | ||||||||||||
| Hardware: | PC | ||||||||||||
| OS: | Windows XP | ||||||||||||
| Whiteboard: | |||||||||||||
| Bug Depends on: | |||||||||||||
| Bug Blocks: | 342308, 358470 | ||||||||||||
| Attachments: |
|
||||||||||||
|
Description
Andrew Mak
Does the folder physically exist within the zip file? The folder does not exist in the zip, even though it was checked when I exported the project. Sounds like a problem with our export wizard. Andrew, which build are you using? Can you consistently reproduce this? Yes, it can be consistently reproduced. I'm using 3.5 RC2 stable build (S-3.5RC2-200905221710) It looks like we don't add the directory to the exported zip. What about a zip that does include the directory? PW If zip has the directory, then the directory gets created on import. Created attachment 137765 [details]
Export wizard patch v1
Both zip and tar exports suffers from the same problem. I updated the tests to include an empty folder. I also took the liberty of not changing the tests to not use an IWorkbenchWindow to perform the operation since it seems to serve no purpose (besides wasting time).
*** Bug 208672 has been marked as a duplicate of this bug. *** We are hitting the same issue. We are on version 3.4.2 of Eclipse. The exact same major issue is hit with our customers. They export a Java project (in our case, a Web project from WST), then they re-import it to discover that there are errors now. Patch v01 released to HEAD This change cases failure of serveral JUnits from the ExportArchiveFileOperationTest class on Windows machines:
private void verifyArchive(int folderCount, List entries){
....
String entryName = (String)archiveEntries.next(); <= "ExporttestExportZip\"
int idx = entryName.lastIndexOf("/"); <= idx = -1
String folderPath = entryName.substring(0, idx); <= Exception
The directories end with backslash ("\") rather then forward slash ("/") which seems to be expected.
Created attachment 149468 [details] ExportArchiveFileOperationTest patch v1 (In reply to comment #11) > This change cases failure of serveral JUnits from the > ExportArchiveFileOperationTest class on Windows machines: > > private void verifyArchive(int folderCount, List entries){ > .... > String entryName = (String)archiveEntries.next(); <= "ExporttestExportZip\" > int idx = entryName.lastIndexOf("/"); <= idx = -1 > String folderPath = entryName.substring(0, idx); <= Exception > > The directories end with backslash ("\") rather then forward slash ("/") which > seems to be expected. How embarassing. This patch should fix it up. I also took the liberty of changing the failed method to just throw the exception and propagate it to JUnit instead of failing on it. This gives us a proper stack trace in the 'JUnit' view whereas the other doesn't give us much. Hitesh, Can you test this patch on Windows machine? (In reply to comment #13) > Hitesh, > > Can you test this patch on Windows machine? The patch fixes the tests on my XP machine. Thanks Remy & Hitesh. The patch is checked into HEAD. Just in time for the N build :-) I've reverted the fix as it is no good: it results in duplicate entries for directories and this lets the import fail badly afterwards. 1. export a Java project to an archive 2. delete the project 3. import ==> most files not imported (aborts due to duplicate dirs in archive) See bug 293950 for the missing error reporting. (In reply to comment #16) > I've reverted the fix as it is no good Do you need to revert JUnits as well? The following JUnits fail: ExportArchiveFileOperationTest testExportZip testExportZipCreateSelectedDirectoriesWithFodlers testExportTar testExportTarCreateSelectedDirectoriesWithFodlers Thanks for the reminder Oleg! I've updated and released the test for I20091103-0800. *** Bug 316964 has been marked as a duplicate of this bug. *** The problem is still there on 3.6, I have done the following: 1. created a new project (simple project) 2. put some folders in it, in the following manner - ExportTestProject -- folder1 --- subfolder1 ---- file1.txt --- subfolder2 -- folder2 --- subfolder1 --- subfolder2 -- folder3 3. exported via archive wizard with default settings The test shows that all empty folders (including folders with empty sub folders) are not exported. The resulting file only contains folder1/subfolder1/file1.txt and the .project file. Same result with tar. I need all empty folders in the archive. *** Bug 326447 has been marked as a duplicate of this bug. *** Seems like there has been a few dupes for this issue. Is there an outlook for a fix? This also impacts some Rational tools which are based on Eclipse. Users get errors on import since the empty folders are stripped off during export. This has caused customer confusion, and requires them to do a workaround. Created attachment 188350 [details]
patch_for_3.6_maintenance
I took a little time to investigate the earlier patches, and added some code to only create directory entries for empty directories.
My local testing with both zip and rar works great - can someone take a look and consider for next maintenance release?
this patch applies to R3_6_maintenance stream
Rational Business Developer (RBD) is anxious to have a fix for this problem on 3.6. (See Comment 23.) Is it possible to get a patch? +1 on this fixing this promptly. It's a major annoyance to manually patch up imported projects, especially when the missing folders are referenced in project metadata (e.g. classpath for Java projects). Created attachment 192850 [details]
Patch 3
To clarify the current state:
- Parts of Remy's patch (IFileExporter, ZipFileExporter, TarFileExporter) are released in Eclipse 3.6.0 and later versions;
- The changes to ArchiveFileExportOperation and tests were reversed by Dani.
This patch contains reversed parts of Remy's patch with some changes:
- we create extra entries only for containers with no children
- we use IPath.SEPARATOR
- updated try/catch blocks in tests to limit them to I/O exceptions
Patch applied to CVS Head. I opened bug 342308 to consider back-porting this fix into 3.6.2+. Verified in N20110411-2000 that it works as expected. There's one small hole left in the story when it comes to importing (not as project), see bug 33171. *** Bug 342758 has been marked as a duplicate of this bug. *** Verified in I20110425-1800. |