Skip to content
This repository has been archived by the owner on Feb 24, 2020. It is now read-only.

Fix creation of HardLinks. #189

Merged
merged 1 commit into from Dec 4, 2014
Merged

Fix creation of HardLinks. #189

merged 1 commit into from Dec 4, 2014

Conversation

sgotti
Copy link
Contributor

@sgotti sgotti commented Dec 3, 2014

Hi. Congrats for great work!

I was trying to manually create a fileset for a base fedora image using gnu tar. On rkt run I noticed that it was failing extracting the tar with an error like this:

run: error setting up stage0: error setting up image sha256-5d12db67edc3884bf0a659390f162d83dedcadfbc8cdf96a82650adbdd871705: error extracting ACI: link ./rootfs/usr/bin/pkg-config /var/lib/rkt/containers/d1c6e082-686a-4e97-88c4-2f1df432b307/stage1/opt/stage2/sha256-5d12db67edc3884bf0a659390f162d83dedcadfbc8cdf96a82650adbdd871705/rootfs/usr/bin/x86_64-redhat-linux-gnu-pkg-config: no such file or directory

With tar the LinkName of an hardlink is different from the one of a symlink. It's the path relative to the tar's root.
I tried to fix it.

I also fixed the security check (if something malicious creates a tar with a bad Linkname like ../../../etc/shadow)

I have some doubts (maybe a new issue will be better) on the check for the symlinks as a symlink can also be an absolute path (it's now working as the abs path is joined with the dest file dir).

Thanks!

@jonboulle
Copy link
Contributor

@sgotti awesome, thanks for the patch! LGTM.

jonboulle added a commit that referenced this pull request Dec 4, 2014
pkg/tar: fix creation of HardLinks.
@jonboulle jonboulle merged commit 1e5c18d into rkt:master Dec 4, 2014
@sgotti sgotti deleted the fixtar branch December 4, 2014 10:43
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants