bug-tar
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Bug-tar] Unpack over symlinks with /-based targets is broken


From: Artyom Pervukhin
Subject: [Bug-tar] Unpack over symlinks with /-based targets is broken
Date: Thu, 17 May 2018 17:13:47 +0100

Hi,

I believe that there’s a bug in how unpack over symlinks is handled. On extract 
newer records in tar stream should by default overwrite older extracted items. 
In GNU tar this doesn’t work if older record is a symlink which target starts 
with root (/).

This is tested on version 1.30 built from source, archive dated 2017-12-17 
06:43.

Consider three cases:

case 1:

(tar tv output)
lrwxrwxrwx admin/admin       0 2018-05-17 15:27 foo -> bar
-rw-r--r-- admin/admin       6 2018-05-17 15:27 foo

(tar x, then find -ls)
266605    4 drwxr-xr-x   2 admin    admin        4096 May 17 15:40 unpack1
266606    4 -rw-r--r--   1 admin    admin           6 May 17 15:27 unpack1/foo

case 2:

(tar tv output)
lrwxrwxrwx admin/admin       0 2018-05-17 15:25 foo -> /bar
-rw-r--r-- admin/admin       6 2018-05-17 15:25 foo

(tar x, then find -ls)
266607    4 drwxr-xr-x   2 admin    admin        4096 May 17 15:40 unpack2
266608    0 lrwxrwxrwx   1 admin    admin           4 May 17 15:25 unpack2/foo 
-> /bar

(

case 3:

(tar tv output)
lrwxrwxrwx admin/admin       0 2018-05-17 15:39 foo -> dir/bar
-rw-r--r-- admin/admin       6 2018-05-17 15:39 foo

(tar x, then find -ls)
266612    4 drwxr-xr-x   2 admin    admin        4096 May 17 15:40 unpack3
266613    4 -rw-r--r--   1 admin    admin           6 May 17 15:39 unpack3/foo

I expect all of them upon extraction produce a regular file, but case 2 leaves 
symlink instead.

You can find more listings as well as comparison against bsdtar here: 
https://gist.github.com/artyom/926ec9c49a2077f2820053274f0b1b16





reply via email to

[Prev in Thread] Current Thread [Next in Thread]