[ 
https://issues.apache.org/jira/browse/HADOOP-15170?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16347207#comment-16347207
 ] 

Jason Lowe commented on HADOOP-15170:
-------------------------------------

Thanks for updating the patch!

I tested this out on a manually created a tarball with some symlinks and the 
link targets are being mishandled.  For example:
{noformat}
$ mkdir testdir
$ cd testdir
$ ln -s a b
$ ln -s /tmp/foo c
$ ls -l
total 0
lrwxrwxrwx. 1 nobody nobody 1 Jan 31 10:40 b -> a
lrwxrwxrwx. 1 nobody nobody 8 Jan 31 10:40 c -> /tmp/foo
$ cd ..
$ tar zcf testdir.tgz testdir 
{noformat}
When I unpack this tarball to a destination directory of "output" with 
unTarUsingJava the symlinks are all relative to the top-level output directory 
which is incorrect:
{noformat}
$ ls -l output/testdir
total 0
lrwxrwxrwx. 1 nobody nobody  8 Jan 31 10:41 b -> output/a
lrwxrwxrwx. 1 nobody nobody 14 Jan 31 10:41 c -> output/tmp/foo
{noformat}

The fix is to just take the symlink name as-is rather than trying to make it 
relative to something else.

> Add symlink support to FileUtil#unTarUsingJava 
> -----------------------------------------------
>
>                 Key: HADOOP-15170
>                 URL: https://issues.apache.org/jira/browse/HADOOP-15170
>             Project: Hadoop Common
>          Issue Type: Improvement
>          Components: util
>            Reporter: Jason Lowe
>            Assignee: Ajay Kumar
>            Priority: Minor
>         Attachments: HADOOP-15170.001.patch, HADOOP-15170.002.patch, 
> HADOOP-15170.003.patch
>
>
> Now that JDK7 or later is required, we can leverage 
> java.nio.Files.createSymbolicLink in FileUtil.unTarUsingJava to support 
> archives that contain symbolic links.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to