Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 429809 - preserve symbolic links in product tar archives
Summary: preserve symbolic links in product tar archives
Status: VERIFIED FIXED
Alias: None
Product: z_Archived
Classification: Eclipse Foundation
Component: Tycho (show other bugs)
Version: unspecified   Edit
Hardware: Other All
: P3 enhancement (vote)
Target Milestone: ---   Edit
Assignee: Jan Sievers CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-03-06 13:34 EST by Jan Sievers CLA
Modified: 2021-04-28 16:53 EDT (History)
7 users (show)

See Also:


Attachments
PoC (4.44 KB, application/octet-stream)
2014-03-07 08:33 EST, Jan Sievers CLA
no flags Details
PoC project (4.21 KB, application/x-zip-compressed)
2014-03-07 08:53 EST, Jan Sievers CLA
no flags Details
Fix for symlinks that are relative to the .tar's content (4.43 KB, patch)
2014-05-07 18:13 EDT, Tobias Heide CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Jan Sievers CLA 2014-03-06 13:34:56 EST
product tar.gz archives are currently created using plexus archiver.
it has no support for symlinks, see bug 402052 and http://jira.codehaus.org/browse/PLXCOMP-117


it looks like commons compress supports symlinks in tar archives
http://commons.apache.org/proper/commons-compress/javadocs/api-1.7/org/apache/commons/compress/archivers/tar/TarArchiveEntry.html


investigate if we can use commons compress to create the tar archives.

make sure we dont lose support for preserving executable bits.
Comment 1 Jan Sievers CLA 2014-03-07 08:33:07 EST
Created attachment 240647 [details]
PoC

proof of concept using apache commons compress
preserves executable permission bits and symlinks inside the tar archive

