Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tar -P cannot extract hardlinks through symlinks #821

Closed
mmatuska opened this issue Nov 7, 2016 · 1 comment
Closed

tar -P cannot extract hardlinks through symlinks #821

mmatuska opened this issue Nov 7, 2016 · 1 comment

Comments

@mmatuska
Copy link
Member

mmatuska commented Nov 7, 2016

Issue created from FreeBSD bug 213255.

Tijl Coosemans writes:

... It can be reproduced with tar like this:

% mkdir dir2
% ln -s dir2 dir
% touch dir/file
% ln dir/file dir/file2
% tar cf dir.tar dir/file dir/file2
% rm dir/*
% tar xf dir.tar -P
dir/file2: Can't create 'dir/file2'
tar: Error exit delayed from previous errors.
tijl@kalimero:~/tmp/test% ls -l dir/
total 0
-rw-r--r--  1 tijl  wheel  0  6 Nov 20:05 file

With -P extraction through a symlink (dir->dir2) should work, but fails for hardlinks.

The patch fixes this. In archive_write_disk_posix.c the function create_filesystem_object() calls check_symlinks_fsobj() in the case of hardlinks, but not in the case of symlinks or regular files. The patch removes this call. check_symlinks_fsobj() is still called elsewhere in the same file and the 'tar xf' command above without -P still fails on both archive entries.

Proposed patch

@bapt
Copy link

bapt commented Nov 29, 2016

IT would be really nice to see progress here: it is also inpacting pkg and in rather bad way: see FreeBSD bug 214381

mmatuska added a commit to mmatuska/libarchive that referenced this issue Nov 29, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants