Commit dfc5923
committed
fix: skip extract if linkpath is stripped entirely
Fix tar.Unpack() to skip extraction of hardlinks and symlinks when a
'strip' option is provided, if the entry linkpath would be completely
stripped.
Previously, the linkpath would not be stripped if it had fewer path parts
than the strip option.
This matches the behavior of modern versions of bsdtar. Gnutar has the
same extraction semantics, but emits a warning when the resulting
linkpath is completely stripped.1 parent 575a511 commit dfc5923
2 files changed
+4
-10
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
220 | 220 | | |
221 | 221 | | |
222 | 222 | | |
| 223 | + | |
| 224 | + | |
223 | 225 | | |
224 | 226 | | |
225 | 227 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
189 | 189 | | |
190 | 190 | | |
191 | 191 | | |
192 | | - | |
193 | | - | |
194 | | - | |
195 | | - | |
196 | | - | |
197 | | - | |
198 | | - | |
199 | | - | |
200 | | - | |
201 | | - | |
| 192 | + | |
| 193 | + | |
202 | 194 | | |
203 | 195 | | |
204 | 196 | | |
| |||
0 commit comments