However this requires java.nio features introduced with Java 7 only.
Comment 2 Jan Sievers CLA 2014-03-07 08:53:59 EST
Created attachment 240652 [details]
PoC project
Comment 3 David Williams CLA 2014-03-08 22:32:37 EST
(In reply to Jan Sievers from comment #1)
> Created attachment 240647 [details]
> PoC
> 
> proof of concept using apache commons compress
> preserves executable permission bits and symlinks inside the tar archive
> 
> However this requires java.nio features introduced with Java 7 only.

Well, if it helps ... we'd not mind using Java 7 to do builds ... and, seems there should be a way that "use common compress if on Java 7" but "fall back to previous method if not". So no one would be worse off.
Comment 4 Markus Knauer CLA 2014-03-09 05:25:46 EDT
A solution would be highly appreciated and I don't mind using Java 7 in our EPP build if that helps solving the problem. We've been hit by this problem in EPP, too (of course...) and solved it with a workaround described in bug 424769 where we call a Bash script from Maven.
Comment 5 Jan Sievers CLA 2014-03-10 04:03:46 EDT
(In reply to David Williams from comment #3)
> (In reply to Jan Sievers from comment #1)
> > Created attachment 240647 [details]
> > PoC
> > 
> > proof of concept using apache commons compress
> > preserves executable permission bits and symlinks inside the tar archive
> > 
> > However this requires java.nio features introduced with Java 7 only.
> 
> Well, if it helps ... we'd not mind using Java 7 to do builds ... and, seems
> there should be a way that "use common compress if on Java 7" but "fall back
> to previous method if not". So no one would be worse off.

I was thinking along these lines too.

we need to find a solution how to build the module in Tycho 
(which is currently Java 6 based) without pulling all the rest of Tycho up to min requirement Java 7
Comment 6 Igor Fedorenko CLA 2014-03-10 09:13:43 EDT
I am in favour of moving entire Tycho java 7. I'd rather not complicate things with java 6 compatibility. Anyone who needs to stay on java 6 for whatever odd reason will have to stick with tycho 0.20.
Comment 7 Jan Sievers CLA 2014-03-11 06:12:10 EDT
created CQ 8090 for commons-compress 1.7
Comment 8 Tobias Oberlies CLA 2014-03-14 14:48:29 EDT
(In reply to comment #6)
> I am in favour of moving entire Tycho java 7. I'd rather not complicate things
> with java 6 compatibility. Anyone who needs to stay on java 6 for whatever odd
> reason will have to stick with tycho 0.20.
Before taking this decision, I'd like to discuss this what this would mean for the users at SAP. AFAIK, we still widely use Java 6 internally. Also, the workaround of using Toolchains for building for an older JRE is not supported on our internal release servers. So this move may be a problem for us...
Comment 9 Jan Sievers CLA 2014-04-25 04:42:47 EDT
https://git.eclipse.org/r/#/c/25416/
Comment 11 Tobias Heide CLA 2014-05-07 18:11:04 EDT
Unfortunately the fix for this bug has a bug itself (see attached test case and patch for the implementation). Symlinks that are relative to the tar's own contents have their preceeding '../' stripped of which leads to unresolveable symlinks.

The patch passes all test cases and has an additional regression test case for the bug.
Comment 12 Tobias Heide CLA 2014-05-07 18:13:03 EDT
Created attachment 242816 [details]
Fix for symlinks that are relative to the .tar's content

- Regression test
- Fix for regression
Comment 13 Jan Sievers CLA 2014-05-08 06:02:53 EDT
Tobias,

thanks for reporting and providing a patch including testcase!

To accept your patch (I will push it to gerrit), we need a signed CLA in place for the author email adress of a proposed git patch including Signed-off-by: footer.

See [1] for details.

Could you

1. Sign the CLA https://wiki.eclipse.org/Development_Resources/Contributing_via_Git#Eclipse_Foundation_Contributor_License_Agreement
2. Provide a git commit with author and Signed-off-By: footer with the same email adress
3. push the commit to gerrit yourself [2] or attach it here (using git format-patch HEAD~) so I can push it to gerrit


[1] https://wiki.eclipse.org/Development_Resources/Handling_Git_Contributions 
[2] https://wiki.eclipse.org/Tycho/Contributor_Guide#Using_Gerrit
Comment 14 Tobias Heide CLA 2014-05-08 17:30:57 EDT
https://git.eclipse.org/r/#/c/26243/
Comment 16 Tobias Heide CLA 2014-05-10 05:13:41 EDT
Dear Jan,
should this patch already be in the SNAPSHOT-build of tycho-0.21.0? If it was at the moment when I wrote this comment, the changed patch doesn't resolve the problem I fixed with my patch (maybe my test was wrong). The problem I'm trying to solve is to ship a JRE with my product, and Mac is very picky about a special symlink in that JRE. Could you give me a feedback so that I can decide whether I have to dig the problem down or whether I just have to wait until it is in a SNAPSHOT-build?
Tobias
Comment 17 Jan Sievers CLA 2014-05-12 03:41:33 EDT
(In reply to Tobias Heide from comment #16)
> Dear Jan,
> should this patch already be in the SNAPSHOT-build of tycho-0.21.0? If it
> was at the moment when I wrote this comment, the changed patch doesn't
> resolve the problem I fixed with my patch (maybe my test was wrong)

we have a  problem with the CI build server at the moment which is why the fix may not visible on https://oss.sonatype.org/content/groups/public/ yet.
you can build tycho yourself from the master branch to verify the fix in the meantime.
Comment 18 Jan Sievers CLA 2014-05-13 03:18:23 EDT
(In reply to Jan Sievers from comment #17)
> we have a  problem with the CI build server at the moment which is why the
> fix may not visible on https://oss.sonatype.org/content/groups/public/ yet.

CI job deployment has been fixed. 
I slightly simplified the fix but kept your unit test and it succeeds.

please verify the fix and put this bug as into state VERIFIED or REOPENED if the fix did not cover your issue.
Comment 19 Tobias Heide CLA 2014-05-13 13:05:21 EDT
I pulled your fixes on the master branch and built them locally. The modified patch works as expected, thank you! The deployed SNAPSHOT does not yet have the changes, and my regression still exists there. Maybe the CI build has not yet run.

I cannot change the bug status, but from my point of view it is verified.
Comment 20 Tobias Oberlies CLA 2014-08-14 09:55:43 EDT
FYI: I've updated the Developer's guide [1] to include instructions how to fix the Eclipse project configuration of tycho-p2-director-plugin in case it has compile errors after importing the project. This happens if you have a Java 6 JDK registered in you workspace.

[1] http://wiki.eclipse.org/Developing_Tycho
Comment 21 Andreas Pakulat CLA 2014-09-01 05:15:05 EDT
*** Bug 442893 has been marked as a duplicate of this bug. ***